|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
The standard implementation of BuddyVariable: a custom value attached to a buddy in a buddy list, kept in sync between client and server on every change. More...
#include <SFSBuddyVariable.h>
Public Member Functions | |
| bool | isOffline () override |
| Checks if this is a "offline" variable (persistent), which is available to other Users even when the client is not online. | |
| std::string | toString () override |
| Public Member Functions inherited from sfs3::entities::Variable | |
| std::string | name () |
| virtual const VarData & | value () |
| Returns the value of this variable, whatever its type. | |
| virtual std::optional< bool > | boolValue () |
| virtual std::optional< uint8_t > | byteValue () |
| virtual std::optional< int16_t > | shortValue () |
| virtual std::optional< int32_t > | intValue () |
| virtual std::optional< int64_t > | longValue () |
| virtual std::optional< float > | floatValue () |
| virtual std::optional< double > | doubleValue () |
| virtual std::optional< std::string > | stringValue () |
| virtual std::shared_ptr< SFSObject > | sfsObjectValue () |
| virtual std::shared_ptr< SFSArray > | sfsArrayValue () |
| virtual std::optional< SFSVector2 > | vector2Value () |
| virtual std::optional< SFSVector3 > | vector3Value () |
| virtual void | setNull () |
| Clears the value of this variable. | |
| virtual void | setValue (VarData value) |
| Sets the value of this variable. | |
| virtual bool | isNull () |
Static Public Attributes | |
| static const std::string | OFFLINE_PREFIX = "$" |
| The prefix to be added to a Buddy Variable name to make it persistent. | |
The standard implementation of BuddyVariable: a custom value attached to a buddy in a buddy list, kept in sync between client and server on every change.
Buddy Variables work with the same principle of the User and Room Variables. The only difference is the logic by which they get propagated to other users: while Room and User Variables are usually sent to all clients in the same Room, Buddy Variables are sent to the users who have the owner of the variable in their Buddy Lists.
A special convention allows Buddy Variables to be set as "offline": those are persistent values, made available to all users who have the owner in their Buddy Lists whether he is online or not. A Buddy Variable is made persistent by starting its name with a dollar sign, for example $avatarPic.
|
overridevirtual |
Checks if this is a "offline" variable (persistent), which is available to other Users even when the client is not online.
There is no setter counterpart: a Buddy Variable is persistent by virtue of its own name starting with SFSBuddyVariable::OFFLINE_PREFIX, which is the only thing the server honours. Name it accordingly at construction to make it persistent.
Implements sfs3::entities::BuddyVariable.
|
overridevirtual |
Reimplemented from sfs3::entities::Variable.
|
inlinestatic |