diff options
Diffstat (limited to 'database.h')
-rw-r--r-- | database.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/database.h b/database.h new file mode 100644 index 0000000..560eeda --- /dev/null +++ b/database.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef DATABASE_H_75C3CE0F | ||
2 | #define DATABASE_H_75C3CE0F | ||
3 | |||
4 | #include <string> | ||
5 | |||
6 | struct sqlite3; | ||
7 | |||
8 | struct achievement { | ||
9 | int achievementId; | ||
10 | int gameId; | ||
11 | std::string title; | ||
12 | std::string moonImage; | ||
13 | }; | ||
14 | |||
15 | class database { | ||
16 | public: | ||
17 | |||
18 | // Constructor | ||
19 | |||
20 | explicit database(std::string path); | ||
21 | |||
22 | // Disable copying | ||
23 | |||
24 | database(const database& other) = delete; | ||
25 | database& operator=(const database& other) = delete; | ||
26 | |||
27 | // Move constructor and move assignment | ||
28 | |||
29 | database(database&& other); | ||
30 | database& operator=(database&& other); | ||
31 | |||
32 | // Swap | ||
33 | |||
34 | friend void swap(database& first, database& second); | ||
35 | |||
36 | // Destructor | ||
37 | |||
38 | ~database(); | ||
39 | |||
40 | // Accessors | ||
41 | |||
42 | achievement getRandomAchievement() const; | ||
43 | |||
44 | std::string getRandomImageForGame(int gameId) const; | ||
45 | |||
46 | private: | ||
47 | |||
48 | database() = default; | ||
49 | |||
50 | sqlite3* ppdb_ = nullptr; | ||
51 | }; | ||
52 | |||
53 | #endif /* end of include guard: DATABASE_H_75C3CE0F */ | ||