Nebula
Loading...
Searching...
No Matches
dbserver.h
Go to the documentation of this file.
1#ifndef DB_DBSERVER_H
2#define DB_DBSERVER_H
3//------------------------------------------------------------------------------
13#include "core/refcounted.h"
14#include "core/singleton.h"
15#include "db/database.h"
17
18//------------------------------------------------------------------------------
19namespace Db
20{
22{
25public:
27 DbServer();
29 virtual ~DbServer();
30
32 bool OpenStaticDatabase(const Util::String& dbUri);
34 bool OpenGameDatabase(const Util::String& dbUri);
36 bool OpenNewGame(const Util::String& profileURI, const Util::String& dbURI);
38 bool OpenContinueGame(const Util::String& profileURI);
40 bool OpenLoadGame(const Util::String& profileURI, const Util::String& dbURI, const Util::String& saveGameURI);
42 void DeleteCurrentGame(const Util::String& profileURI);
46 void CloseGameDatabase();
48 void Close();
50 bool IsStaticDatabaseOpen() const;
52 bool IsGameDatabaseOpen() const;
54 bool CreateSaveGame(const Util::String& profileURI, const Util::String& dbURI, const Util::String& saveGameURI);
56 const Ptr<Database>& GetGameDatabase() const;
58 const Ptr<Database>& GetStaticDatabase() const;
60 bool CurrentGameExists(const Util::String& profileURI) const;
62 void SetWorkingDbInMemory(bool b);
63
64private:
69};
70
71//------------------------------------------------------------------------------
74inline bool
76{
77 return this->staticDatabase.isvalid();
78}
79
80//------------------------------------------------------------------------------
83inline bool
85{
86 return this->gameDatabase.isvalid();
87}
88
89//------------------------------------------------------------------------------
92inline const Ptr<Database>&
94{
95 return this->staticDatabase;
96}
97
98//------------------------------------------------------------------------------
101inline const Ptr<Database>&
103{
104 return this->gameDatabase;
105}
106
107//------------------------------------------------------------------------------
110inline void
112{
113 this->workDbInMemory = b;
114}
115
116} // namespace Db
117//------------------------------------------------------------------------------
118#endif
The common base class of Nebula.
Definition refcounted.h:38
Provides highlevel access to the world database.
Definition dbserver.h:22
bool OpenStaticDatabase(const Util::String &dbUri)
open the static world database directly
Definition dbserver.cc:45
__DeclareSingleton(DbServer)
void SetWorkingDbInMemory(bool b)
set flag to load database as working db into memory
Definition dbserver.h:111
DbServer()
constructor
Definition dbserver.cc:21
void Close()
general close method
Definition dbserver.cc:120
bool OpenContinueGame(const Util::String &profileURI)
open the db subsysten in ContinueGame mode
Definition dbserver.cc:206
Ptr< Db::Sqlite3Factory > dbFactory
Definition dbserver.h:66
bool IsStaticDatabaseOpen() const
return true if static database is open
Definition dbserver.h:75
void CloseStaticDatabase()
close the static database
Definition dbserver.cc:70
void DeleteCurrentGame(const Util::String &profileURI)
delete current game database file
Definition dbserver.cc:137
bool workDbInMemory
Definition dbserver.h:65
__DeclareClass(DbServer)
const Ptr< Database > & GetGameDatabase() const
get the world database (for dynamic gameplay data)
Definition dbserver.h:102
void CloseGameDatabase()
close the dynamic database
Definition dbserver.cc:108
bool CurrentGameExists(const Util::String &profileURI) const
return true if a current world database exists
Definition dbserver.cc:226
bool OpenNewGame(const Util::String &profileURI, const Util::String &dbURI)
open the db subsystem in NewGame mode
Definition dbserver.cc:160
bool OpenGameDatabase(const Util::String &dbUri)
open the dynamic game database directly
Definition dbserver.cc:83
const Ptr< Database > & GetStaticDatabase() const
get static database (for constant read-only data)
Definition dbserver.h:93
Ptr< Database > staticDatabase
Definition dbserver.h:67
Ptr< Database > gameDatabase
Definition dbserver.h:68
bool CreateSaveGame(const Util::String &profileURI, const Util::String &dbURI, const Util::String &saveGameURI)
create a save game
Definition dbserver.cc:286
bool IsGameDatabaseOpen() const
return true if game database is open
Definition dbserver.h:84
bool OpenLoadGame(const Util::String &profileURI, const Util::String &dbURI, const Util::String &saveGameURI)
open the db subsystem in LoadGame mode
Definition dbserver.cc:239
virtual ~DbServer()
destructor
Definition dbserver.cc:31
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition column.cc:10
Nebula's universal string class.
Definition string.h:50