diff -r 000000000000 -r 6b0a5f4923d3 attributeitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/attributeitem.h Thu Sep 17 09:41:09 2009 +0000 @@ -0,0 +1,41 @@ +#ifndef ATTRIBUTEITEM_H +#define ATTRIBUTEITEM_H + +#include +#include + +#include "treeitem.h" + +/*! \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. +*/ +class AttributeItem:public TreeItem { + +enum Type { + 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 +}; + +public: + AttributeItem(const QList &data, TreeItem *parent = 0); + virtual ~AttributeItem(); + void setKey (const QString &k, const Type &t); + QString getKey (); + void setValue (const QString &v); + QVariant getValue (); + void setType (const Type &t); + AttributeItem::Type getAttributeType (); + QString getTypeString (); + QString getDataXML(); +protected: + QString freeString; //!< String value for type FreeString + bool internal; //!< Internal attributes cannot be edited by user +}; + +#endif +