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 = make_unique<KeyValueRepositorySqlite>(*myDb, "settings");
|
||||||
mySettingsRepository->initialize();
|
mySettingsRepository->initialize();
|
||||||
|
|
||||||
|
myPropertyRepository = make_unique<CompositeKeyValueRepositorySqlite>(*myDb, "properties");
|
||||||
|
myPropertyRepository->initialize();
|
||||||
}
|
}
|
||||||
catch (const SqliteError& err) {
|
catch (const SqliteError& err) {
|
||||||
Logger::info("sqlite DB " + databaseFileName() + " failed to initialize: " + err.what());
|
Logger::info("sqlite DB " + databaseFileName() + " failed to initialize: " + err.what());
|
||||||
|
|
||||||
myDb.reset();
|
myDb.reset();
|
||||||
mySettingsRepository.reset();
|
mySettingsRepository.reset();
|
||||||
|
myPropertyRepository.reset();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "SqliteDatabase.hxx"
|
#include "SqliteDatabase.hxx"
|
||||||
#include "KeyValueRepositorySqlite.hxx"
|
#include "KeyValueRepositorySqlite.hxx"
|
||||||
|
#include "CompositeKeyValueRepositorySqlite.hxx"
|
||||||
|
|
||||||
class SettingsDb
|
class SettingsDb
|
||||||
{
|
{
|
||||||
|
@ -32,6 +33,8 @@ class SettingsDb
|
||||||
|
|
||||||
KeyValueRepository& settingsRepository() const { return *mySettingsRepository; }
|
KeyValueRepository& settingsRepository() const { return *mySettingsRepository; }
|
||||||
|
|
||||||
|
CompositeKeyValueRepository& propertyRepository() const { return *myPropertyRepository; }
|
||||||
|
|
||||||
const string& databaseFileName() const { return myDb->fileName(); }
|
const string& databaseFileName() const { return myDb->fileName(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -41,6 +44,7 @@ class SettingsDb
|
||||||
|
|
||||||
unique_ptr<SqliteDatabase> myDb;
|
unique_ptr<SqliteDatabase> myDb;
|
||||||
unique_ptr<KeyValueRepositorySqlite> mySettingsRepository;
|
unique_ptr<KeyValueRepositorySqlite> mySettingsRepository;
|
||||||
|
unique_ptr<CompositeKeyValueRepositorySqlite> myPropertyRepository;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_DB_HXX
|
#endif // SETTINGS_DB_HXX
|
||||||
|
|
Loading…
Reference in New Issue