Game Develop Core: ObjectGroup.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
ObjectGroup.h
Go to the documentation of this file.
1
6 #ifndef GDCORE_OBJECTGROUP_H
7 #define GDCORE_OBJECTGROUP_H
8 #include <vector>
9 #include <string>
10 #include <utility>
11 class TiXmlElement;
12
13 namespace gd
14 {
15
24 class GD_CORE_API ObjectGroup
25 {
26 public:
27
28 ObjectGroup() {};
29 virtual ~ObjectGroup() {};
30
34 bool Find(const std::string & name) const;
35
39 void AddObject(const std::string & name);
40
44 void RemoveObject(const std::string & name);
45
48 inline const std::string & GetName() const { return name; };
49
52 inline void SetName(const std::string & name_) {name = name_;};
53
57 inline const std::vector < std::string > & GetAllObjectsNames() const
58 {
59 return memberObjects;
60 }
61
62 static void LoadFromXml(std::vector < gd::ObjectGroup > & list, const TiXmlElement * elem);
63 static void SaveToXml(const std::vector < gd::ObjectGroup > & list, TiXmlElement * grpsobjets);
64
65 private:
66 std::vector < std::string > memberObjects;
67 std::string name;
68 };
69
84 struct GroupHasTheSameName : public std::binary_function<ObjectGroup, std::string, bool>
85 {
86 bool operator ()( const ObjectGroup & group, const std::string & name ) const
87 {
88 return group.GetName() == name;
89 }
90 };
91
92 }
93
94 #endif // GDCORE_OBJECTGROUP_H