summary refs log tree commit diff stats
path: root/lib/database.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/database.h')
-rw-r--r--lib/database.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/database.h b/lib/database.h new file mode 100644 index 0000000..d68c40b --- /dev/null +++ b/lib/database.h
@@ -0,0 +1,73 @@
1#ifndef DATABASE_H_0B0A47D2
2#define DATABASE_H_0B0A47D2
3
4#include <string>
5#include <exception>
6#include <list>
7#include "notion.h"
8#include "word.h"
9#include "group.h"
10#include "frame.h"
11#include "lemma.h"
12#include "form.h"
13#include "pronunciation.h"
14
15struct sqlite3;
16
17namespace verbly {
18
19 template <typename Object>
20 class query;
21
22 class database {
23 public:
24
25 // Constructor
26
27 explicit database(std::string path);
28
29 // Disable copying
30
31 database(const database& other) = delete;
32 database& operator=(const database& other) = delete;
33
34 // Move constructor and move assignment
35
36 database(database&& other);
37 database& operator=(database&& other);
38
39 // Swap
40
41 friend void swap(database& first, database& second);
42
43 // Destructor
44
45 ~database();
46
47 // Queries
48
49 query<notion> notions(filter where, bool random = true, int limit = 1) const;
50
51 query<word> words(filter where, bool random = true, int limit = 1) const;
52
53 query<group> groups(filter where, bool random = true, int limit = 1) const;
54
55 query<frame> frames(filter where, bool random = true, int limit = 1) const;
56
57 query<lemma> lemmas(filter where, bool random = true, int limit = 1) const;
58
59 query<form> forms(filter where, bool random = true, int limit = 1) const;
60
61 query<pronunciation> pronunciations(filter where, bool random = true, int limit = 1) const;
62
63 private:
64
65 database() = default;
66
67 sqlite3* ppdb_ = nullptr;
68
69 };
70
71};
72
73#endif /* end of include guard: DATABASE_H_0B0A47D2 */