diff options
author | Huynh Tran <nthuynh75@gmail.com> | 2005-06-19 12:46:25 +0000 |
---|---|---|
committer | Huynh Tran <nthuynh75@gmail.com> | 2005-06-19 12:46:25 +0000 |
commit | 92705ce7bc5d3360ed79b2ecbc2aa0fc29090840 (patch) | |
tree | 1bbc827a79e2010d3ef8c669cc7577d8299e9874 /src/dalstorage.cpp | |
parent | f194e2fb62234ff66d0ee12282ce4a22aa237e89 (diff) | |
download | manaserv-92705ce7bc5d3360ed79b2ecbc2aa0fc29090840.tar.gz manaserv-92705ce7bc5d3360ed79b2ecbc2aa0fc29090840.tar.bz2 manaserv-92705ce7bc5d3360ed79b2ecbc2aa0fc29090840.tar.xz manaserv-92705ce7bc5d3360ed79b2ecbc2aa0fc29090840.zip |
Passwords are now encrypted when creating a new Account, added unit tests for the Account class and moved functors into a separate header file for reuse.
Diffstat (limited to 'src/dalstorage.cpp')
-rw-r--r-- | src/dalstorage.cpp | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/src/dalstorage.cpp b/src/dalstorage.cpp index f3f18515..1bcafedf 100644 --- a/src/dalstorage.cpp +++ b/src/dalstorage.cpp @@ -23,51 +23,12 @@ #include <sstream> +#include "utils/functors.h" + #include "dalstorage.h" #include "dalstoragesql.h" -namespace -{ - - -/** - * Functor used for the search of an Account by name. - */ -struct account_name_equals_to - : public std::binary_function<Account*, std::string, bool> -{ - bool - operator()(Account* account, - const std::string& name) const - { - return account->getName() == name; - } -}; - - -/** - * Functor to convert a string into another type using - * std::istringstream.operator>>(). - */ -template <typename T> -struct string_to: public std::unary_function<std::string, T> -{ - T - operator()(const std::string& s) const - { - std::istringstream is(s); - T value; - is >> value; - - return value; - } -}; - - -} // anonymous namespace - - namespace tmwserv { @@ -123,7 +84,7 @@ DALStorage::getAccount(const std::string& userName) std::find_if( mAccounts.begin(), mAccounts.end(), - std::bind2nd(account_name_equals_to(), userName) + std::bind2nd(obj_name_is<Account*>(), userName) ); if (it != mAccounts.end()) { |