From 92705ce7bc5d3360ed79b2ecbc2aa0fc29090840 Mon Sep 17 00:00:00 2001 From: Huynh Tran Date: Sun, 19 Jun 2005 12:46:25 +0000 Subject: 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. --- src/dalstorage.cpp | 45 +++------------------------------------------ 1 file changed, 3 insertions(+), 42 deletions(-) (limited to 'src/dalstorage.cpp') 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 +#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 -{ - 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 -struct string_to: public std::unary_function -{ - 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(), userName) ); if (it != mAccounts.end()) { -- cgit v1.2.3-70-g09d2