Commit 72aaa648 authored by Leon Do Castelo's avatar Leon Do Castelo
Browse files

singleton database

parent b1033c38
......@@ -16,8 +16,19 @@
class Database {
QSqlDatabase db;
static std::unique_ptr<Database> instance;
Database& operator=(const Database& a) = delete;
Database(const Database& a) = delete;
Database(std::string path);
Database(std::string path);
static Database& getInstance() {
if(instance == nullptr) {
instance.reset(new Database("application.db"));
return *instance;
~Database() { db.close(); }
std::vector<QString> getAutomates() const;
Fonction* getFonction(Automate& a) const;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment