attributeitem.h
author insilmaril
Wed, 10 Feb 2010 13:48:42 +0000
changeset 822 c2ce9944148c
parent 795 6b0a5f4923d3
child 823 0bba81dde1bc
permissions -rw-r--r--
More fixes and sorting lexically backwards
     1 #ifndef ATTRIBUTEITEM_H
     2 #define ATTRIBUTEITEM_H
     3 
     4 #include <QStringList>
     5 #include <QVariant>
     6 
     7 #include "branchitem.h"
     8 
     9 /*! \brief A key and a value 
    10     The data itself is stored in Attribute Definitions (AttributeDef). 
    11 	A list of these tables AttributeTable is maintained for every MapEditor.
    12 */
    13 class AttributeItem:public BranchItem {
    14 
    15 enum Type {
    16 	Undefined,	//!< Undefined type
    17 	IntList,	//!< Free integer
    18 	FreeInt,	//!< Free integer
    19 	StringList, //!< List of strings, one can be attribute value
    20 	FreeString,	//!< Any string can be attribute value, not unique
    21 	UniqueString//!< UniqueString, e.g. for IDs
    22 };
    23 
    24 public:
    25 	AttributeItem(const QList<QVariant> &data, TreeItem *parent = 0);
    26 	virtual ~AttributeItem();
    27 	void setKey (const QString &k, const Type &t);
    28 	QString getKey ();
    29 	void setValue (const QString &v);
    30 	QVariant getValue ();
    31 	void setType (const Type &t);
    32 	AttributeItem::Type getAttributeType ();
    33 	QString getTypeString ();
    34 	QString getDataXML();
    35 protected:
    36 	QString freeString;		//!< String value for type FreeString
    37 	bool internal;			//!< Internal attributes cannot be edited by user
    38 };
    39 
    40 #endif
    41