summary refs log tree commit diff stats
path: root/cardset.h
blob: 217d859d0e595f404ed05fc1e8886d5438f7f9c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef CARDSET_H_09C0428F
#define CARDSET_H_09C0428F

#include <set>
#include <string>
#include <tuple>

#include "prefix_search.h"

using ps_type = prefix_search<std::tuple<size_t, size_t>>;

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<char>& getCharacters() const { return chars_; }

 private:
  std::vector<card> cards_;
  ps_type titles_;
  std::set<char> chars_;
};

#endif /* end of include guard: CARDSET_H_09C0428F */