The base of every variable kind: User, Room, Buddy and MMOItem Variables.
More...
#include <Variable.h>
The base of every variable kind: User, Room, Buddy and MMOItem Variables.
A variable holds a name and a value. The value is a VarData, so it can be a boolean, a number, a string, an SFSObject, an SFSArray or a vector. Each typed getter gives an empty optional when the variable holds a different type, or no value at all.
- See also
- UserVariable
-
RoomVariable
-
BuddyVariable
-
MMOItemVariable
◆ name()
| std::string sfs3::entities::Variable::name |
( |
| ) |
|
- Returns
- the name of this variable
◆ value()
| const VarData & sfs3::entities::Variable::value |
( |
| ) |
|
|
virtual |
Returns the value of this variable, whatever its type.
- Returns
- the value of the variable
- See also
- VarData
◆ boolValue()
| std::optional< bool > sfs3::entities::Variable::boolValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a boolean, or an empty optional if it holds another type
◆ byteValue()
| std::optional< uint8_t > sfs3::entities::Variable::byteValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a byte, or an empty optional if it holds another type
◆ shortValue()
| std::optional< int16_t > sfs3::entities::Variable::shortValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a short, or an empty optional if it holds another type
◆ intValue()
| std::optional< int32_t > sfs3::entities::Variable::intValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as an integer, or an empty optional if it holds another type
◆ longValue()
| std::optional< int64_t > sfs3::entities::Variable::longValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a long, or an empty optional if it holds another type
◆ floatValue()
| std::optional< float > sfs3::entities::Variable::floatValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a float, or an empty optional if it holds another type
◆ doubleValue()
| std::optional< double > sfs3::entities::Variable::doubleValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a double, or an empty optional if it holds another type
◆ stringValue()
| std::optional< std::string > sfs3::entities::Variable::stringValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a string, or an empty optional if it holds another type
◆ sfsObjectValue()
| std::shared_ptr< SFSObject > sfs3::entities::Variable::sfsObjectValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as an SFSObject, or nullptr if it holds another type
◆ sfsArrayValue()
| std::shared_ptr< SFSArray > sfs3::entities::Variable::sfsArrayValue |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as an SFSArray, or nullptr if it holds another type
◆ vector2Value()
| std::optional< SFSVector2 > sfs3::entities::Variable::vector2Value |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a 2D vector, or an empty optional if it holds another type
◆ vector3Value()
| std::optional< SFSVector3 > sfs3::entities::Variable::vector3Value |
( |
| ) |
|
|
virtual |
- Returns
- the value of this variable as a 3D vector, or an empty optional if it holds another type
◆ setNull()
| void sfs3::entities::Variable::setNull |
( |
| ) |
|
|
virtual |
Clears the value of this variable.
Sending a variable with no value to the server deletes it.
◆ setValue()
| void sfs3::entities::Variable::setValue |
( |
VarData | value | ) |
|
|
virtual |
Sets the value of this variable.
- Parameters
-
- See also
- VarData
◆ isNull()
| bool sfs3::entities::Variable::isNull |
( |
| ) |
|
|
virtual |
- Returns
- true if this variable has no value
◆ toString()
| std::string sfs3::entities::Variable::toString |
( |
| ) |
|
|
virtual |
The documentation for this class was generated from the following files: