OpenMW
apps/opencs/model/world/universalid.hpp
Go to the documentation of this file.
00001 #ifndef CSM_WOLRD_UNIVERSALID_H
00002 #define CSM_WOLRD_UNIVERSALID_H
00003 
00004 #include <string>
00005 #include <iosfwd>
00006 #include <vector>
00007 
00008 #include <QMetaType>
00009 
00010 namespace CSMWorld
00011 {
00012     class UniversalId
00013     {
00014         public:
00015 
00016             enum Class
00017             {
00018                 Class_None = 0,
00019                 Class_Record,
00020                 Class_RefRecord, // referenceable record
00021                 Class_SubRecord,
00022                 Class_RecordList,
00023                 Class_Collection, // multiple types of records combined
00024                 Class_Transient, // not part of the world data or the project data
00025                 Class_NonRecord // record like data that is not part of the world
00026             };
00027 
00028             enum ArgumentType
00029             {
00030                 ArgumentType_None,
00031                 ArgumentType_Id,
00032                 ArgumentType_Index
00033             };
00034 
00035             enum Type
00036             {
00037                 Type_None = 0,
00038                 Type_Globals,
00039                 Type_Global,
00040                 Type_VerificationResults,
00041                 Type_Gmsts,
00042                 Type_Gmst,
00043                 Type_Skills,
00044                 Type_Skill,
00045                 Type_Classes,
00046                 Type_Class,
00047                 Type_Factions,
00048                 Type_Faction,
00049                 Type_Races,
00050                 Type_Race,
00051                 Type_Sounds,
00052                 Type_Sound,
00053                 Type_Scripts,
00054                 Type_Script,
00055                 Type_Regions,
00056                 Type_Region,
00057                 Type_Birthsigns,
00058                 Type_Birthsign,
00059                 Type_Spells,
00060                 Type_Spell,
00061                 Type_Cells,
00062                 Type_Cell,
00063                 Type_Referenceables,
00064                 Type_Referenceable,
00065                 Type_Activator,
00066                 Type_Potion,
00067                 Type_Apparatus,
00068                 Type_Armor,
00069                 Type_Book,
00070                 Type_Clothing,
00071                 Type_Container,
00072                 Type_Creature,
00073                 Type_Door,
00074                 Type_Ingredient,
00075                 Type_CreatureLevelledList,
00076                 Type_ItemLevelledList,
00077                 Type_Light,
00078                 Type_Lockpick,
00079                 Type_Miscellaneous,
00080                 Type_Npc,
00081                 Type_Probe,
00082                 Type_Repair,
00083                 Type_Static,
00084                 Type_Weapon,
00085                 Type_References,
00086                 Type_Reference,
00087                 Type_RegionMap,
00088                 Type_Filter,
00089                 Type_Filters,
00090                 Type_Topics,
00091                 Type_Topic,
00092                 Type_Journals,
00093                 Type_Journal,
00094                 Type_TopicInfos,
00095                 Type_TopicInfo,
00096                 Type_JournalInfos,
00097                 Type_JournalInfo,
00098                 Type_Scene
00099             };
00100 
00101             enum { NumberOfTypes = Type_Scene+1 };
00102 
00103         private:
00104 
00105             Class mClass;
00106             ArgumentType mArgumentType;
00107             Type mType;
00108             std::string mId;
00109             int mIndex;
00110 
00111         public:
00112 
00113             UniversalId (const std::string& universalId);
00114 
00115             UniversalId (Type type = Type_None);
00116 
00117             UniversalId (Type type, const std::string& id);
00119 
00120             UniversalId (Type type, int index);
00122 
00123             Class getClass() const;
00124 
00125             ArgumentType getArgumentType() const;
00126 
00127             Type getType() const;
00128 
00129             const std::string& getId() const;
00131 
00132             int getIndex() const;
00134 
00135             bool isEqual (const UniversalId& universalId) const;
00136 
00137             bool isLess (const UniversalId& universalId) const;
00138 
00139             std::string getTypeName() const;
00140 
00141             std::string toString() const;
00142 
00143             std::string getIcon() const;
00145 
00146             static std::vector<Type> listReferenceableTypes();
00147     };
00148 
00149     bool operator== (const UniversalId& left, const UniversalId& right);
00150     bool operator!= (const UniversalId& left, const UniversalId& right);
00151 
00152     bool operator< (const UniversalId& left, const UniversalId& right);
00153 
00154     std::ostream& operator< (std::ostream& stream, const UniversalId& universalId);
00155 }
00156 
00157 Q_DECLARE_METATYPE (CSMWorld::UniversalId)
00158 
00159 #endif