SmartFoxServer 2X C++ API
SFSBuddy.h
1 // ===================================================================
2 //
3 // Description
4 // Contains the definition of SFSBuddy
5 //
6 // Revision history
7 // Date Description
8 // 30-Nov-2012 First version
9 //
10 // ===================================================================
11 #ifndef __SFSBuddy__
12 #define __SFSBuddy__
13 
14 #include "Data/ISFSArray.h"
15 #include "Buddy.h"
16 #include "Variables/BuddyVariable.h"
17 
18 #include <boost/shared_ptr.hpp> // Boost Asio shared pointer
19 
20 #if defined(_MSC_VER)
21 #pragma warning(disable:4786) // STL library: disable warning 4786; this warning is generated due to a Microsoft bug
22 #endif
23 #include <string> // STL library: string object
24 #include <vector> // STL library: vector object
25 #include <map> // STL library: map object
26 using namespace std; // STL library: declare the STL namespace
27 
28 namespace Sfs2X {
29 namespace Entities {
30 
72  class DLLImportExport SFSBuddy : public Buddy
73  {
74  public:
75 
76  // -------------------------------------------------------------------
77  // Public methods
78  // -------------------------------------------------------------------
79  static boost::shared_ptr<Buddy> FromSFSArray(boost::shared_ptr<ISFSArray> arr);
80 
81  SFSBuddy(long int id, string name);
82  SFSBuddy(long int id, string name, bool isBlocked);
83  SFSBuddy(long int id, string name, bool isBlocked, bool isTemp);
84  virtual ~SFSBuddy();
85 
86  long int Id();
87  void Id(long int value);
88  bool IsBlocked();
89  void IsBlocked(bool value);
90  bool IsTemp();
91  boost::shared_ptr<string> Name();
92  bool IsOnline();
93  boost::shared_ptr<string> State();
94  boost::shared_ptr<string> NickName();
95  boost::shared_ptr<vector<boost::shared_ptr<BuddyVariable> > > Variables();
96  boost::shared_ptr<BuddyVariable> GetVariable(string varName);
97  boost::shared_ptr<vector<boost::shared_ptr<BuddyVariable> > > GetOfflineVariables();
98  boost::shared_ptr<vector<boost::shared_ptr<BuddyVariable> > > GetOnlineVariables();
99  bool ContainsVariable(string varName);
100  void SetVariable(boost::shared_ptr<BuddyVariable> bVar);
101  void SetVariables(boost::shared_ptr<vector<boost::shared_ptr<BuddyVariable> > > variables);
102  void RemoveVariable(string varName);
103  void ClearVolatileVariables();
104  boost::shared_ptr<string> ToString();
105 
106  // -------------------------------------------------------------------
107  // Public members
108  // -------------------------------------------------------------------
109 
110  protected:
111 
112  // -------------------------------------------------------------------
113  // Protected methods
114  // -------------------------------------------------------------------
115 
116  // -------------------------------------------------------------------
117  // Protected members
118  // -------------------------------------------------------------------
119  boost::shared_ptr<string> name;
120  long int id;
121  bool isBlocked;
122  boost::shared_ptr<map<string, boost::shared_ptr<BuddyVariable> > > variables;
123  bool isTemp;
124 
125  private:
126 
127  // -------------------------------------------------------------------
128  // Private methods
129  // -------------------------------------------------------------------
130 
131  // -------------------------------------------------------------------
132  // Private members
133  // -------------------------------------------------------------------
134  };
135 
136 } // namespace Entities
137 } // namespace Sfs2X
138 
139 #endif
SFSBuddy
Definition: Buddy.h:35
STL namespace.
The SFSBuddy class represent a Buddy in the User&#39;s Buddy List
Definition: SFSBuddy.h:72
Definition: SmartFox.cpp:24