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 Member Functions | List of all members

An instruction is a member of an event: It can be a condition or an action. More...

#include <Instruction.h>

Public Member Functions

 Instruction (gd::String type_="")
 Default constructor. More...
 
 Instruction (gd::String type_, const std::vector< gd::Expression > &parameters_, bool inverted=false)
 Constructor. More...
 
const gd::StringGetType () const
 Return the type of the instruction. More...
 
void SetType (const gd::String &newType)
 Change the instruction type. More...
 
bool IsInverted () const
 Return true if the condition is inverted. More...
 
void SetInverted (bool inverted_)
 Set if the instruction is inverted or not. More...
 
std::size_t GetParametersCount () const
 Return the number of parameters of the instruction.
 
void SetParametersCount (std::size_t size)
 Change the number of parameter of the instruction. More...
 
const gd::ExpressionGetParameter (std::size_t index) const
 Get the value of a parameter. More...
 
gd::ExpressionGetParameter (std::size_t index)
 Get the value of a parameter. More...
 
void SetParameter (std::size_t nb, const gd::Expression &val)
 
const std::vector
< gd::Expression > & 
GetParameters () const
 Get a reference to the std::vector containing the parameters. More...
 
void SetParameters (const std::vector< gd::Expression > &val)
 Replace all the parameters by new ones. More...
 
const gd::InstructionsListGetSubInstructions () const
 Return a reference to the vector containing sub instructions.
 
gd::InstructionsListGetSubInstructions ()
 Return a reference to the vector containing sub instructions.
 

Detailed Description

An instruction is a member of an event: It can be a condition or an action.

An instruction has a type, which define what it does, and some parameters. It can also be set as inverted (when the instruction is a condition) and it can have sub instructions. This class does nothing particular except storing these data.

See also
gd::BaseEvent

Constructor & Destructor Documentation

gd::Instruction::Instruction ( gd::String  type_ = "")

Default constructor.

Parameters
typeThe type of the instruction
gd::Instruction::Instruction ( gd::String  type_,
const std::vector< gd::Expression > &  parameters_,
bool  inverted = false 
)

Constructor.

Parameters
typeThe type of the instruction
parametersA vector containing the parameters of the instruction
invertedtrue to set the instruction as inverted (used for condition instructions).

Member Function Documentation

const gd::Expression & gd::Instruction::GetParameter ( std::size_t  index) const

Get the value of a parameter.

Return an empty expression if the parameter requested does not exists.

Returns
The current value of the parameter.
gd::Expression & gd::Instruction::GetParameter ( std::size_t  index)

Get the value of a parameter.

Return an empty expression if the parameter requested does not exists.

Returns
The current value of the parameter.
const std::vector<gd::Expression>& gd::Instruction::GetParameters ( ) const
inline

Get a reference to the std::vector containing the parameters.

Returns
A std::vector containing the parameters
const gd::String& gd::Instruction::GetType ( ) const
inline

Return the type of the instruction.

Returns
The type of the instruction
bool gd::Instruction::IsInverted ( ) const
inline

Return true if the condition is inverted.

Returns
true if the condition is inverted
void gd::Instruction::SetInverted ( bool  inverted_)
inline

Set if the instruction is inverted or not.

Parameters
invertedtrue if the condition must be set as inverted
void gd::Instruction::SetParameter ( std::size_t  nb,
const gd::Expression val 
)

Change the specified parameter

Parameters
nbThe parameter number
valThe new value of the parameter
void gd::Instruction::SetParameters ( const std::vector< gd::Expression > &  val)
inline

Replace all the parameters by new ones.

Parameters
valA vector containing the new parameters.
void gd::Instruction::SetParametersCount ( std::size_t  size)

Change the number of parameter of the instruction.

If the new size if larger than the previous, new blank parameters are added.

void gd::Instruction::SetType ( const gd::String newType)
inline

Change the instruction type.

Parameters
valThe new type of the instruction

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