1.1 --- a/attribute.cpp Wed Feb 27 16:08:45 2008 +0000
1.2 +++ b/attribute.cpp Wed Feb 27 16:09:06 2008 +0000
1.3 @@ -212,6 +212,13 @@
1.4 ///////////////////////////////////////////////////////////////
1.5 AttributeTable::AttributeTable()
1.6 {
1.7 + typeList
1.8 + << "Undefined"
1.9 + << "IntList"
1.10 + << "FreeInt"
1.11 + << "StringList"
1.12 + << "FreeString"
1.13 + << "UniqueString";
1.14 }
1.15
1.16 AttributeTable::~AttributeTable()
1.17 @@ -256,11 +263,11 @@
1.18 qWarning (QString ("AttributeTable::removeKey (%1) key not in table\n").arg(k).ascii());
1.19 }
1.20
1.21 -AttributeDef* AttributeTable::getDef(const QString &k)
1.22 +AttributeDef* AttributeTable::getDef(const QString &key)
1.23 {
1.24 for (int i=0; i<attdefs.count();++i)
1.25 - if (attdefs.at(i)->getKey()==k ) return attdefs.at(i);
1.26 - qWarning (QString ("AttributeTable::getDef (%1) key not in table\n").arg(k).ascii());
1.27 + if (attdefs.at(i)->getKey()==key ) return attdefs.at(i);
1.28 + qWarning (QString ("AttributeTable::getDef (%1) key not in table\n").arg(key).ascii());
1.29 return NULL;
1.30 }
1.31
1.32 @@ -277,6 +284,11 @@
1.33 return kl;
1.34 }
1.35
1.36 +QStringList AttributeTable::getTypes ()
1.37 +{
1.38 + return typeList;
1.39 +}
1.40 +
1.41 QString AttributeTable::getDataXML()
1.42 {
1.43 return valueElement ("attributeList","key","value");
2.1 --- a/attribute.h Wed Feb 27 16:08:45 2008 +0000
2.2 +++ b/attribute.h Wed Feb 27 16:09:06 2008 +0000
2.3 @@ -11,14 +11,16 @@
2.4
2.5 enum AttributeType {
2.6 Undefined, //!< Undefined type
2.7 + IntList, //!< Free integer
2.8 + FreeInt, //!< Free integer
2.9 StringList, //!< List of strings, one can be attribute value
2.10 FreeString, //!< Any string can be attribute value, not unique
2.11 UniqueString//!< UniqueString, e.g. for IDs
2.12 };
2.13
2.14 /*! \brief A key and a value
2.15 - The data itself is stored in Attribute Definitions (AttributeDef). A list of these tables
2.16 - AttributeTable is maintained for every MapEditor.
2.17 + The data itself is stored in Attribute Definitions (AttributeDef).
2.18 + A list of these tables AttributeTable is maintained for every MapEditor.
2.19 */
2.20 class Attribute:public XMLObj {
2.21 public:
2.22 @@ -77,10 +79,12 @@
2.23 AttributeDef* getDef(const QString &k); //!< Get defintion of attribute
2.24 int countKeys(); //!< Return number of keys
2.25 QStringList getKeys ();
2.26 + QStringList getTypes();
2.27 QString getDataXML();
2.28
2.29 protected:
2.30 QList <AttributeDef*> attdefs;
2.31 + QStringList typeList;
2.32 };
2.33
2.34