diff options
Diffstat (limited to 'src/storage.h')
-rw-r--r-- | src/storage.h | 63 |
1 files changed, 23 insertions, 40 deletions
diff --git a/src/storage.h b/src/storage.h index 5cf96eb4..e5be589d 100644 --- a/src/storage.h +++ b/src/storage.h @@ -20,66 +20,49 @@ * * $Id$ */ -#ifndef STORAGE_H -#define STORAGE_H - -#ifdef SQLITE_SUPPORT -#include "sqlite/SQLiteWrapper.h" -#endif +#ifndef TMWSERV_STORAGE_H +#define TMWSERV_STORAGE_H #include "object.h" #include "account.h" -/* - * Storage - * Storage is the resource manager - */ -class Storage { - //make storage singleton - Storage(const Storage &n) { } - -#ifdef SQLITE_SUPPORT - SQLiteWrapper sqlite; /**< Database */ -#endif - std::vector<Account*> accounts; /**< Loaded account data */ - std::vector<Being*> characters; /**< Loaded account data */ - +/** + * A storage of persistent dynamic data. + */ +class Storage +{ public: - /** - * Constructor. - */ - Storage(); + static Storage *getInstance(); + static void deleteInstance(); /** - * Destructor. + * Make sure any changes are saved. */ - ~Storage(); + virtual void flush() = 0; /** - * Create tables if master is empty + * Account count (test function). */ - void create_tables_if_necessary(); + virtual unsigned int getAccountCount() = 0; /** - * Save changes to database + * Get account by username. */ - void save(); + virtual Account *getAccount(const std::string &username) = 0; + protected: /** - * Account count (test function) + * Constructor. */ - unsigned int accountCount(); + Storage(); /** - * Get account & associated data + * Destructor. */ - Account* getAccount(const std::string &username); + virtual ~Storage(); - /** - * Get character of username - */ - Being* getCharacter(const std::string &username); + private: + static Storage *instance; }; -#endif /* STORAGE_H */ - +#endif /* TMWSERV_STORAGE_H */ |