SmartFoxServer 2X C++ API
|
The SFSUserVariable object represents a SmartFoxServer User Variable entity on the client. More...
#include <SFSUserVariable.h>
Public Member Functions | |
SFSUserVariable (string name, boost::shared_ptr< long int > val) | |
Contructor for SFSUserVariable More... | |
SFSUserVariable (string name, boost::shared_ptr< void > val, long int type) | |
bool | IsPrivate () |
Indicates whether this User Variable is private or not. More... | |
void | IsPrivate (bool value) |
Indicates whether this User Variable is private or not. More... | |
virtual boost::shared_ptr< string > | Name () |
Indicates the name of this variable. | |
virtual VariableType | Type () |
Indicates the type of this variable. | |
virtual boost::shared_ptr< void > | Value () |
Returns the untyped value of this variable. | |
virtual boost::shared_ptr< bool > | GetBoolValue () |
Retrieves the value of a boolean variable. | |
virtual boost::shared_ptr< long int > | GetIntValue () |
Retrieves the value of an integer variable. | |
virtual boost::shared_ptr< double > | GetDoubleValue () |
Retrieves the value of a double precision variable. | |
virtual boost::shared_ptr< string > | GetStringValue () |
Retrieves the value of a string variable. | |
virtual boost::shared_ptr< ISFSObject > | GetSFSObjectValue () |
Retrieves the value of a SFSObject variable. | |
virtual boost::shared_ptr< ISFSArray > | GetSFSArrayValue () |
Retrieves the value of a SFSArray variable. | |
virtual bool | IsNull () |
Indicates if the variable is null . | |
virtual boost::shared_ptr< ISFSArray > | ToSFSArray () |
<exclude> | |
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... | |
Static Public Member Functions | |
static boost::shared_ptr< SFSUserVariable > | newPrivateVariable (string name, boost::shared_ptr< long int > val) |
Creates a new private User Variable. More... | |
The SFSUserVariable object represents a SmartFoxServer User Variable entity on the client.
This is a custom value attached to a User object that gets automatically synchronized between client and server on every change.
User Variables are particularly useful to store custom user data that must be "visible" to the other users, such as a profile, a score, a status message, etc. User Variables can be set by means of the Sfs2X.Requests.SetUserVariablesRequest request; they support the data types listed in the
class (also nested). A User Variable can also be null
.
User Variables can be 'private' (starting from SFS2X v2.12 with client API v1.7): this flag allows to limit the visibility of variables to their owner only. In other words User Variables marked as private are not sent to other users, even if located in the same Room.
Sfs2X::Entities::Variables::SFSUserVariable::SFSUserVariable | ( | string | name, |
boost::shared_ptr< long int > | val | ||
) |
Contructor for SFSUserVariable
<overrides>
</overrides>
name | the name of the variable |
val | the variable value ( can be Boolean, int, Number, String, SFSObject, SFSArray ) |
Sfs2X::Entities::Variables::SFSUserVariable::SFSUserVariable | ( | 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 |
|
virtual |
Indicates whether this User Variable is private or not.
A private User Variable is visible only to its owner; any changes made to the variable will be transmitted to the owner only.
NOTE: setting this property manually on an existing User Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the User Variable object is created by the developer only (using the new keyword).
Implements Sfs2X::Entities::Variables::UserVariable.
|
virtual |
Indicates whether this User Variable is private or not.
A private User Variable is visible only to its owner; any changes made to the variable will be transmitted to the owner only.
NOTE: setting this property manually on an existing User Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the User Variable object is created by the developer only (using the new keyword).
Implements Sfs2X::Entities::Variables::UserVariable.
|
static |