aboutsummaryrefslogtreecommitdiff
path: root/mapman/src/library.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'mapman/src/library.hpp')
-rw-r--r--mapman/src/library.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/mapman/src/library.hpp b/mapman/src/library.hpp
new file mode 100644
index 0000000..82babe0
--- /dev/null
+++ b/mapman/src/library.hpp
@@ -0,0 +1,41 @@
+#ifndef LIBRARY_HPP
+#define LIBRARY_HPP
+
+#include "mapdump.hpp"
+
+#include <filesystem>
+#include <string>
+#include <vector>
+
+struct sqlite3;
+
+class map_library
+{
+public:
+ map_library();
+ ~map_library();
+
+ std::vector<int> map_ids() const;
+ bool has_map(int id) const;
+ void set_map(const map_t &map);
+ map_t get_map(int id) const;
+
+ std::vector<int64_t> groups() const;
+ int64_t new_group(const map_group_t &g);
+ bool has_group(int64_t gid) const;
+ void set_group(int64_t gid, const map_group_t &g);
+ map_group_t get_group(int64_t gid);
+ void remove_group(int64_t gid) const;
+
+ void tally_diff(const std::vector<int> &tally,
+ std::vector<int> &a_b,
+ std::vector<int> &b_a) const;
+
+ bool open_db(const std::filesystem::path &p);
+private:
+ void init_db();
+ bool verify_db();
+ sqlite3 *db;
+};
+
+#endif