GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Public Attributes | List of all members

Describe user-friendly information about an expression, its parameters and the function name as well as other information for code generation. More...

#include <ExpressionMetadata.h>

Inherits gd::AbstractFunctionMetadata.

Public Member Functions

 ExpressionMetadata (const gd::String &returnType, const gd::String &extensionNamespace, const gd::String &name, const gd::String &fullname, const gd::String &description, const gd::String &group, const gd::String &smallicon)
 
 ExpressionMetadata ()
 
ExpressionMetadataSetHidden () override
 Set the expression as not shown in the IDE.
 
ExpressionMetadataSetGroup (const gd::String &str)
 Set the group of the instruction in the IDE.
 
const gd::StringGetHelpPath () const
 
ExpressionMetadataSetHelpPath (const gd::String &path)
 
bool IsPrivate () const
 
ExpressionMetadataSetPrivate () override
 
bool IsRelevantForLayoutEvents () const
 
bool IsRelevantForFunctionEvents () const
 
bool IsRelevantForAsynchronousFunctionEvents () const
 
bool IsRelevantForCustomObjectEvents () const
 
ExpressionMetadataSetRelevantForLayoutEventsOnly () override
 
ExpressionMetadataSetRelevantForFunctionEventsOnly () override
 
ExpressionMetadataSetRelevantForAsynchronousFunctionEventsOnly () override
 
ExpressionMetadataSetRelevantForCustomObjectEventsOnly () override
 
gd::ExpressionMetadataAddParameter (const gd::String &type, const gd::String &label, const gd::String &supplementaryInformation="", bool parameterIsOptional=false) override
 
gd::ExpressionMetadataAddCodeOnlyParameter (const gd::String &type, const gd::String &supplementaryInformation) override
 
ExpressionMetadataSetDefaultValue (const gd::String &defaultValue) override
 
ExpressionMetadataSetParameterLongDescription (const gd::String &longDescription) override
 Set the long description shown in the editor for the last added parameter. More...
 
ExpressionMetadataSetParameterExtraInfo (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...
 
ExpressionMetadataSetRequiresBaseObjectCapability (const gd::String &capability)
 Mark this (object) expression 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 expression as it does not apply to them.
 
const gd::StringGetRequiredBaseObjectCapability () const
 Get the required specified capability for this (object) expression, or an empty string if there is nothing specific required.
 
bool IsShown () const
 
const gd::StringGetReturnType () const
 
const gd::StringGetFullName () const
 
const gd::StringGetDescription () const
 
const gd::StringGetGroup () const
 
const gd::StringGetSmallIconFilename () const
 
const gd::ParameterMetadataGetParameter (std::size_t id) const
 
gd::ParameterMetadataGetParameter (std::size_t id)
 
std::size_t GetParametersCount () const
 
const gd::ParameterMetadataContainerGetParameters () const
 
ExpressionMetadataSetFunctionName (const gd::String &functionName) override
 Set the function name which will be used when generating the code. More...
 
const gd::StringGetFunctionName ()
 Return the name of the function which will be called in the generated code.
 
ExpressionMetadataSetStatic ()
 Set that the function is static.
 
ExpressionMetadataSetIncludeFile (const gd::String &includeFile) override
 Erase any existing include file and add the specified include. More...
 
ExpressionMetadataAddIncludeFile (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.
 
ExpressionMetadataSetCustomCodeGenerator (std::function< gd::String(const std::vector< gd::Expression > &parameters, gd::EventsCodeGenerator &codeGenerator, gd::EventsCodeGenerationContext &context)> codeGenerator)
 Set that the function must be generated using a custom code generator.
 
ExpressionMetadataRemoveCustomCodeGenerator ()
 
bool HasCustomCodeGenerator () const
 
ExpressionMetadataGetCodeExtraInformation ()
 Return the structure containing the information about code generation for the expression. More...
 

Public Attributes

ExpressionCodeGenerationInformation codeExtraInformation
 

Detailed Description

Describe user-friendly information about an expression, its parameters and the function name as well as other information for code generation.

Constructor & Destructor Documentation

◆ ExpressionMetadata() [1/2]

gd::ExpressionMetadata::ExpressionMetadata ( const gd::String returnType,
const gd::String extensionNamespace,
const gd::String name,
const gd::String fullname,
const gd::String description,
const gd::String group,
const gd::String smallicon 
)

Construct a new expression metadata.

◆ ExpressionMetadata() [2/2]

gd::ExpressionMetadata::ExpressionMetadata ( )
inline

Construct an empty ExpressionMetadata.

Warning
Don't use this - only here to construct a "bad" ExpressionData and to fulfill std::map requirements.

Member Function Documentation

◆ AddCodeOnlyParameter()

gd::ExpressionMetadata & gd::ExpressionMetadata::AddCodeOnlyParameter ( const gd::String type,
const gd::String supplementaryInformation 
)
overridevirtual

◆ AddParameter()

gd::ExpressionMetadata & gd::ExpressionMetadata::AddParameter ( const gd::String type,
const gd::String label,
const gd::String supplementaryInformation = "",
bool  parameterIsOptional = false 
)
overridevirtual

◆ GetCodeExtraInformation()

ExpressionMetadata& gd::ExpressionMetadata::GetCodeExtraInformation ( )
inline

Return the structure containing the information about code generation for the expression.

Deprecated:

◆ GetHelpPath()

const gd::String& gd::ExpressionMetadata::GetHelpPath ( ) const
inline

Get the help path of the expression, relative to the GDevelop documentation root.

◆ IsPrivate()

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

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

◆ IsRelevantForAsynchronousFunctionEvents()

bool gd::ExpressionMetadata::IsRelevantForAsynchronousFunctionEvents ( ) const
inline

Check if the instruction can be used in asynchronous function events.

◆ IsRelevantForCustomObjectEvents()

bool gd::ExpressionMetadata::IsRelevantForCustomObjectEvents ( ) const
inline

Check if the instruction can be used in custom object events.

◆ IsRelevantForFunctionEvents()

bool gd::ExpressionMetadata::IsRelevantForFunctionEvents ( ) const
inline

Check if the instruction can be used in function events.

◆ IsRelevantForLayoutEvents()

bool gd::ExpressionMetadata::IsRelevantForLayoutEvents ( ) const
inline

Check if the instruction can be used in layouts or external events.

◆ SetDefaultValue()

ExpressionMetadata& gd::ExpressionMetadata::SetDefaultValue ( const gd::String defaultValue)
inlineoverridevirtual

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

See also
AddParameter

Implements gd::AbstractFunctionMetadata.

◆ SetFunctionName()

ExpressionMetadata& gd::ExpressionMetadata::SetFunctionName ( const gd::String functionName)
inlineoverridevirtual

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

Parameters
functionNamethe name of the function to call

Implements gd::AbstractFunctionMetadata.

◆ SetHelpPath()

ExpressionMetadata& gd::ExpressionMetadata::SetHelpPath ( const gd::String path)
inline

Set the help path of the expression, relative to the GDevelop documentation root.

◆ SetIncludeFile()

ExpressionMetadata& gd::ExpressionMetadata::SetIncludeFile ( const gd::String includeFile)
inlineoverridevirtual

Erase any existing include file and add the specified include.

Deprecated:
Use AddIncludeFile instead as clearing the list is more error prone.

Implements gd::AbstractFunctionMetadata.

◆ SetParameterExtraInfo()

ExpressionMetadata& gd::ExpressionMetadata::SetParameterExtraInfo ( const gd::String extraInfo)
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.

See also
AddParameter

Implements gd::AbstractFunctionMetadata.

◆ SetParameterLongDescription()

ExpressionMetadata& gd::ExpressionMetadata::SetParameterLongDescription ( const gd::String longDescription)
inlineoverridevirtual

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

See also
AddParameter

Implements gd::AbstractFunctionMetadata.

◆ SetPrivate()

ExpressionMetadata& gd::ExpressionMetadata::SetPrivate ( )
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.

◆ SetRelevantForAsynchronousFunctionEventsOnly()

ExpressionMetadata& gd::ExpressionMetadata::SetRelevantForAsynchronousFunctionEventsOnly ( )
inlineoverridevirtual

Set that the instruction can be used in asynchronous function events.

Implements gd::AbstractFunctionMetadata.

◆ SetRelevantForCustomObjectEventsOnly()

ExpressionMetadata& gd::ExpressionMetadata::SetRelevantForCustomObjectEventsOnly ( )
inlineoverridevirtual

Set that the instruction can be used in custom object events.

Implements gd::AbstractFunctionMetadata.

◆ SetRelevantForFunctionEventsOnly()

ExpressionMetadata& gd::ExpressionMetadata::SetRelevantForFunctionEventsOnly ( )
inlineoverridevirtual

Set that the instruction can be used in function events.

Implements gd::AbstractFunctionMetadata.

◆ SetRelevantForLayoutEventsOnly()

ExpressionMetadata& gd::ExpressionMetadata::SetRelevantForLayoutEventsOnly ( )
inlineoverridevirtual

Set that the instruction can be used in layouts or external events.

Implements gd::AbstractFunctionMetadata.


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