Game Develop Core: ExpressionMetadata.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
ExpressionMetadata.h
Go to the documentation of this file.
1
5 #ifndef EXPRESSIONMETADATA_H
6 #define EXPRESSIONMETADATA_H
7 #if defined(GD_IDE_ONLY)
8 #include <string>
9 #include "GDCore/Events/Instruction.h"
10 #include "GDCore/Events/InstructionMetadata.h"
11 #include <boost/shared_ptr.hpp>
12 #if !defined(GD_NO_WX_GUI)
13 #include <wx/bitmap.h>
14 #endif
15 class wxBitmap;
16 namespace gd { class Layout; }
17
18 namespace gd
19 {
20
24 class ExpressionCodeGenerationInformation
25 {
26 public:
27 ExpressionCodeGenerationInformation() : staticFunction(false) {};
28 virtual ~ExpressionCodeGenerationInformation() {};
29
33 ExpressionCodeGenerationInformation & SetFunctionName(const std::string & cppCallingName_)
34 {
35 functionCallName = cppCallingName_;
36 return *this;
37 }
38
42 ExpressionCodeGenerationInformation & SetStatic()
43 {
44 staticFunction = true;
45 return *this;
46 }
47
51 ExpressionCodeGenerationInformation & SetIncludeFile(const std::string & optionalIncludeFile_)
52 {
53 optionalIncludeFile = optionalIncludeFile_;
54 return *this;
55 }
56
59 class CustomCodeGenerator
60 {
61 public:
62 virtual std::string GenerateCode(const std::vector<gd::Expression> & parameters, gd::EventsCodeGenerator & codeGenerator_, gd::EventsCodeGenerationContext & context) {return "";};
63 };
64
68 ExpressionCodeGenerationInformation & SetCustomCodeGenerator(boost::shared_ptr<CustomCodeGenerator> codeGenerator)
69 {
70 optionalCustomCodeGenerator = codeGenerator;
71 return *this;
72 }
73
74 bool staticFunction;
75 std::string functionCallName;
76 std::string optionalIncludeFile;
77 boost::shared_ptr<CustomCodeGenerator> optionalCustomCodeGenerator;
78 };
79
85 class GD_CORE_API ExpressionMetadata
86 {
87 public:
88
89 ExpressionMetadata(const std::string & extensionNamespace,
90 const std::string & name,
91 const std::string & fullname,
92 const std::string & description,
93 const std::string & group,
94 const std::string & smallicon);
95 virtual ~ExpressionMetadata() {};
96
100 ExpressionMetadata & SetHidden();
101
105 ExpressionMetadata & SetGroup(const std::string & str)
106 {
107 group = str;
108 return *this;
109 }
110
111 std::vector < gd::ParameterMetadata > parameters;
112
116 gd::ExpressionMetadata & AddParameter(const std::string & type, const std::string & description, const std::string & optionalObjectType = "", bool parameterIsOptional = false);
117
121 gd::ExpressionMetadata & AddCodeOnlyParameter(const std::string & type, const std::string & supplementaryInformation);
122
128 ExpressionMetadata & SetDefaultValue(std::string defaultValue_)
129 {
130 if ( !parameters.empty() ) parameters.back().defaultValue = defaultValue_;
131 return *this;
132 };
133
134 ExpressionCodeGenerationInformation codeExtraInformation;
135
138 ExpressionMetadata() : shown(false) {};
139
140 bool IsShown() const { return shown; }
141 const std::string & GetFullName() const { return fullname; }
142 const std::string & GetDescription() const { return description; }
143 const std::string & GetGroup() const { return group; }
144 #if !defined(GD_NO_WX_GUI)
145 const wxBitmap & GetBitmapIcon() const { return smallicon; }
146 #endif
147
148 private:
149 std::string fullname;
150 std::string description;
151 std::string group;
152 bool shown;
153 #if !defined(GD_NO_WX_GUI)
154 wxBitmap smallicon;
155 #endif
156 std::string extensionNamespace;
157 };
158
162 class GD_CORE_API StrExpressionMetadata
163 {
164 public:
165
166 StrExpressionMetadata(const std::string & extensionNamespace,
167 const std::string & name,
168 const std::string & fullname,
169 const std::string & description,
170 const std::string & group,
171 const std::string & smallicon);
172 virtual ~StrExpressionMetadata() {};
173
177 StrExpressionMetadata & SetHidden();
178
182 StrExpressionMetadata & SetGroup(const std::string & str)
183 {
184 group = str;
185 return *this;
186 }
187
188 std::vector < gd::ParameterMetadata > parameters;
189
193 gd::StrExpressionMetadata & AddParameter(const std::string & type, const std::string & description, const std::string & optionalObjectType = "", bool parameterIsOptional = false);
194
198 gd::StrExpressionMetadata & AddCodeOnlyParameter(const std::string & type, const std::string & supplementaryInformation);
199
205 StrExpressionMetadata & SetDefaultValue(std::string defaultValue_)
206 {
207 if ( !parameters.empty() ) parameters.back().defaultValue = defaultValue_;
208 return *this;
209 };
210
211 ExpressionCodeGenerationInformation codeExtraInformation;
212
215 StrExpressionMetadata() : shown(false) {};
216
217 bool IsShown() const { return shown; }
218 const std::string & GetFullName() const { return fullname; }
219 const std::string & GetDescription() const { return description; }
220 const std::string & GetGroup() const { return group; }
221 #if !defined(GD_NO_WX_GUI)
222 const wxBitmap & GetBitmapIcon() const { return smallicon; }
223 #endif
224
225 private:
226 std::string fullname;
227 std::string description;
228 std::string group;
229 bool shown;
230 #if !defined(GD_NO_WX_GUI)
231 wxBitmap smallicon;
232 #endif
233 std::string extensionNamespace;
234 };
235
236 }
237
238 #endif
239 #endif // EXPRESSIONMETADATA_H