Game Develop Core: ExternalEvents.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
ExternalEvents.h
Go to the documentation of this file.
1
6 #ifndef GDCORE_EXTERNALEVENTS_H
7 #define GDCORE_EXTERNALEVENTS_H
8 #include <vector>
9 #include <string>
10 #include <boost/shared_ptr.hpp>
11 namespace gd { class BaseEvent; }
12 namespace gd { class Project; }
13 class TiXmlElement;
14
15 namespace gd
16 {
17
23 class GD_CORE_API ExternalEvents
24 {
25 public:
26 ExternalEvents();
27 ExternalEvents(const ExternalEvents&);
28 virtual ~ExternalEvents() {};
29 ExternalEvents& operator=(const ExternalEvents & rhs);
30
41 virtual ExternalEvents * Clone() const { return new ExternalEvents(*this); };
42
46 virtual const std::string & GetName() const {return name;};
47
51 virtual void SetName(const std::string & name_) {name = name_;};
52
58 virtual const std::string & GetAssociatedLayout() const {return associatedScene;};
59
63 virtual void SetAssociatedLayout(const std::string & name_) {associatedScene = name_;};
64
71 time_t GetLastChangeTimeStamp() const { return lastChangeTimeStamp; };
72
78 void SetLastChangeTimeStamp(time_t newTimeStamp) { lastChangeTimeStamp = newTimeStamp; };
79
83 virtual const std::vector<boost::shared_ptr<gd::BaseEvent> > & GetEvents() const { return events; }
84
88 virtual std::vector<boost::shared_ptr<gd::BaseEvent> > & GetEvents() { return events; }
89
93 virtual void LoadFromXml(gd::Project & project, const TiXmlElement * element);
94
98 virtual void SaveToXml(TiXmlElement * element) const;
99
100 private:
101
102 std::string name;
103 std::string associatedScene;
104 time_t lastChangeTimeStamp;
105 std::vector < boost::shared_ptr<BaseEvent> > events;
106
111 void Init(const ExternalEvents & externalEvents);
112 };
113
117 struct ExternalEventsHasName : public std::binary_function<boost::shared_ptr<gd::ExternalEvents>, std::string, bool> {
118 bool operator()(const boost::shared_ptr<gd::ExternalEvents> & externalEvents, std::string name) const { return externalEvents->GetName() == name; }
119 };
120
121 }
122
123 #endif // GDCORE_EXTERNALEVENTS_H