forked from nedrysoft/regex101
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegExDatabase.h
76 lines (67 loc) · 2.65 KB
/
RegExDatabase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef REGEXDATABASE_H
#define REGEXDATABASE_H
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QVariantMap>
namespace Nedrysoft
{
class RegExDatabase
{
private:
/**
* @brief Constructs a RegExDatabase
*
* @note Constructor is private and interaction with the class should be performed
* via the singleton intance created and returned in the getInstance method.
*/
RegExDatabase();
public:
/**
* @brief Returns the singleton instance of the class
*
* @details Constructor of class is not public and access is performed through
* the instance returned here.
*
* @returns the singleton instance of the object
*/
static RegExDatabase *getInstance();
/**
* @brief Initialise a new database
*
* @details Creates the required tables for the database.
*
* @returns true on success; otherfalse false
*/
bool initialiseDatabase();
/**
* @brief Prepares a SQL query stored in the resources
*
* @details Allows SQL queries to be stored in the resources file under /sql", the
* queries can be written as formatted text and then loaded simply using this function.
*
* @param[in] queryName the name of the query (no prefix or extension)
*
* @returns the prepared query
*/
QSqlQuery prepareQuery(QString queryName);
/**
* @brief Returns the database configuration
*
* @details Returns the parameters for the database connection in a variant map
*
* @returns a variant map containing the configuration
*/
QVariantMap getSettings();
/**
* @brief Stores the database configuration
*
* @details Stores the configuration for the database
*
* @param[in] settingsMap is the map containing the configuration keys and values
*/
void storeSettings(QVariantMap settingsMap);
private:
QSqlDatabase m_database; //! database instance to store regular expressions
};
}
#endif // REGEXDATABASE_H