8 #include "AbstractFunctionMetadata.h"
13 #include "GDCore/Events/Instruction.h"
14 #include "GDCore/Extensions/Metadata/InstructionMetadata.h"
15 #include "GDCore/String.h"
27 : staticFunction(
false), hasCustomCodeGenerator(
false){};
33 bool hasCustomCodeGenerator;
34 std::function<
gd::String(
const std::vector<gd::Expression>& parameters,
38 std::vector<gd::String> includeFiles;
66 : returnType(
"unknown"), shown(false), isPrivate(false), relevantContext(
"Any"){};
73 ExpressionMetadata& SetHidden()
override;
117 return relevantContext ==
"Any" || relevantContext ==
"Layout";
124 return relevantContext ==
"Any" || relevantContext ==
"Function";
131 return relevantContext ==
"Any" || relevantContext ==
"Function" ||
132 relevantContext ==
"AsynchronousFunction";
139 return relevantContext ==
"Any" || relevantContext ==
"Object";
146 relevantContext =
"Layout";
154 relevantContext =
"Function";
162 relevantContext =
"AsynchronousFunction";
170 relevantContext =
"Object";
179 const gd::String &supplementaryInformation =
"",
180 bool parameterIsOptional =
false)
override;
187 const gd::String &supplementaryInformation)
override;
196 if (parameters.GetParametersCount() > 0) {
210 if (parameters.GetParametersCount() > 0) {
211 parameters.GetInternalVector().back()->SetLongDescription(longDescription);
225 if (parameters.GetParametersCount() > 0) {
226 parameters.GetInternalVector().back()->SetExtraInfo(extraInfo);
245 return requiredBaseObjectCapability;
248 bool IsShown()
const {
return shown; }
249 const gd::String& GetReturnType()
const {
return returnType; }
250 const gd::String& GetFullName()
const {
return fullname; }
251 const gd::String& GetDescription()
const {
return description; }
252 const gd::String& GetGroup()
const {
return group; }
253 const gd::String& GetSmallIconFilename()
const {
return smallIconFilename; }
255 return parameters.GetParameter(
id);
258 return parameters.GetParameter(
id);
260 std::size_t GetParametersCount()
const {
return parameters.GetParametersCount(); };
271 codeExtraInformation.functionCallName = functionName;
280 return codeExtraInformation.functionCallName;
286 codeExtraInformation.staticFunction =
true;
297 codeExtraInformation.includeFiles.clear();
298 codeExtraInformation.includeFiles.push_back(includeFile);
307 if (std::find(codeExtraInformation.includeFiles.begin(), codeExtraInformation.includeFiles.end(), includeFile) ==
308 codeExtraInformation.includeFiles.end())
309 codeExtraInformation.includeFiles.push_back(includeFile);
318 return codeExtraInformation.includeFiles;
326 std::function<
gd::String(
const std::vector<gd::Expression>& parameters,
330 codeExtraInformation.hasCustomCodeGenerator =
true;
331 codeExtraInformation.customCodeGenerator = codeGenerator;
336 codeExtraInformation.hasCustomCodeGenerator =
false;
337 std::function<
gd::String(
const std::vector<gd::Expression>& parameters,
341 codeExtraInformation.customCodeGenerator = emptyFunction;
345 bool HasCustomCodeGenerator()
const {
return codeExtraInformation.hasCustomCodeGenerator; }
Used to manage the context when generating code for events.
Definition: EventsCodeGenerationContext.h:27
Internal class used to generate code from events.
Definition: EventsCodeGenerator.h:41
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24