From 76bc3b3677062c0c1a6b9fa08ff20d12e470159c Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 4 Nov 2024 02:19:09 -0500 Subject: Some old refactoring + some new refactoring --- cardset.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cardset.h (limited to 'cardset.h') diff --git a/cardset.h b/cardset.h new file mode 100644 index 0000000..217d859 --- /dev/null +++ b/cardset.h @@ -0,0 +1,46 @@ +#ifndef CARDSET_H_09C0428F +#define CARDSET_H_09C0428F + +#include +#include +#include + +#include "prefix_search.h" + +using ps_type = prefix_search>; + +enum class card_frame { m2015, modern }; + +struct card { + size_t id; + std::string name; + std::string imageUri; + card_frame frame; + std::string uuid; + + card(size_t id, std::string name, std::string imageUri, card_frame frame, + std::string uuid) + : id(id), + name(std::move(name)), + imageUri(std::move(imageUri)), + frame(frame), + uuid(std::move(uuid)) {} +}; + +class cardset { + public: + explicit cardset(std::string filename); + + const card& getCard(size_t id) const { return cards_.at(id); } + + const ps_type& getTitles() const { return titles_; } + + const std::set& getCharacters() const { return chars_; } + + private: + std::vector cards_; + ps_type titles_; + std::set chars_; +}; + +#endif /* end of include guard: CARDSET_H_09C0428F */ -- cgit 1.4.1