X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=attributeitem.cpp;fp=attributeitem.cpp;h=0000000000000000000000000000000000000000;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=af014f2d95374d579b764294d0fddf7d828424bd;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/attributeitem.cpp b/attributeitem.cpp deleted file mode 100644 index af014f2..0000000 --- a/attributeitem.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "attributeitem.h" - - -extern bool debug; - -AttributeItem::AttributeItem(const QList &data, TreeItem *parent):BranchItem (data,parent) -{ - TreeItem::setType (Attribute); - internal=false; -} - -AttributeItem::~AttributeItem() -{ -} - -void AttributeItem::set (const QString &k, const QString &v, const Type &) -{ - key=k; - value=QVariant (v); - createHeading(); -} - -void AttributeItem::get (QString &k, QString &v, Type &t) -{ - k=key; - v=value.toString(); - t=attrType; -} - -void AttributeItem::setKey (const QString &k) -{ -/* - if (!table) - { - qWarning (QString("AttributeItem::setKey (%1) No table defined!\n").arg(k).ascii()); - return; - } - - if (!definition) - { - definition=table->getDef(k); - if (!definition) - { - table->addKey (k,t); - return; - } - } - qWarning (QString("AttributeItem::setKey (%1) attribute already defined!\n").arg(k).ascii()); - */ - key=k; - createHeading(); -} - -QString AttributeItem::getKey () -{ -/* - if (!table) - { - qWarning ("AttributeItem::getKey () No table defined!"); - return QString(); - } - if (!definition) - { - qWarning ("AttributeItem::getKey () No attribute defined!"); - return QString (); - } - return definition->getKey(); - */ - return key; -} - -void AttributeItem::setValue(const QString &v) -{ -/* - if (!table) - { - qWarning (QString ("AttributeItem::setValue (%1) No table defined!").arg(v)); - return; - } - if (!definition) - { - qWarning (QString ("AttributeItem::setValue (%1) No attribute defined!").arg(v)); - return; - } - definition->setValue (v); -*/ - value=v; - createHeading(); -} - -QVariant AttributeItem::getValue() -{ -/* - if (!table) - { - qWarning ("AttributeItem::getValue No table defined!"); - return QString(); - } - if (!definition) - { - qWarning ("AttributeItem::getValue No attribute defined!"); - return QString(); - } - QVariant v= definition->getValue(); - return v; - */ - return value; -} - -void AttributeItem::setType (const Type &t) -{ -/* - if (!table) - { - qWarning ("AttributeItem::setType No table defined!"); - return; - } - if (!definition) - { - qWarning ("Attribute::setType No attribute defined!"); - return; - } - definition->setType (t); -*/ - attrType=t; -} - -AttributeItem::Type AttributeItem::getAttributeType() -{ -/* - if (!table) - { - qWarning ("AttributeItem::getType No table defined!"); - return Undefined; - } - if (!definition) - { - qWarning ("AttributeItem::getType No attribute defined!"); - return Undefined; - } - return definition->getType(); -*/ - return attrType; -} - -QString AttributeItem::getTypeString() -{ -/* - if (!table) - { - qWarning ("AttributeItem::getTypeString No table defined!"); - return "Undefined"; - } - if (!definition) - { - qWarning ("Attribute::getTypeString No AttributeItem defined!"); - return "Undefined"; - } - return definition->getTypeString(); -*/ - switch (attrType) - { - case IntList: return "IntList"; - case FreeInt: return "FreeInt"; - case StringList:return "StringList"; - case FreeString:return "FreeString"; - case UniqueString: return "UniqueString"; - default: return "Undefined"; - } -} - -void AttributeItem::setInternal(bool b) -{ - internal=b; -} - -bool AttributeItem::isInternal() -{ - return internal; -} - -QString AttributeItem::getDataXML() -{ - QString a; - a=attribut ("key",getKey()); - a+=attribut ("value",getValue().toString() ); - a+=attribut ("type",getTypeString () ); - return singleElement ("attribute",a); -} - -void AttributeItem::createHeading() -{ - setHeadingPlainText (QString ("K: %1 | V: %2").arg(key).arg(value.toString())); -} -