9 #include "AbstractFunctionMetadata.h"
16 #include "GDCore/Events/Instruction.h"
17 #include "GDCore/Project/ParameterMetadataContainer.h"
18 #include "GDCore/String.h"
19 #include "ParameterMetadata.h"
20 #include "ParameterOptions.h"
25 class EventsCodeGenerator;
26 class EventsCodeGenerationContext;
27 class SerializerElement;
61 const gd::String &GetFullName()
const {
return fullname; }
62 const gd::String &GetDescription()
const {
return description; }
63 const gd::String &GetSentence()
const {
return sentence; }
64 const gd::String &GetGroup()
const {
return group; }
67 return parameters.GetParameter(i);
69 size_t GetParametersCount()
const {
return parameters.GetParametersCount(); }
73 const gd::String &GetIconFilename()
const {
return iconFilename; }
74 const gd::String &GetSmallIconFilename()
const {
return smallIconFilename; }
75 bool CanHaveSubInstructions()
const {
return canHaveSubInstructions; }
111 return relevantContext ==
"Any" || relevantContext ==
"Layout";
118 return relevantContext ==
"Any" || relevantContext ==
"Function";
125 return relevantContext ==
"Any" || relevantContext ==
"Function" ||
126 relevantContext ==
"AsynchronousFunction";
133 return relevantContext ==
"Any" || relevantContext ==
"Object";
140 relevantContext =
"Layout";
148 relevantContext =
"Function";
156 relevantContext =
"AsynchronousFunction";
164 relevantContext =
"Object";
174 return !codeExtraInformation.asyncFunctionCallName.empty();
182 return IsAsync() && !codeExtraInformation.functionCallName.empty();
189 canHaveSubInstructions =
true;
236 const gd::String &supplementaryInformation =
"",
237 bool parameterIsOptional =
false)
override;
260 if (parameters.GetParametersCount() > 0) {
274 if (parameters.GetParametersCount() > 0) {
275 parameters.GetInternalVector().back()->SetLongDescription(longDescription);
288 if (parameters.GetParametersCount() > 0) {
289 parameters.GetInternalVector().back()->SetExtraInfo(extraInfo);
319 isObjectInstruction =
true;
328 isBehaviorInstruction =
true;
356 return requiredBaseObjectCapability;
395 enum AccessType { Reference, MutatorAndOrAccessor, Mutators };
396 ExtraInformation() : accessType(Reference), hasCustomCodeGenerator(
false){};
403 AccessType accessType;
405 std::map<gd::String, gd::String> optionalMutators;
406 bool hasCustomCodeGenerator;
411 std::vector<gd::String> includeFiles;
421 codeExtraInformation.functionCallName = functionName_;
434 codeExtraInformation.asyncFunctionCallName = functionName_;
442 return codeExtraInformation.functionCallName;
451 return codeExtraInformation.asyncFunctionCallName;
461 codeExtraInformation.type = type_;
471 return codeExtraInformation.type;
498 codeExtraInformation.optionalAssociatedInstruction = getter;
499 codeExtraInformation.accessType = codeExtraInformation.MutatorAndOrAccessor;
504 const std::map<gd::String, gd::String> &mutators) {
505 codeExtraInformation.optionalMutators = mutators;
506 codeExtraInformation.accessType = codeExtraInformation.Mutators;
516 codeExtraInformation.includeFiles.clear();
517 codeExtraInformation.includeFiles.push_back(includeFile);
525 if (std::find(codeExtraInformation.includeFiles.begin(), codeExtraInformation.includeFiles.end(), includeFile) ==
526 codeExtraInformation.includeFiles.end())
527 codeExtraInformation.includeFiles.push_back(includeFile);
536 return codeExtraInformation.includeFiles;
544 codeExtraInformation.hasCustomCodeGenerator =
true;
545 codeExtraInformation.customCodeGenerator = codeGenerator;
549 InstructionMetadata &RemoveCustomCodeGenerator() {
550 codeExtraInformation.hasCustomCodeGenerator =
false;
551 std::function<
gd::String(Instruction & instruction,
555 codeExtraInformation.customCodeGenerator = emptyFunction;
559 bool HasCustomCodeGenerator()
const {
return codeExtraInformation.hasCustomCodeGenerator; }
579 bool canHaveSubInstructions;
585 bool isObjectInstruction;
586 bool isBehaviorInstruction;
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
An instruction is a member of an event: It can be a condition or an action.
Definition: Instruction.h:30
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24
Definition: ParameterOptions.h:15