attributeitem.h
changeset 795 6b0a5f4923d3
child 822 c2ce9944148c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/attributeitem.h	Thu Sep 17 09:41:09 2009 +0000
     1.3 @@ -0,0 +1,41 @@
     1.4 +#ifndef ATTRIBUTEITEM_H
     1.5 +#define ATTRIBUTEITEM_H
     1.6 +
     1.7 +#include <QStringList>
     1.8 +#include <QVariant>
     1.9 +
    1.10 +#include "treeitem.h"
    1.11 +
    1.12 +/*! \brief A key and a value 
    1.13 +    The data itself is stored in Attribute Definitions (AttributeDef). 
    1.14 +	A list of these tables AttributeTable is maintained for every MapEditor.
    1.15 +*/
    1.16 +class AttributeItem:public TreeItem {
    1.17 +
    1.18 +enum Type {
    1.19 +	Undefined,	//!< Undefined type
    1.20 +	IntList,	//!< Free integer
    1.21 +	FreeInt,	//!< Free integer
    1.22 +	StringList, //!< List of strings, one can be attribute value
    1.23 +	FreeString,	//!< Any string can be attribute value, not unique
    1.24 +	UniqueString//!< UniqueString, e.g. for IDs
    1.25 +};
    1.26 +
    1.27 +public:
    1.28 +	AttributeItem(const QList<QVariant> &data, TreeItem *parent = 0);
    1.29 +	virtual ~AttributeItem();
    1.30 +	void setKey (const QString &k, const Type &t);
    1.31 +	QString getKey ();
    1.32 +	void setValue (const QString &v);
    1.33 +	QVariant getValue ();
    1.34 +	void setType (const Type &t);
    1.35 +	AttributeItem::Type getAttributeType ();
    1.36 +	QString getTypeString ();
    1.37 +	QString getDataXML();
    1.38 +protected:
    1.39 +	QString freeString;		//!< String value for type FreeString
    1.40 +	bool internal;			//!< Internal attributes cannot be edited by user
    1.41 +};
    1.42 +
    1.43 +#endif
    1.44 +