Game Develop Core: PlatformExtension.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
PlatformExtension.h
Go to the documentation of this file.
1
6 #ifndef GDCORE_PLATFORMEXTENSION_H
7 #define GDCORE_PLATFORMEXTENSION_H
8 #include <map>
9 #include <string>
10 #include <vector>
11 #include <boost/shared_ptr.hpp>
12 #include "GDCore/Events/ObjectMetadata.h"
13 #include "GDCore/Events/AutomatismMetadata.h"
14 #include "GDCore/Events/EventMetadata.h"
15 namespace gd { class Instruction; }
16 namespace gd { class InstructionMetadata; }
17 namespace gd { class ExpressionMetadata; }
18 namespace gd { class ObjectMetadata; }
19 namespace gd { class AutomatismMetadata; }
20 namespace gd { class BaseEvent; }
21 namespace gd { class EventMetadata; }
22 namespace gd { class StrExpressionMetadata; }
23 namespace gd { class EventCodeGenerator; }
24 namespace gd { class ArbitraryResourceWorker; }
25 namespace gd { class AutomatismsSharedData; }
26 namespace gd { class Automatism; }
27 namespace gd { class Object; }
28
29 typedef void (*DestroyFunPtr)(gd::Object*);
30 typedef gd::Object * (*CreateFunPtr)(std::string name);
31
32 namespace gd
33 {
34
38 class GD_CORE_API CompilationInfo
39 {
40 public :
41 CompilationInfo() : informationCompleted(false) {};
42 virtual ~CompilationInfo() {};
43
44 bool informationCompleted;
45
46 bool runtimeOnly;
47
48 #if defined(__GNUC__)
49 int gccMajorVersion;
50 int gccMinorVersion;
51 int gccPatchLevel;
52 #endif
53
54 int boostVersion;
55
56 int sfmlMajorVersion;
57 int sfmlMinorVersion;
58
59 #if defined(GD_IDE_ONLY)
60 int wxWidgetsMajorVersion;
61 int wxWidgetsMinorVersion;
62 int wxWidgetsReleaseNumber;
63 int wxWidgetsSubReleaseNumber;
64 #endif
65
66 std::string gdCoreVersion;
67 int sizeOfpInt;
68 };
69
70
76 class GD_CORE_API PlatformExtension
77 {
78 public:
79 CompilationInfo compilationInfo;
80
81 PlatformExtension();
82 virtual ~PlatformExtension();
83
87 void SetExtensionInformation(const std::string & name_,
88 const std::string & fullname_,
89 const std::string & description_,
90 const std::string & author_,
91 const std::string & license_);
92
97 gd::InstructionMetadata & AddCondition(const std::string & name_,
98 const std::string & fullname_,
99 const std::string & description_,
100 const std::string & sentence_,
101 const std::string & group_,
102 const std::string & icon_,
103 const std::string & smallicon_);
104
109 gd::InstructionMetadata & AddAction(const std::string & name_,
110 const std::string & fullname_,
111 const std::string & description_,
112 const std::string & sentence_,
113 const std::string & group_,
114 const std::string & icon_,
115 const std::string & smallicon_);
120 gd::ExpressionMetadata & AddExpression(const std::string & name_,
121 const std::string & fullname_,
122 const std::string & description_,
123 const std::string & group_,
124 const std::string & smallicon_);
129 gd::StrExpressionMetadata & AddStrExpression(const std::string & name_,
130 const std::string & fullname_,
131 const std::string & description_,
132 const std::string & group_,
133 const std::string & smallicon_);
134
159 gd::ObjectMetadata & AddObject(const std::string & name_,
160 const std::string & fullname_,
161 const std::string & description_,
162 const std::string & icon24x24_,
163 CreateFunPtr createFunPtrP,
164 DestroyFunPtr destroyFunPtrP);
165
178 gd::AutomatismMetadata & AddAutomatism(const std::string & name_,
179 const std::string & fullname_,
180 const std::string & defaultName_,
181 const std::string & description_,
182 const std::string & group_,
183 const std::string & icon24x24_,
184 const std::string & className_,
185 boost::shared_ptr<gd::Automatism> instance,
186 boost::shared_ptr<gd::AutomatismsSharedData> sharedDatasInstance);
187
192 gd::EventMetadata & AddEvent(const std::string & name_,
193 const std::string & fullname_,
194 const std::string & description_,
195 const std::string & group_,
196 const std::string & smallicon_,
197 boost::shared_ptr<gd::BaseEvent> instance);
198
202 const std::string & GetFullName() const { return fullname; }
203
207 const std::string & GetName() const { return name; }
208
212 const std::string & GetDescription() const { return informations; }
213
217 const std::string & GetAuthor() const { return author; }
218
222 const std::string & GetLicense() const { return license; }
223
227 bool IsBuiltin() const;
228
233 std::string GetNameSpace() { return nameSpace; };
234
238 std::vector < std::string > GetExtensionObjectsTypes() const;
239
243 std::vector < std::string > GetAutomatismsTypes() const;
244
248 CreateFunPtr GetObjectCreationFunctionPtr(std::string objectType) const;
249
253 DestroyFunPtr GetDestroyObjectFunction(std::string objectType) const;
254
260 boost::shared_ptr<gd::BaseEvent> CreateEvent(std::string eventType) const;
266 gd::Automatism* CreateAutomatism(std::string automatismType) const;
267
273 boost::shared_ptr<gd::AutomatismsSharedData> CreateAutomatismSharedDatas(std::string automatismType) const;
274
278 ObjectMetadata & GetObjectMetadata(const std::string & objectType);
279
283 AutomatismMetadata & GetAutomatismMetadata(const std::string & automatismType);
284
288 std::map<std::string, gd::EventMetadata > & GetAllEvents();
289
293 std::map<std::string, gd::AutomatismMetadata > & GetAllAutomatisms();
294
295 #if defined(GD_IDE_ONLY)
296
299 std::map<std::string, gd::InstructionMetadata > & GetAllActions();
300
304 std::map<std::string, gd::InstructionMetadata > & GetAllConditions();
305
309 std::map<std::string, gd::ExpressionMetadata > & GetAllExpressions();
310
314 std::map<std::string, gd::StrExpressionMetadata > & GetAllStrExpressions();
315
319 std::map<std::string, gd::InstructionMetadata > & GetAllActionsForObject(std::string objectType);
320
324 std::map<std::string, gd::InstructionMetadata > & GetAllConditionsForObject(std::string objectType);
325
329 std::map<std::string, gd::ExpressionMetadata > & GetAllExpressionsForObject(std::string objectType);
330
334 std::map<std::string, gd::StrExpressionMetadata > & GetAllStrExpressionsForObject(std::string objectType);
335
339 std::map<std::string, gd::InstructionMetadata > & GetAllActionsForAutomatism(std::string autoType);
340
344 std::map<std::string, gd::InstructionMetadata > & GetAllConditionsForAutomatism(std::string autoType);
345
349 std::map<std::string, gd::ExpressionMetadata > & GetAllExpressionsForAutomatism(std::string autoType);
350
354 std::map<std::string, gd::StrExpressionMetadata > & GetAllStrExpressionsForAutomatism(std::string autoType);
355
361 virtual void ExposeConditionsResources(Instruction & condition, gd::ArbitraryResourceWorker & worker) {};
362
368 virtual void ExposeActionsResources(Instruction & action, gd::ArbitraryResourceWorker & worker) {};
369
382 void CloneExtension(const std::string & platformName, const std::string & extensionName, bool stripFunctionsNameAndCodeGeneration = true);
383
387 void StripUnimplementedInstructionsAndExpressions();
388 #endif
389
393 static std::vector<std::string> GetBuiltinExtensionsNames();
394
397
402 /*template<class Archive>
403 void Serialize(Archive & archive);*/
404
406
407 private:
408
412 void SetNameSpace(std::string nameSpace_);
413
414 std::string name;
415 std::string nameSpace;
416 std::string fullname;
417 std::string informations;
418 std::string author;
419 std::string license;
420
421 std::map<std::string, gd::ObjectMetadata > objectsInfos;
422 std::map<std::string, gd::AutomatismMetadata > automatismsInfo;
423 #if defined(GD_IDE_ONLY)
424 std::map<std::string, gd::InstructionMetadata > conditionsInfos;
425 std::map<std::string, gd::InstructionMetadata > actionsInfos;
426 std::map<std::string, gd::ExpressionMetadata > expressionsInfos;
427 std::map<std::string, gd::StrExpressionMetadata > strExpressionsInfos;
428 std::map<std::string, gd::EventMetadata > eventsInfos;
429 #endif
430
431 ObjectMetadata badObjectMetadata;
432 AutomatismMetadata badAutomatismMetadata;
433 #if defined(GD_IDE_ONLY)
434 static std::map<std::string, gd::InstructionMetadata > badConditionsMetadata;
435 static std::map<std::string, gd::InstructionMetadata > badActionsMetadata;
436 static std::map<std::string, gd::ExpressionMetadata > badExpressionsMetadata;
437 static std::map<std::string, gd::StrExpressionMetadata > badStrExpressionsMetadata;
438 #endif
439 };
440
441 }
442
443
444 #if defined(GD_IDE_ONLY)
445
448 #define GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION() compilationInfo.runtimeOnly = false; \
449 compilationInfo.boostVersion = BOOST_VERSION; \
450 compilationInfo.sfmlMajorVersion = 2; \
451 compilationInfo.sfmlMinorVersion = 0; \
452 compilationInfo.gdCoreVersion = GDCore_RC_FILEVERSION_STRING; \
453 compilationInfo.sizeOfpInt = sizeof(int*); \
454 compilationInfo.wxWidgetsMajorVersion = wxMAJOR_VERSION; \
455 compilationInfo.wxWidgetsMinorVersion = wxMINOR_VERSION; \
456 compilationInfo.wxWidgetsReleaseNumber = wxRELEASE_NUMBER; \
457 compilationInfo.wxWidgetsSubReleaseNumber = wxSUBRELEASE_NUMBER; \
458 compilationInfo.gccMajorVersion = __GNUC__; \
459 compilationInfo.gccMinorVersion = __GNUC_MINOR__; \
460 compilationInfo.gccPatchLevel = __GNUC_PATCHLEVEL__; \
461 compilationInfo.informationCompleted = true;
462 #else
463
466 #define GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION() compilationInfo.runtimeOnly = true;\
467 compilationInfo.boostVersion = BOOST_VERSION; \
468 compilationInfo.sfmlMajorVersion = 2; \
469 compilationInfo.sfmlMinorVersion = 0; \
470 compilationInfo.gdCoreVersion = GDCore_RC_FILEVERSION_STRING; \
471 compilationInfo.sizeOfpInt = sizeof(int*); \
472 compilationInfo.gccMajorVersion = __GNUC__; \
473 compilationInfo.gccMinorVersion = __GNUC_MINOR__; \
474 compilationInfo.gccPatchLevel = __GNUC_PATCHLEVEL__; \
475 compilationInfo.informationCompleted = true;
476
477 #endif
478
479 #endif // GDCORE_PLATFORMEXTENSION_H