# HG changeset patch # User insilmaril # Date 1204128546 0 # Node ID 367d875453ed5f57aa575c5976056e702350a8d5 # Parent fe3c52c490375b479e816ad9f3a74b0105aafa91 autosave fix diff -r fe3c52c49037 -r 367d875453ed attribute.cpp --- a/attribute.cpp Wed Feb 27 16:08:45 2008 +0000 +++ b/attribute.cpp Wed Feb 27 16:09:06 2008 +0000 @@ -212,6 +212,13 @@ /////////////////////////////////////////////////////////////// AttributeTable::AttributeTable() { + typeList + << "Undefined" + << "IntList" + << "FreeInt" + << "StringList" + << "FreeString" + << "UniqueString"; } AttributeTable::~AttributeTable() @@ -256,11 +263,11 @@ qWarning (QString ("AttributeTable::removeKey (%1) key not in table\n").arg(k).ascii()); } -AttributeDef* AttributeTable::getDef(const QString &k) +AttributeDef* AttributeTable::getDef(const QString &key) { for (int i=0; igetKey()==k ) return attdefs.at(i); - qWarning (QString ("AttributeTable::getDef (%1) key not in table\n").arg(k).ascii()); + if (attdefs.at(i)->getKey()==key ) return attdefs.at(i); + qWarning (QString ("AttributeTable::getDef (%1) key not in table\n").arg(key).ascii()); return NULL; } @@ -277,6 +284,11 @@ return kl; } +QStringList AttributeTable::getTypes () +{ + return typeList; +} + QString AttributeTable::getDataXML() { return valueElement ("attributeList","key","value"); diff -r fe3c52c49037 -r 367d875453ed attribute.h --- a/attribute.h Wed Feb 27 16:08:45 2008 +0000 +++ b/attribute.h Wed Feb 27 16:09:06 2008 +0000 @@ -11,14 +11,16 @@ enum AttributeType { Undefined, //!< Undefined type + IntList, //!< Free integer + FreeInt, //!< Free integer StringList, //!< List of strings, one can be attribute value FreeString, //!< Any string can be attribute value, not unique UniqueString//!< UniqueString, e.g. for IDs }; /*! \brief A key and a value - The data itself is stored in Attribute Definitions (AttributeDef). A list of these tables - AttributeTable is maintained for every MapEditor. + The data itself is stored in Attribute Definitions (AttributeDef). + A list of these tables AttributeTable is maintained for every MapEditor. */ class Attribute:public XMLObj { public: @@ -77,10 +79,12 @@ AttributeDef* getDef(const QString &k); //!< Get defintion of attribute int countKeys(); //!< Return number of keys QStringList getKeys (); + QStringList getTypes(); QString getDataXML(); protected: QList attdefs; + QStringList typeList; };