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

Defines information about how generate the code for an instruction. More...

#include <InstructionMetadata.h>

Public Types

enum  AccessType { Reference, MutatorAndOrAccessor, Mutators }
 

Public Member Functions

ExtraInformationSetFunctionName (const gd::String &functionName_)
 
ExtraInformationSetManipulatedType (const gd::String &type_)
 
ExtraInformationSetGetter (const gd::String &getter)
 
ExtraInformationSetMutators (const std::map< gd::String, gd::String > &mutators)
 
ExtraInformationSetIncludeFile (const gd::String &includeFile)
 Erase any existing include file and add the specified include.
 
ExtraInformationAddIncludeFile (const gd::String &includeFile)
 Add a file to the already existing include files.
 
const std::vector< gd::String > & GetIncludeFiles () const
 Get the files that must be included to use the instruction.
 
ExtraInformationSetCustomCodeGenerator (std::function< gd::String(Instruction &instruction, gd::EventsCodeGenerator &codeGenerator, gd::EventsCodeGenerationContext &context)> codeGenerator)
 
ExtraInformationRemoveCustomCodeGenerator ()
 
bool HasCustomCodeGenerator () const
 

Public Attributes

gd::String functionCallName
 
gd::String type
 
AccessType accessType
 
gd::String optionalAssociatedInstruction
 
std::map< gd::String, gd::StringoptionalMutators
 
bool hasCustomCodeGenerator
 
std::function< gd::String(Instruction
&instruction,
gd::EventsCodeGenerator
&codeGenerator,
gd::EventsCodeGenerationContext
&context)> 
customCodeGenerator
 

Detailed Description

Defines information about how generate the code for an instruction.

Member Function Documentation

ExtraInformation& gd::InstructionMetadata::ExtraInformation::SetFunctionName ( const gd::String functionName_)
inline

Set the function name which will be used when generating the code.

Parameters
functionNamethe name of the function to call
ExtraInformation& gd::InstructionMetadata::ExtraInformation::SetGetter ( const gd::String getter)
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:

obj.AddAction("String",
_("Change the string"),
_("Change the string of a text"),
_("the string"),
_("Text"),
"CppPlatform/Extensions/text24.png",
"CppPlatform/Extensions/text.png");
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("operator", _("Modification operator"))
.AddParameter("string", _("String"))
.SetFunctionName("SetString").SetManipulatedType("string").SetGetter("GetString").SetIncludeFile("MyExtension/TextObject.h");
DECLARE_END_OBJECT_ACTION()
ExtraInformation& gd::InstructionMetadata::ExtraInformation::SetManipulatedType ( const gd::String type_)
inline

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


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