diff options
author | Huynh Tran <nthuynh75@gmail.com> | 2005-06-27 15:41:00 +0000 |
---|---|---|
committer | Huynh Tran <nthuynh75@gmail.com> | 2005-06-27 15:41:00 +0000 |
commit | a78e59b9f2fb4eb7971eb5f46637df80157d787a (patch) | |
tree | 24e94f377228d9cfaeb5d487031bcdc326bb7c68 /src/storage.h | |
parent | bfcc4c6858238f343508b53f7fe90b9e9ac0ed01 (diff) | |
download | manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.tar.gz manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.tar.bz2 manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.tar.xz manaserv-a78e59b9f2fb4eb7971eb5f46637df80157d787a.zip |
Implemented addAccount() (+ unit tests).
Diffstat (limited to 'src/storage.h')
-rw-r--r-- | src/storage.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/storage.h b/src/storage.h index 5b695bb0..4c6310d6 100644 --- a/src/storage.h +++ b/src/storage.h @@ -62,6 +62,15 @@ typedef enum { /** + * Structure type for the account info. + */ +typedef struct { + AccountStatus status; + unsigned int id; +} AccountInfo; + + +/** * Functor to be used as the sorting criterion of the map defined below. */ struct account_sort_by_name @@ -77,8 +86,13 @@ struct account_sort_by_name /** * Data type for the list of accounts. + * + * Notes: + * - the account id is not attribute of Account but AccountInfo because + * only the storage should modify this value, this attribute is for + * internal use. */ -typedef std::map<Account*, AccountStatus, account_sort_by_name> Accounts; +typedef std::map<Account*, AccountInfo, account_sort_by_name> Accounts; /** @@ -101,7 +115,7 @@ class account_by_name * Operator(). */ bool - operator()(std::pair<Account*, AccountStatus> elem) const + operator()(std::pair<Account*, AccountInfo> elem) const { return (elem.first)->getName() == mName; } @@ -255,7 +269,7 @@ class Storage * @param account the new account. */ virtual void - addAccount(Account* account) = 0; + addAccount(const Account* account) = 0; /** |