mirror of https://github.com/stella-emu/stella.git
Add property repository.
This commit is contained in:
parent
791324caf3
commit
2b01bc76a8
|
@ -35,12 +35,16 @@ bool SettingsDb::initialize()
|
|||
|
||||
mySettingsRepository = make_unique<KeyValueRepositorySqlite>(*myDb, "settings");
|
||||
mySettingsRepository->initialize();
|
||||
|
||||
myPropertyRepository = make_unique<CompositeKeyValueRepositorySqlite>(*myDb, "properties");
|
||||
myPropertyRepository->initialize();
|
||||
}
|
||||
catch (const SqliteError& err) {
|
||||
Logger::info("sqlite DB " + databaseFileName() + " failed to initialize: " + err.what());
|
||||
|
||||
myDb.reset();
|
||||
mySettingsRepository.reset();
|
||||
myPropertyRepository.reset();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "bspf.hxx"
|
||||
#include "SqliteDatabase.hxx"
|
||||
#include "KeyValueRepositorySqlite.hxx"
|
||||
#include "CompositeKeyValueRepositorySqlite.hxx"
|
||||
|
||||
class SettingsDb
|
||||
{
|
||||
|
@ -32,6 +33,8 @@ class SettingsDb
|
|||
|
||||
KeyValueRepository& settingsRepository() const { return *mySettingsRepository; }
|
||||
|
||||
CompositeKeyValueRepository& propertyRepository() const { return *myPropertyRepository; }
|
||||
|
||||
const string& databaseFileName() const { return myDb->fileName(); }
|
||||
|
||||
private:
|
||||
|
@ -41,6 +44,7 @@ class SettingsDb
|
|||
|
||||
unique_ptr<SqliteDatabase> myDb;
|
||||
unique_ptr<KeyValueRepositorySqlite> mySettingsRepository;
|
||||
unique_ptr<CompositeKeyValueRepositorySqlite> myPropertyRepository;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_DB_HXX
|
||||
|
|
Loading…
Reference in New Issue