SmartFoxServer 2X C++ API
SFSBuddyVariable.h
1 // ===================================================================
2 //
3 // Description
4 // Contains the definition of SFSBuddyVariable
5 //
6 // Revision history
7 // Date Description
8 // 30-Nov-2012 First version
9 //
10 // ===================================================================
11 #ifndef __SFSBuddyVariable__
12 #define __SFSBuddyVariable__
13 
14 #include "../../Util/Common.h"
15 #include "BaseVariable.h"
16 #include "BuddyVariable.h"
17 #include "../Data/ISFSArray.h"
18 #include "../Data/SFSArray.h"
19 #include "../Data/SFSObject.h"
20 
21 #include <boost/shared_ptr.hpp> // Boost Asio shared pointer
22 
23 #if defined(_MSC_VER)
24 #pragma warning(disable:4786) // STL library: disable warning 4786; this warning is generated due to a Microsoft bug
25 #endif
26 #include <string> // STL library: string object
27 using namespace std; // STL library: declare the STL namespace
28 
29 using namespace Sfs2X::Entities::Data;
30 
31 namespace Sfs2X {
32 namespace Entities {
33 namespace Variables {
34 
60  class DLLImportExport SFSBuddyVariable : public BaseVariable, public BuddyVariable
61  {
62  public:
63 
64  // -------------------------------------------------------------------
65  // Public methods
66  // -------------------------------------------------------------------
67 
68  static boost::shared_ptr<BuddyVariable> FromSFSArray(boost::shared_ptr<ISFSArray> sfsa);
69 
79  SFSBuddyVariable(string name, boost::shared_ptr<void> val, long int type);
80 
90  SFSBuddyVariable(boost::shared_ptr<string> name, boost::shared_ptr<void> val, long int type);
91 
93  SFSBuddyVariable(string name, boost::shared_ptr<long int> val);
94  SFSBuddyVariable(string name, boost::shared_ptr<unsigned long int> val);
95  SFSBuddyVariable(string name, boost::shared_ptr<int> val);
96  SFSBuddyVariable(string name, boost::shared_ptr<unsigned int> val);
97  SFSBuddyVariable(string name, boost::shared_ptr<bool> val);
98  SFSBuddyVariable(string name, boost::shared_ptr<double> val);
99  SFSBuddyVariable(string name, boost::shared_ptr<string> val);
100  SFSBuddyVariable(string name, boost::shared_ptr<SFSObject> val);
101  SFSBuddyVariable(string name, boost::shared_ptr<SFSArray> val);
102 
103  virtual ~SFSBuddyVariable();
104 
105  bool IsOffline();
106  boost::shared_ptr<string> Name();
107  VariableType Type();
108  boost::shared_ptr<void> Value();
109  boost::shared_ptr<bool> GetBoolValue();
110  boost::shared_ptr<long int> GetIntValue();
111  boost::shared_ptr<double> GetDoubleValue();
112  boost::shared_ptr<string> GetStringValue();
113  boost::shared_ptr<ISFSObject> GetSFSObjectValue();
114  boost::shared_ptr<ISFSArray> GetSFSArrayValue();
115  bool IsNull();
116  virtual boost::shared_ptr<ISFSArray> ToSFSArray();
117 
125  boost::shared_ptr<string> ToString();
126 
127  // -------------------------------------------------------------------
128  // Public members
129  // -------------------------------------------------------------------
130 
131  static boost::shared_ptr<string> OFFLINE_PREFIX;
132 
133  protected:
134 
135  // -------------------------------------------------------------------
136  // Protected methods
137  // -------------------------------------------------------------------
138 
139  // -------------------------------------------------------------------
140  // Protected members
141  // -------------------------------------------------------------------
142 
143  private:
144 
145  // -------------------------------------------------------------------
146  // Private methods
147  // -------------------------------------------------------------------
148 
149  // -------------------------------------------------------------------
150  // Private members
151  // -------------------------------------------------------------------
152  };
153 
154 } // namespace Variables
155 } // namespace Entities
156 } // namespace Sfs2X
157 
158 #endif
STL namespace.
The BaseVariable object is the base class for all SmartFoxServer Variable entities on the client...
Definition: BaseVariable.h:47
BuddyVariables are custom values attached to any Buddy in a BuddyList.
Definition: SFSBuddyVariable.h:60
Definition: SmartFox.cpp:24
Definition: ISFSArray.h:17