OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
universalid.hpp
Go to the documentation of this file.
1 #ifndef CSM_WOLRD_UNIVERSALID_H
2 #define CSM_WOLRD_UNIVERSALID_H
3 
4 #include <string>
5 #include <iosfwd>
6 #include <vector>
7 
8 #include <QMetaType>
9 
10 namespace CSMWorld
11 {
13  {
14  public:
15 
16  enum Class
17  {
20  Class_RefRecord = 2, // referenceable record
23  Class_Collection = 16, // multiple types of records combined
24  Class_Transient = 32, // not part of the world data or the project data
25  Class_NonRecord = 64, // record like data that is not part of the world
27  Class_ResourceList = 256
29  };
30 
32  {
36  };
37 
40  enum Type
41  {
42  Type_None = 0,
68  Type_Cell_Missing, //For cells that does not exist yet.
137  };
138 
140 
141  private:
142 
146  std::string mId;
147  int mIndex;
148 
149  public:
150 
151  UniversalId (const std::string& universalId);
152 
153  UniversalId (Type type = Type_None);
154 
155  UniversalId (Type type, const std::string& id);
157 
158  UniversalId (Type type, int index);
160 
161  Class getClass() const;
162 
164 
165  Type getType() const;
166 
167  const std::string& getId() const;
169 
170  int getIndex() const;
172 
173  bool isEqual (const UniversalId& universalId) const;
174 
175  bool isLess (const UniversalId& universalId) const;
176 
177  std::string getTypeName() const;
178 
179  std::string toString() const;
180 
181  std::string getIcon() const;
183 
184  static std::vector<Type> listReferenceableTypes();
185 
186  static std::vector<Type> listTypes (int classes);
187 
191  static Type getParentType (Type type);
192  };
193 
194  bool operator== (const UniversalId& left, const UniversalId& right);
195  bool operator!= (const UniversalId& left, const UniversalId& right);
196 
197  bool operator< (const UniversalId& left, const UniversalId& right);
198 
199  std::ostream& operator< (std::ostream& stream, const UniversalId& universalId);
200 }
201 
202 Q_DECLARE_METATYPE (CSMWorld::UniversalId)
203 
204 #endif
Definition: universalid.hpp:125
int getIndex() const
Calling this function for a non-index type will throw an exception.
Definition: universalid.cpp:262
Definition: universalid.hpp:101
Definition: universalid.hpp:126
Definition: universalid.hpp:75
Definition: universalid.hpp:111
Definition: universalid.hpp:77
std::string toString() const
Definition: universalid.cpp:313
Definition: universalid.hpp:59
Definition: universalid.hpp:33
Definition: universalid.hpp:23
Definition: universalid.hpp:104
Definition: universalid.hpp:115
static Type getParentType(Type type)
Definition: universalid.cpp:371
Definition: universalid.hpp:50
Definition: universalid.hpp:56
std::string mId
Definition: universalid.hpp:146
Definition: universalid.hpp:54
Definition: universalid.hpp:62
static std::vector< Type > listReferenceableTypes()
Definition: universalid.cpp:341
Definition: universalid.hpp:118
Definition: universalid.hpp:98
Definition: universalid.hpp:70
Definition: universalid.hpp:94
Definition: universalid.hpp:95
Definition: universalid.hpp:83
Definition: universalid.hpp:66
Definition: universalid.hpp:46
bool isEqual(const UniversalId &universalId) const
Definition: universalid.cpp:270
Definition: universalid.hpp:82
Definition: universalid.hpp:105
Definition: universalid.hpp:129
Type
Definition: universalid.hpp:40
Definition: universalid.hpp:53
ArgumentType getArgumentType() const
Definition: universalid.cpp:244
Definition: universalid.hpp:120
static std::vector< Type > listTypes(int classes)
Definition: universalid.cpp:352
Definition: universalid.hpp:61
Definition: universalid.hpp:51
Definition: universalid.hpp:74
Definition: universalid.hpp:55
Definition: universalid.hpp:84
Definition: universalid.hpp:89
Definition: universalid.hpp:124
Definition: universalid.hpp:47
Definition: universalid.hpp:18
Definition: universalid.hpp:19
std::string getTypeName() const
Definition: universalid.cpp:301
UniversalId(const std::string &universalId)
Definition: universalid.cpp:137
respective collection
Definition: universalid.hpp:28
Definition: universalid.hpp:20
Definition: universalid.hpp:103
Definition: universalid.hpp:132
Definition: universalid.hpp:65
Definition: universalid.hpp:78
Definition: universalid.hpp:35
Type getType() const
Definition: universalid.cpp:249
Definition: universalid.hpp:112
bool operator<(const CellCoordinates &left, const CellCoordinates &right)
Definition: cellcoordinates.cpp:79
Definition: universalid.hpp:133
Class mClass
Definition: universalid.hpp:143
Class getClass() const
Definition: universalid.cpp:239
Definition: universalid.hpp:57
Definition: universalid.hpp:76
Definition: universalid.hpp:90
Definition: universalid.hpp:128
Definition: universalid.hpp:44
Definition: universalid.hpp:26
Definition: universalid.hpp:99
Definition: universalid.hpp:22
Definition: universalid.hpp:127
Definition: universalid.hpp:68
Definition: universalid.hpp:63
Definition: universalid.hpp:64
Definition: universalid.hpp:34
Definition: universalid.hpp:123
bool operator==(const CellCoordinates &left, const CellCoordinates &right)
Definition: cellcoordinates.cpp:69
Definition: universalid.hpp:117
ArgumentType mArgumentType
Definition: universalid.hpp:144
Definition: universalid.hpp:139
ArgumentType
Definition: universalid.hpp:31
Definition: universalid.hpp:87
bool operator!=(const CellCoordinates &left, const CellCoordinates &right)
Definition: cellcoordinates.cpp:74
Definition: universalid.hpp:102
Definition: universalid.hpp:108
Definition: universalid.hpp:97
Definition: universalid.hpp:67
Definition: universalid.hpp:85
Definition: universalid.hpp:122
bool isLess(const UniversalId &universalId) const
Definition: universalid.cpp:284
Definition: universalid.hpp:25
Definition: universalid.hpp:110
int mIndex
Definition: universalid.hpp:147
Definition: universalid.hpp:96
Definition: universalid.hpp:116
std::string getIcon() const
Will return an empty string, if no icon is available.
Definition: universalid.cpp:329
Definition: universalid.hpp:79
Definition: universalid.hpp:91
Definition: universalid.hpp:131
Definition: universalid.hpp:49
Definition: universalid.hpp:73
Definition: universalid.hpp:86
Definition: universalid.hpp:71
Definition: universalid.hpp:121
Definition: universalid.hpp:130
const std::string & getId() const
Calling this function for a non-ID type will throw an exception.
Definition: universalid.cpp:254
Definition: universalid.hpp:135
Definition: universalid.hpp:52
Definition: universalid.hpp:88
Definition: universalid.hpp:48
Definition: universalid.hpp:113
Class
Definition: universalid.hpp:16
Definition: universalid.hpp:106
Definition: universalid.hpp:119
Definition: universalid.hpp:42
Definition: universalid.hpp:58
Definition: universalid.hpp:100
Definition: universalid.hpp:92
Definition: universalid.hpp:107
Definition: universalid.hpp:93
Definition: universalid.hpp:21
Definition: universalid.hpp:134
Type mType
Definition: universalid.hpp:145
Definition: universalid.hpp:80
Definition: universalid.hpp:114
Definition: universalid.hpp:43
Definition: universalid.hpp:136
Definition: universalid.hpp:24
Definition: universalid.hpp:109
Definition: universalid.hpp:69
Definition: universalid.hpp:72
Definition: universalid.hpp:12
Definition: universalid.hpp:60