diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-11-04 02:19:09 -0500 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-11-04 02:19:09 -0500 |
| commit | 76bc3b3677062c0c1a6b9fa08ff20d12e470159c (patch) | |
| tree | 390897784acdec4f002df4a13e5d63f1f641fb40 /cardset.h | |
| parent | 5a65625cb589b2cb5b336e1fa5748df8dcdb8f6a (diff) | |
| download | wizard-76bc3b3677062c0c1a6b9fa08ff20d12e470159c.tar.gz wizard-76bc3b3677062c0c1a6b9fa08ff20d12e470159c.tar.bz2 wizard-76bc3b3677062c0c1a6b9fa08ff20d12e470159c.zip | |
Some old refactoring + some new refactoring
Diffstat (limited to 'cardset.h')
| -rw-r--r-- | cardset.h | 46 |
1 files changed, 46 insertions, 0 deletions
| diff --git a/cardset.h b/cardset.h new file mode 100644 index 0000000..217d859 --- /dev/null +++ b/cardset.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #ifndef CARDSET_H_09C0428F | ||
| 2 | #define CARDSET_H_09C0428F | ||
| 3 | |||
| 4 | #include <set> | ||
| 5 | #include <string> | ||
| 6 | #include <tuple> | ||
| 7 | |||
| 8 | #include "prefix_search.h" | ||
| 9 | |||
| 10 | using ps_type = prefix_search<std::tuple<size_t, size_t>>; | ||
| 11 | |||
| 12 | enum class card_frame { m2015, modern }; | ||
| 13 | |||
| 14 | struct card { | ||
| 15 | size_t id; | ||
| 16 | std::string name; | ||
| 17 | std::string imageUri; | ||
| 18 | card_frame frame; | ||
| 19 | std::string uuid; | ||
| 20 | |||
| 21 | card(size_t id, std::string name, std::string imageUri, card_frame frame, | ||
| 22 | std::string uuid) | ||
| 23 | : id(id), | ||
| 24 | name(std::move(name)), | ||
| 25 | imageUri(std::move(imageUri)), | ||
| 26 | frame(frame), | ||
| 27 | uuid(std::move(uuid)) {} | ||
| 28 | }; | ||
| 29 | |||
| 30 | class cardset { | ||
| 31 | public: | ||
| 32 | explicit cardset(std::string filename); | ||
| 33 | |||
| 34 | const card& getCard(size_t id) const { return cards_.at(id); } | ||
| 35 | |||
| 36 | const ps_type& getTitles() const { return titles_; } | ||
| 37 | |||
| 38 | const std::set<char>& getCharacters() const { return chars_; } | ||
| 39 | |||
| 40 | private: | ||
| 41 | std::vector<card> cards_; | ||
| 42 | ps_type titles_; | ||
| 43 | std::set<char> chars_; | ||
| 44 | }; | ||
| 45 | |||
| 46 | #endif /* end of include guard: CARDSET_H_09C0428F */ | ||
