]> git.sven.stormbind.net Git - sven/vym.git/blob - attributeitem.h
Import Upstream version 2.6.11
[sven/vym.git] / attributeitem.h
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 public:
15 enum Type {
16     Undefined,  //!< Undefined type
17     IntList,    //!< Integer
18     FreeInt,    //!< Integer
19     StringList, //!< List of strings
20     FreeString, //!< String
21     UniqueString//!< String which is unique in a map, e.g. for IDs
22 };
23
24     AttributeItem(const QList<QVariant> &data, TreeItem *parent = 0);
25     virtual ~AttributeItem();
26     void set (const QString &k, const QString &v, const Type &t);
27     void get (QString &k, QString &v, Type &t);
28     void setKey (const QString &k);
29     QString getKey ();
30     void setValue (const QString &v);
31     QVariant getValue ();
32     using BranchItem::setType;
33     virtual void setType (const Type &t);
34     AttributeItem::Type getAttributeType ();
35     QString getTypeString ();
36     void setInternal (bool b);
37     bool isInternal();
38     QString getDataXML();
39 protected:
40     void createHeading();
41     bool internal;          //!< Internal attributes cannot be edited by user
42     QString key;
43     QVariant value;
44     Type attrType;
45 };
46
47 #endif
48