pandemonium_engine/modules/database/database_manager.h

46 lines
913 B
C++
Raw Normal View History

#ifndef DATABASE_MANAGER_H
#define DATABASE_MANAGER_H
2022-07-05 23:30:14 +02:00
#include "core/reference.h"
#include "core/ustring.h"
#include "core/vector.h"
#include "core/object.h"
2022-07-05 23:30:14 +02:00
class Database;
class DatabaseManager : public Object {
2022-07-05 23:30:14 +02:00
GDCLASS(DatabaseManager, Object);
public:
//ddb = default database
2022-07-05 23:30:14 +02:00
Ref<Database> get_ddb();
void set_ddb(const Ref<Database> &db);
void add_database(const Ref<Database> &db, bool set_as_default = true);
void remove_database(const int index, const bool unset_if_default = true);
Ref<Database> get_database(const int index);
int get_database_count();
Vector<Ref<Database>> get_databases();
Vector<Variant> get_databases_bind();
2022-07-05 23:30:14 +02:00
void load();
2022-07-05 23:30:14 +02:00
static DatabaseManager *get_singleton();
2022-07-05 23:30:14 +02:00
DatabaseManager();
~DatabaseManager();
2022-07-05 23:30:14 +02:00
protected:
Vector<Ref<Database>> _databases;
Ref<Database> _ddb;
private:
static void _bind_methods();
2022-07-05 23:30:14 +02:00
static DatabaseManager *_instance;
};
2022-07-05 23:30:14 +02:00
#endif