aboutsummaryrefslogtreecommitdiff
path: root/mapman/src/library.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2023-09-09 20:09:50 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2023-09-09 20:09:50 -0400
commit93cf929f29dea490ed60e5300cacdd99886c988e (patch)
tree0f8669c56e22a287047ee20846b92f1580d7364f /mapman/src/library.hpp
parent40432e083b11271cf3148b9c38156cf759436699 (diff)
downloadmeteor-trashy-addon-93cf929f29dea490ed60e5300cacdd99886c988e.tar.xz
Add the standalone portion of mapman.
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