diff options
Diffstat (limited to 'src/Server/UserManager.h')
-rw-r--r-- | src/Server/UserManager.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/Server/UserManager.h b/src/Server/UserManager.h index d0e7074..c3d990d 100644 --- a/src/Server/UserManager.h +++ b/src/Server/UserManager.h @@ -25,42 +25,41 @@ #include <map> #include <set> -#include <boost/function.hpp> +#include <boost/smart_ptr.hpp> +#include <boost/noncopyable.hpp> namespace Mad { namespace Server { class UserBackend; -class UserManager { +class UserManager : boost::noncopyable { private: struct Compare { - bool operator() (const UserBackend *b1, const UserBackend *b2); + bool operator() (boost::shared_ptr<UserBackend> b1, boost::shared_ptr<UserBackend> b2); }; static UserManager userManager; - std::set<UserBackend*, Compare> backends; + std::set<boost::shared_ptr<UserBackend>, Compare> backends; UserManager() {} public: - void registerBackend(UserBackend *backend) { + void registerBackend(boost::shared_ptr<UserBackend> backend) { backends.insert(backend); } - void unregisterBackend(UserBackend *backend) { + void unregisterBackend(boost::shared_ptr<UserBackend> backend) { backends.erase(backend); } + boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList(); + boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid); - bool getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback); - bool getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback); - - bool setPassword(unsigned long uid, const std::string &password, const boost::function1<void, bool> &callback); - - bool addUser(const Common::UserInfo &userInfo, const boost::function1<void, bool> &callback); + bool setPassword(unsigned long uid, const std::string &password); + bool addUser(const Common::UserInfo &userInfo); static UserManager *get() { return &userManager; |