SmartFoxServer 2X C++ API
|
The RoomVariable class is used to represent variables maintained on the Server side and automatically updated to the clients. More...
#include <SFSRoomVariable.h>
Public Member Functions | |
SFSRoomVariable (string name, boost::shared_ptr< long int > val) | |
SFSRoomVariable (string name, boost::shared_ptr< void > val, long int type) | |
boost::shared_ptr< ISFSArray > | ToSFSArray () |
<exclude> | |
boost::shared_ptr< string > | Name () |
Indicates the name of this variable. | |
VariableType | Type () |
Indicates the type of this variable. | |
boost::shared_ptr< void > | Value () |
Returns the untyped value of this variable. | |
boost::shared_ptr< bool > | GetBoolValue () |
Retrieves the value of a boolean variable. | |
boost::shared_ptr< long int > | GetIntValue () |
Retrieves the value of an integer variable. | |
boost::shared_ptr< double > | GetDoubleValue () |
Retrieves the value of a double precision variable. | |
boost::shared_ptr< string > | GetStringValue () |
Retrieves the value of a string variable. | |
boost::shared_ptr< ISFSObject > | GetSFSObjectValue () |
Retrieves the value of a SFSObject variable. | |
boost::shared_ptr< ISFSArray > | GetSFSArrayValue () |
Retrieves the value of a SFSArray variable. | |
bool | IsNull () |
Indicates if the variable is null . | |
Public Member Functions inherited from Sfs2X::Entities::Variables::BaseVariable | |
BaseVariable (string name, boost::shared_ptr< void > val, long int type) | |
Creates a new BaseVariable instance. More... | |
BaseVariable (string name, boost::shared_ptr< long int > val) | |
Creates a new BaseVariable instance. More... | |
The RoomVariable class is used to represent variables maintained on the Server side and automatically updated to the clients.
They are particularly useful to "attach" any custom data to each Room such as the current game status and other Room-specific properties etc...
RoomVariables support basic data types and nested complex objects:
RoomVariables also support different flags:
Sfs2X::Entities::Variables::SFSRoomVariable::SFSRoomVariable | ( | string | name, |
boost::shared_ptr< long int > | val | ||
) |
<overrides>
</overrides>
name | the name of the variable |
val | the variable value ( can be Boolean, int, Number, String, SFSObject, SFSArray ) |
Sfs2X::Entities::Variables::SFSRoomVariable::SFSRoomVariable | ( | string | name, |
boost::shared_ptr< void > | val, | ||
long int | type | ||
) |
name | the name of the variable |
val | the variable value ( can be Boolean, int, Number, String, SFSObject, SFSArray ) |
type | it's usually not necessary to pass this parameter as the variable value is auto-detected |