SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSUserVariable.h
1 //
2 // SFSUserVariable.h
3 // SFS2X
4 //
5 // Original development by Infosfer Game Technologies Ltd. | http://www.infosfer.com.
6 //
7 // Maintained and developed by A51 Integrated.
8 // Copyright 2012 A51 Integrated | http://a51integrated.com. All rights reserved.
9 //
10 
11 #import "BaseVariable.h"
12 #import "UserVariable.h"
13 #import "ISFSArray.h"
14 #import "ISFSObject.h"
15 
16 /**The <em>SFSUserVariable</em> object represents a SmartFoxServer User Variable entity on the client.
17  It is a custom value attached to a <em>User</em> object that gets automatically synchronized between client and server on every change.
18 
19  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.
20  User Variables can be set by means of the <em>SetUserVariablesRequest</em> request; they support the following data types (also nested):
21  <em>Boolean</em>, <em>int</em>, <em>Number</em>, <em>String</em>, <em>SFSObject</em>, <em>SFSArray</em>. A User Variable can also be <code>null</code>.</p>
22 
23  Private UserVariables are available since SFS2X 2.12 with client API 1.7 and they allow to limit the visibility of variables marked as private to the owner only.
24  In other words UserVariables marked as private are not sent to other users in the same Room.</p>
25 
26  @see User
27  @see SetUserVariablesRequest
28 
29  */
30 
31 @interface SFSUserVariable : BaseVariable <UserVariable>
32 
33 /**
34  @param name the name of the variable
35  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
36  @param type (optional -1) it's usually not necessary to pass this parameter as the variable value is auto-detected
37  */
38 +(id)variableWithName:(NSString *)name value:(id)value type:(NSInteger)type;
39 
40 /**
41  @param name the name of the variable
42  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
43  */
44 +(id)variableWithName:(NSString *)name value:(id)value;
45 
46 
47 +(id <UserVariable>)fromSFSArray:(id <ISFSArray>)sfsa;
48 
49 /**
50  * Creates a new private User Variable.
51  * Private User Variables are not broadcast to other users: they are only visible on the server side and in the owner's client application.
52  *
53  * @param name The name of the User Variable
54  * @param value The value of the User Variable
55  *
56  * @see VariableType
57  */
58 +(id <UserVariable>) privateVariableWithName:(NSString *)name value:(id)value;
59 
60 /**
61  * Indicates whether this User Variable is private or not.
62  * A private User Variable is visible only to its owner; any changes made to the variable will be transmitted to the owner only.
63  *
64  * <p><b>NOTE</b>: setting the <em>private</em> property manually on an existing User Variable returned by the API has no effect on the server and can disrupt the API functioning.
65  * This flag can be set when the User Variable object is created by the developer only (using the <em>new</em> keyword).</p>
66  */
67 - (BOOL) isPrivate;
68 
69 - (void) setPrivate:(BOOL)priv;
70 
71 -(id<ISFSArray>)toSFSArray;
72 
73 
74 @end
SFSUserVariable
Definition: SFSUserVariable.h:31
BaseVariable
Definition: BaseVariable.h:12
-[SFSUserVariable isPrivate]
BOOL isPrivate()
Definition: SFSUserVariable.m:56