GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Classes | Public Member Functions | Public Attributes | List of all members

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>

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::StringGetFullName () const
 
const gd::StringGetDescription () const
 
const gd::StringGetSentence () const
 
const gd::StringGetGroup () const
 
ParameterMetadataGetParameter (size_t i)
 
const ParameterMetadataGetParameter (size_t i) const
 
size_t GetParametersCount () const
 
const std::vector
< ParameterMetadata > & 
GetParameters () const
 
const gd::StringGetIconFilename () const
 
const gd::StringGetSmallIconFilename () const
 
bool CanHaveSubInstructions () const
 
const gd::StringGetHelpPath () const
 
InstructionMetadataSetHelpPath (const gd::String &path)
 
bool IsPrivate () const
 
InstructionMetadataSetPrivate ()
 
InstructionMetadataSetCanHaveSubInstructions ()
 
InstructionMetadataSetHidden ()
 Set the instruction to be hidden in the IDE. More...
 
InstructionMetadataSetGroup (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.
 
InstructionMetadataAddParameter (const gd::String &type, const gd::String &label, const gd::String &optionalObjectType="", bool parameterIsOptional=false)
 Add a parameter to the instruction metadata. More...
 
InstructionMetadataAddCodeOnlyParameter (const gd::String &type, const gd::String &supplementaryInformation)
 Add a parameter not displayed in editor. More...
 
InstructionMetadataSetDefaultValue (const gd::String &defaultValue_)
 Set the default value used in editor (or if an optional parameter is empty during code generation) for the last added parameter. More...
 
InstructionMetadataSetParameterLongDescription (const gd::String &longDescription)
 Set the long description shown in the editor for the last added parameter. More...
 
InstructionMetadataUseStandardOperatorParameters (const gd::String &type)
 Add the default parameters for an instruction manipulating the specified type ("string", "number") with the default operators.
 
InstructionMetadataUseStandardRelationalOperatorParameters (const gd::String &type)
 Add the default parameters for an instruction comparing the specified type ("string", "number") with the default relational operators.
 
InstructionMetadataSetIsObjectInstruction ()
 Mark the instruction as an object instruction. Automatically called when using AddAction/AddCondition on an ObjectMetadata.
 
InstructionMetadataSetIsBehaviorInstruction ()
 Mark the instruction as a behavior instruction. Automatically called when using AddAction/AddCondition on a BehaviorMetadata.
 
InstructionMetadataMarkAsSimple ()
 Consider that the instruction is easy for an user to understand.
 
InstructionMetadataMarkAsAdvanced ()
 Consider that the instruction is harder for an user to understand than a normal instruction.
 
InstructionMetadataMarkAsComplex ()
 Consider that the instruction is complex for an 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).
 
ExtraInformationGetCodeExtraInformation ()
 Return the structure containing the information about code generation for the instruction.
 
ExtraInformationSetManipulatedType (const gd::String &type_)
 Declare if the instruction being declared is somewhat manipulating in a standard way. More...
 
ExtraInformationSetFunctionName (const gd::String &functionName)
 Set the function that should be called when generating the source code from events. More...
 

Public Attributes

ExtraInformation codeExtraInformation
 
std::vector< ParameterMetadataparameters
 

Detailed Description

Describe user-friendly information about an instruction (action or condition), its parameters and the function name as well as other information for code generation.

Constructor & Destructor Documentation

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.

Warning
Don't use this - only here to fullfil std::map requirements.

Member Function Documentation

InstructionMetadata & gd::InstructionMetadata::AddCodeOnlyParameter ( const gd::String type,
const gd::String supplementaryInformation 
)

Add a parameter not displayed in editor.

Parameters
typeOne of the type handled by GDevelop. This will also determine the type of the argument used when calling the function in the generated code.
supplementaryInformationDepends on type. For example, when type == "inlineCode", the content of supplementaryInformation is inserted in the generated code.
See also
EventsCodeGenerator::GenerateParametersCodes
InstructionMetadata & gd::InstructionMetadata::AddParameter ( const gd::String type,
const gd::String label,
const gd::String optionalObjectType = "",
bool  parameterIsOptional = false 
)

Add a parameter to the instruction metadata.

Parameters
typeOne of the type handled by GDevelop. This will also determine the type of the argument used when calling the function in the generated code.
descriptionDescription for parameter
optionalObjectTypeIf type is "object", this parameter will describe which objects are allowed. If it is empty, all objects are allowed.
parameterIsOptionaltrue if the parameter must be optional, false otherwise.
See also
EventsCodeGenerator::GenerateParametersCodes
const gd::String& gd::InstructionMetadata::GetHelpPath ( ) const
inline

Get the help path of the instruction, relative to the documentation root.

bool gd::InstructionMetadata::IsPrivate ( ) const
inline

Check if the instruction is private - it can't be used outside of the object/ behavior that it is attached too.

InstructionMetadata& gd::InstructionMetadata::SetCanHaveSubInstructions ( )
inline

Notify that the instruction can have sub instructions.

InstructionMetadata& gd::InstructionMetadata::SetDefaultValue ( const gd::String defaultValue_)
inline

Set the default value used in editor (or if an optional parameter is empty during code generation) for the last added parameter.

See also
AddParameter
ExtraInformation& gd::InstructionMetadata::SetFunctionName ( const gd::String functionName)
inline

Set the function that should be called when generating the source code from events.

Parameters
functionNamethe name of the function to call
Note
Shortcut for codeExtraInformation.SetFunctionName.
InstructionMetadata& gd::InstructionMetadata::SetHelpPath ( const gd::String path)
inline

Set the help path of the instruction, relative to the documentation root.

InstructionMetadata& gd::InstructionMetadata::SetHidden ( )
inline

Set the instruction to be hidden in the IDE.

Used mainly when an instruction is deprecated.

ExtraInformation& gd::InstructionMetadata::SetManipulatedType ( const gd::String type_)
inline

Declare if the instruction being declared is somewhat manipulating in a standard way.

Parameters
type"number" or "string"
Note
Shortcut for codeExtraInformation.SetManipulatedType(type).
InstructionMetadata& gd::InstructionMetadata::SetParameterLongDescription ( const gd::String longDescription)
inline

Set the long description shown in the editor for the last added parameter.

See also
AddParameter
InstructionMetadata& gd::InstructionMetadata::SetPrivate ( )
inline

Set that the instruction is private - it can't be used outside of the object/ behavior that it is attached too.

Member Data Documentation

ExtraInformation gd::InstructionMetadata::codeExtraInformation

Information about how generate code for the instruction


The documentation for this class was generated from the following files: