class Variable
Defined in:
The C4Variables.h
Variable
class stores a system variable.
Definition
class Variable : public MapElement<Variable>, public Observable<Variable>
Member Functions
Variable::GetVariableName |
Returns the variable name. |
Variable::GetVariableFlags |
Returns the variable flags. |
Variable::SetVariableFlags |
Returns the variable flags. |
Variable::GetValue |
Returns the variable value as a string. |
Variable::SetValue |
Sets the variable value as a string. |
Variable::GetIntegerValue |
Returns the variable value as an integer. |
Variable::SetIntegerValue |
Sets the variable value as an integer. |
Variable::GetFloatValue |
Returns the variable value as a floating-point number. |
Variable::SetFloatValue |
Returns the variable value as a floating-point number. |
Constructor
explicit Variable(const char *name, uint32 flags = 0,
Variable::ObserverType *observer = nullptr);
Parameters
name |
A pointer to the name of the variable. |
flags |
The variable flags. See below for possible values. |
observer |
An observer that is invoked when the variable is modified. |
Description
The Variable
class encapsulates the name and value of a system variable. The value of a system variable is a text string containing up to kMaxVariableValueLength
characters. The initial value of a variable upon construction is the empty string.The
flags
parameter specifies a set of flags that control properties of the variable. The flags can be a combination (through logical OR) of the following constants.
kVariableNonpersistent |
The variable should not be saved across different executions of the engine. |
kVariablePermanent |
The variable cannot be deleted by the user. |
observer
parameter is specified, then it provides an observer function that is called each time the variable's value is modified through one of the member functions that set the value.Once a variable has been created, it can be registered with the engine by calling the
Engine::AddVariable
function. A variable is unregistered by simply destroying it.
Base Classes
MapElement<Variable> |
Used internally to store all variables in a map. |
Observable<Variable> |
Observers can be invoked when the variable is modified. |
See Also