Game Develop Core: VariablesContainer.h Source File

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
VariablesContainer.h
Go to the documentation of this file.
1
6 #ifndef GDCORE_VARIABLESCONTAINER_H
7 #define GDCORE_VARIABLESCONTAINER_H
8 #include <string>
9 #include <vector>
10 #include "GDCore/PlatformDefinition/Variable.h"
11 class TiXmlElement;
12
13 namespace gd
14 {
15
26 class GD_CORE_API VariablesContainer
27 {
28 public:
29 VariablesContainer();
30 virtual ~VariablesContainer() {};
31
35
40 bool Has(const std::string & name) const;
41
45 Variable & Get(const std::string & name);
46
50 const Variable & Get(const std::string & name) const;
51
57 std::pair<std::string, gd::Variable> & Get(unsigned int index);
58
64 const std::pair<std::string, gd::Variable> & Get(unsigned int index) const;
65
73 Variable & Insert(const std::string & name, const Variable & variable, unsigned int position);
74
78 unsigned int Count() const { return variables.size(); };
79
80 #if defined(GD_IDE_ONLY)
81
84 unsigned int GetPosition(const std::string & name) const;
85
92 Variable & InsertNew(const std::string & name, unsigned int position);
93
97 void Remove(const std::string & name);
98
102 void Rename(const std::string & oldName, const std::string & newName);
103
107 void Swap(unsigned int firstVariableIndex, unsigned int secondVariableIndex);
108 #endif
109
113 inline void Clear() { variables.clear(); }
115
119
121 #if defined(GD_IDE_ONLY)
122
125 virtual void SaveToXml(TiXmlElement * element) const;
126 #endif
127
131 virtual void LoadFromXml(const TiXmlElement * element);
133
134 private:
135
136 std::vector < std::pair<std::string, gd::Variable> > variables;
137 static std::pair<std::string, Variable> badVariable;
138 };
139
140 }
141
142 #endif // GDCORE_VARIABLESCONTAINER_H