From 93cf929f29dea490ed60e5300cacdd99886c988e Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 9 Sep 2023 20:09:50 -0400 Subject: Add the standalone portion of mapman. --- mapman/src/library.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mapman/src/library.hpp (limited to 'mapman/src/library.hpp') 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 +#include +#include + +struct sqlite3; + +class map_library +{ +public: + map_library(); + ~map_library(); + + std::vector 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 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 &tally, + std::vector &a_b, + std::vector &b_a) const; + + bool open_db(const std::filesystem::path &p); +private: + void init_db(); + bool verify_db(); + sqlite3 *db; +}; + +#endif -- cgit v1.2.3