GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Describe user-friendly information about an instruction (action or condition), its parameters and the function name as well as other information for code generation. More...
#include <InstructionMetadata.h>
Inherits gd::AbstractFunctionMetadata.
Classes | |
class | ExtraInformation |
Defines information about how generate the code for an instruction. More... | |
Public Member Functions | |
InstructionMetadata (const gd::String &extensionNamespace, const gd::String &name, const gd::String &fullname, const gd::String &description, const gd::String &sentence, const gd::String &group, const gd::String &icon, const gd::String &smallIcon) | |
InstructionMetadata () | |
const gd::String & | GetFullName () const |
const gd::String & | GetDescription () const |
const gd::String & | GetSentence () const |
const gd::String & | GetGroup () const |
ParameterMetadata & | GetParameter (size_t i) |
const ParameterMetadata & | GetParameter (size_t i) const |
size_t | GetParametersCount () const |
const ParameterMetadataContainer & | GetParameters () const |
const gd::String & | GetIconFilename () const |
const gd::String & | GetSmallIconFilename () const |
bool | CanHaveSubInstructions () const |
const gd::String & | GetHelpPath () const |
InstructionMetadata & | SetHelpPath (const gd::String &path) |
bool | IsPrivate () const |
InstructionMetadata & | SetPrivate () override |
bool | IsRelevantForLayoutEvents () const |
bool | IsRelevantForFunctionEvents () const |
bool | IsRelevantForAsynchronousFunctionEvents () const |
bool | IsRelevantForCustomObjectEvents () const |
InstructionMetadata & | SetRelevantForLayoutEventsOnly () override |
InstructionMetadata & | SetRelevantForFunctionEventsOnly () override |
InstructionMetadata & | SetRelevantForAsynchronousFunctionEventsOnly () override |
InstructionMetadata & | SetRelevantForCustomObjectEventsOnly () override |
bool | IsAsync () const |
bool | IsOptionallyAsync () const |
InstructionMetadata & | SetCanHaveSubInstructions () |
InstructionMetadata & | SetHidden () override |
Set the instruction to be hidden in the IDE. More... | |
InstructionMetadata & | SetGroup (const gd::String &str) |
Set the group of the instruction in the IDE. | |
bool | IsHidden () const |
Return true if the instruction must be hidden in the IDE. | |
InstructionMetadata & | AddParameter (const gd::String &type, const gd::String &label, const gd::String &supplementaryInformation="", bool parameterIsOptional=false) override |
Add a parameter to the instruction metadata. More... | |
InstructionMetadata & | AddCodeOnlyParameter (const gd::String &type, const gd::String &supplementaryInformation) override |
Add a parameter not displayed in editor. More... | |
InstructionMetadata & | SetDefaultValue (const gd::String &defaultValue_) override |
Set the default value used in editor (or if an optional parameter is empty during code generation) for the last added parameter. More... | |
InstructionMetadata & | SetParameterLongDescription (const gd::String &longDescription) override |
Set the long description shown in the editor for the last added parameter. More... | |
InstructionMetadata & | SetParameterExtraInfo (const gd::String &extraInfo) override |
Set the additional information, used for some parameters with special type (for example, it can contains the type of object accepted by the parameter), for the last added parameter. More... | |
InstructionMetadata & | UseStandardOperatorParameters (const gd::String &type, const ParameterOptions &options) |
Add the default parameters for an instruction manipulating the specified type ("string", "number") with the default operators. More... | |
InstructionMetadata & | UseStandardRelationalOperatorParameters (const gd::String &type, const ParameterOptions &options) |
Add the default parameters for an instruction comparing the specified type ("string", "number") with the default relational operators. More... | |
InstructionMetadata & | SetIsObjectInstruction () |
Mark the instruction as an object instruction. Automatically called when using AddAction /AddCondition on an ObjectMetadata . | |
InstructionMetadata & | SetIsBehaviorInstruction () |
Mark the instruction as a behavior instruction. Automatically called when using AddAction /AddCondition on a BehaviorMetadata . | |
bool | IsObjectInstruction () const |
Check if the instruction is an object instruction. | |
bool | IsBehaviorInstruction () const |
Check if the instruction is a behavior instruction. | |
InstructionMetadata & | SetRequiresBaseObjectCapability (const gd::String &capability) |
Mark this (object) instruction as requiring the specified capability, offered by the base object. This is useful for some objects that don't support this capability, so that the editor can hide the instruction as it does not apply to them. | |
const gd::String & | GetRequiredBaseObjectCapability () const |
Get the required specified capability for this (object) instruction, or an empty string if there is nothing specific required. | |
InstructionMetadata & | MarkAsSimple () |
Consider that the instruction is easy for a user to understand. | |
InstructionMetadata & | MarkAsAdvanced () |
Consider that the instruction is harder for a user to understand than a normal instruction. | |
InstructionMetadata & | MarkAsComplex () |
Consider that the instruction is complex for a user to understand. | |
int | GetUsageComplexity () const |
Return the usage complexity of this instruction for the user, from 0 (simple&easy to use) to 10 (complex to understand). | |
InstructionMetadata & | SetFunctionName (const gd::String &functionName_) override |
InstructionMetadata & | SetAsyncFunctionName (const gd::String &functionName_) |
const gd::String & | GetFunctionName () |
const gd::String & | GetAsyncFunctionName () |
InstructionMetadata & | SetManipulatedType (const gd::String &type_) |
Declare if the instruction being declared is somewhat manipulating in a standard way. More... | |
const gd::String & | GetManipulatedType () const |
Return the type manipulated in a standard way by the instruction. More... | |
InstructionMetadata & | SetGetter (const gd::String &getter) |
InstructionMetadata & | SetMutators (const std::map< gd::String, gd::String > &mutators) |
InstructionMetadata & | SetIncludeFile (const gd::String &includeFile) override |
Erase any existing include file and add the specified include. More... | |
InstructionMetadata & | AddIncludeFile (const gd::String &includeFile) override |
Add a file to the already existing include files. | |
const std::vector< gd::String > & | GetIncludeFiles () const override |
Get the files that must be included to use the instruction. | |
InstructionMetadata & | SetCustomCodeGenerator (std::function< gd::String(Instruction &instruction, gd::EventsCodeGenerator &codeGenerator, gd::EventsCodeGenerationContext &context)> codeGenerator) |
InstructionMetadata & | RemoveCustomCodeGenerator () |
bool | HasCustomCodeGenerator () const |
InstructionMetadata & | GetCodeExtraInformation () |
Return the structure containing the information about code generation for the instruction. More... | |
Public Attributes | |
ExtraInformation | codeExtraInformation |
ParameterMetadataContainer | parameters |
Describe user-friendly information about an instruction (action or condition), its parameters and the function name as well as other information for code generation.
gd::InstructionMetadata::InstructionMetadata | ( | const gd::String & | extensionNamespace, |
const gd::String & | name, | ||
const gd::String & | fullname, | ||
const gd::String & | description, | ||
const gd::String & | sentence, | ||
const gd::String & | group, | ||
const gd::String & | icon, | ||
const gd::String & | smallIcon | ||
) |
Construct a new instruction metadata.
gd::InstructionMetadata::InstructionMetadata | ( | ) |
Construct an empty InstructionMetadata.
|
overridevirtual |
Add a parameter not displayed in editor.
type | One of the type handled by GDevelop. This will also determine the type of the argument used when calling the function in the generated code. |
supplementaryInformation | Depends on type . For example, when type == "inlineCode" , the content of supplementaryInformation is inserted in the generated code. |
Implements gd::AbstractFunctionMetadata.
|
overridevirtual |
Add a parameter to the instruction metadata.
type | One of the type handled by GDevelop. This will also determine the type of the argument used when calling the function in the generated code. |
description | Description for parameter |
supplementaryInformation | Additional information that can be used for rendering or logic. For example:
|
parameterIsOptional | true if the parameter must be optional, false otherwise. |
Implements gd::AbstractFunctionMetadata.
|
inline |
Return the name of the function, doing asynchronous work, which will be called in the generated code. This function should return an asynchronous task (i.e: gdjs.AsyncTask
in the JavaScript runtime).
|
inline |
Return the structure containing the information about code generation for the instruction.
|
inline |
Return the name of the function which will be called in the generated code.
|
inline |
Get the help path of the instruction, relative to the GDevelop documentation root.
|
inline |
Return the type manipulated in a standard way by the instruction.
type | "number" or "string" |
|
inline |
Check if the instruction is asynchronous - it will be running in the background, executing the instructions following it before the frame after it resolved.
|
inline |
Check if the instruction asynchronicity is optional. If it is, it can either be used synchronously or asynchronously, with one function for each.
|
inline |
Check if the instruction is private - it can't be used outside of the object/ behavior that it is attached too.
|
inline |
Check if the instruction can be used in asynchronous function events.
|
inline |
Check if the instruction can be used in custom object events.
|
inline |
Check if the instruction can be used in function events.
|
inline |
Check if the instruction can be used in layouts or external events.
|
inline |
Set the name of the function, doing asynchronous work, which will be called in the generated code. This function should return an asynchronous task (i.e: gdjs.AsyncTask
in the JavaScript runtime).
functionName | the name of the function doing asynchronous work to call. |
|
inline |
Notify that the instruction can have sub instructions.
|
inlineoverridevirtual |
Set the default value used in editor (or if an optional parameter is empty during code generation) for the last added parameter.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set the name of the function which will be called in the generated code.
functionName | the name of the function to call. |
Implements gd::AbstractFunctionMetadata.
|
inline |
If InstructionMetadata::ExtraInformation::SetManipulatedType was called with "number" or "string", this function will tell the code generator the name of the getter function used to retrieve the data value.
Usage example:
|
inline |
Set the help path of the instruction, relative to the GDevelop documentation root.
|
inlineoverridevirtual |
Set the instruction to be hidden in the IDE.
Used mainly when an instruction is deprecated.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Erase any existing include file and add the specified include.
AddIncludeFile
instead as clearing the list is more error prone. Implements gd::AbstractFunctionMetadata.
|
inline |
Declare if the instruction being declared is somewhat manipulating in a standard way.
type | "number" or "string" |
|
inlineoverridevirtual |
Set the additional information, used for some parameters with special type (for example, it can contains the type of object accepted by the parameter), for the last added parameter.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set the long description shown in the editor for the last added parameter.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set that the instruction is private - it can't be used outside of the object/ behavior that it is attached too.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set that the instruction can be used in asynchronous function events.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set that the instruction can be used in custom object events.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set that the instruction can be used in function events.
Implements gd::AbstractFunctionMetadata.
|
inlineoverridevirtual |
Set that the instruction can be used in layouts or external events.
Implements gd::AbstractFunctionMetadata.
InstructionMetadata & gd::InstructionMetadata::UseStandardOperatorParameters | ( | const gd::String & | type, |
const ParameterOptions & | options | ||
) |
Add the default parameters for an instruction manipulating the specified type ("string", "number") with the default operators.
InstructionMetadata & gd::InstructionMetadata::UseStandardRelationalOperatorParameters | ( | const gd::String & | type, |
const ParameterOptions & | options | ||
) |
Add the default parameters for an instruction comparing the specified type ("string", "number") with the default relational operators.
ExtraInformation gd::InstructionMetadata::codeExtraInformation |
Information about how generate code for the instruction