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

Define a type for parameters of a function (action, condition or expression) or the returned value of an expression. More...

#include <ValueTypeMetadata.h>

Public Member Functions

const gd::StringGetName () const
 Return the string representation of the type.
 
ValueTypeMetadataSetName (const gd::String &name_)
 Set the string representation of the type.
 
const gd::StringGetExtraInfo () const
 Return an optional additional information, used for some parameters with special type (for example, it can contains the type of object accepted by the parameter).
 
ValueTypeMetadataSetExtraInfo (const gd::String &supplementaryInformation_)
 Set an optional additional information, used for some parameters with special type (for example, it can contains the type of object accepted by the parameter).
 
bool IsOptional () const
 Return true if the parameter is optional.
 
ValueTypeMetadataSetOptional (bool optional_=true)
 Set if the parameter is optional.
 
const gd::StringGetDefaultValue () const
 Get the default value for the parameter.
 
ValueTypeMetadataSetDefaultValue (const gd::String &defaultValue_)
 Set the default value, if the parameter is optional.
 
bool IsDefined () const
 Return true if the type is defined.
 
bool IsObject () const
 Return true if the type is representing one object (or more, i.e: an object group).
 
bool IsBehavior () const
 Return true if the type is "behavior".
 
bool IsNumber () const
 Return true if the type is an expression of the given type.
 
bool IsString () const
 Return true if the type is a string.
 
bool IsBoolean () const
 Return true if the type is a boolean.
 
bool IsVariable () const
 Return true if the type of the parameter is a number. More...
 
bool IsLegacyPreScopedVariable () const
 Return true if the type is a variable but from a specific scope (scene, project or object). In new code, prefer to use the more generic "variable" parameter (which accepts any variable coming from an object or from containers in the scope).
 
Serialization
void SerializeTo (gd::SerializerElement &element) const
 Serialize the ParameterMetadata to the specified element.
 
void UnserializeFrom (const gd::SerializerElement &element)
 Load the ParameterMetadata from the specified element.
 

Static Public Member Functions

static bool IsTypeLegacyPreScopedVariable (const gd::String &type)
 Return true if the type is a variable but from a specific scope (scene, project or object). In new code, prefer to use the more generic "variable" parameter (which accepts any variable coming from an object or from containers in the scope).
 
static bool IsTypeObject (const gd::String &parameterType)
 Return true if the type is representing one object (or more, i.e: an object group).
 
static bool IsTypeBehavior (const gd::String &parameterType)
 Return true if the type is "behavior".
 
static bool IsTypeExpression (const gd::String &type, const gd::String &parameterType)
 Return true if the type is an expression of the given type. More...
 
static const gd::StringGetExpressionPrimitiveValueType (const gd::String &parameterType)
 Return the expression type from the parameter type. Declinations of "number" and "string" types (like "forceMultiplier" or "sceneName") are replaced by "number" and "string". More...
 
static const gd::StringGetPrimitiveValueType (const gd::String &parameterType)
 Return the primitive type from the parameter type. Declinations of "number" and "string" types (like "forceMultiplier" or "sceneName") are replaced by "number" and "string". More...
 
static const gd::StringConvertPropertyTypeToValueType (const gd::String &propertyType)
 Return the ValueTypeMetadata name for a property type. More...
 

Static Public Attributes

static const gd::String numberType = "number"
 
static const gd::String stringType = "string"
 
static const gd::String variableType = "variable"
 
static const gd::String booleanType = "boolean"
 

Detailed Description

Define a type for parameters of a function (action, condition or expression) or the returned value of an expression.

See also
gd::EventsFunction

Member Function Documentation

◆ ConvertPropertyTypeToValueType()

const gd::String & gd::ValueTypeMetadata::ConvertPropertyTypeToValueType ( const gd::String propertyType)
static

Return the ValueTypeMetadata name for a property type.

See also
gd::PropertyDescriptor

◆ GetExpressionPrimitiveValueType()

const gd::String & gd::ValueTypeMetadata::GetExpressionPrimitiveValueType ( const gd::String parameterType)
static

Return the expression type from the parameter type. Declinations of "number" and "string" types (like "forceMultiplier" or "sceneName") are replaced by "number" and "string".

Note
It only maps string and number types.

◆ GetPrimitiveValueType()

const gd::String & gd::ValueTypeMetadata::GetPrimitiveValueType ( const gd::String parameterType)
static

Return the primitive type from the parameter type. Declinations of "number" and "string" types (like "forceMultiplier" or "sceneName") are replaced by "number" and "string".

Note
It also maps variable and boolean types.

◆ IsTypeExpression()

static bool gd::ValueTypeMetadata::IsTypeExpression ( const gd::String type,
const gd::String parameterType 
)
inlinestatic

Return true if the type is an expression of the given type.

Note
If you are adding a new type of parameter, also add it in the IDE ( see EventsFunctionParametersEditor, ParameterRenderingService and ExpressionAutocompletion) and in the EventsCodeGenerator.

◆ IsVariable()

bool gd::ValueTypeMetadata::IsVariable ( ) const
inline

Return true if the type of the parameter is a number.

Note
If you had a new type of parameter, also add it in the IDE ( see EventsFunctionParametersEditor, ParameterRenderingService and ExpressionAutocompletion) and in the EventsCodeGenerator.

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