diff options
Diffstat (limited to 'src/account-server/storage.h')
-rw-r--r-- | src/account-server/storage.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/account-server/storage.h b/src/account-server/storage.h index d635fb9b..ca83e6f1 100644 --- a/src/account-server/storage.h +++ b/src/account-server/storage.h @@ -23,6 +23,7 @@ #include <list> #include <map> +#include <memory> #include <vector> #include "dal/dataprovider.h" @@ -47,6 +48,9 @@ class Storage Storage(); ~Storage(); + Storage(const Storage &rhs) = delete; + Storage &operator=(const Storage &rhs) = delete; + /** * Connect to the database and initialize it if necessary. */ @@ -64,7 +68,7 @@ class Storage * * @return the account associated to the user name. */ - Account *getAccount(const std::string &userName); + std::unique_ptr<Account> getAccount(const std::string &userName); /** * Get an account by Id. @@ -73,7 +77,7 @@ class Storage * * @return the account associated with the Id. */ - Account *getAccount(int accountId); + std::unique_ptr<Account> getAccount(int accountId); /** * Gets a character by database Id. @@ -108,21 +112,21 @@ class Storage * * @param account the new account. */ - void addAccount(Account *account); + void addAccount(Account &account); /** * Delete an account and its associated data from the database. * * @param account the account to delete. */ - void delAccount(Account *account); + void delAccount(Account &account); /** * Update the date and time of the last login. * * @param account the account that recently logged in. */ - void updateLastLogin(const Account *account); + void updateLastLogin(const Account &account); /** * Write a modification message about Character points to the database. @@ -314,7 +318,7 @@ class Storage * * @param Account object to update. */ - void flush(Account *); + void flush(const Account &); /** * Gets the value of a quest variable. @@ -440,15 +444,12 @@ class Storage { return mDb; } private: - Storage(const Storage &rhs) = delete; - Storage &operator=(const Storage &rhs) = delete; - /** * Gets an account from a prepared SQL statement * * @return the account found */ - Account *getAccountBySQL(); + std::unique_ptr<Account> getAccountBySQL(); /** * Gets a character from a prepared SQL statement |