]> git.tdb.fi Git - poefilter.git/blob - source/category.h
Associate categories and appearances at filter level
[poefilter.git] / source / category.h
1 #ifndef CATEGORY_H_
2 #define CATEGORY_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/datafile/objectloader.h>
7 #include "appearance.h"
8 #include "condition.h"
9 #include "rarity.h"
10
11 class FilterStatement;
12 class PoeFilter;
13 class Theme;
14
15 class Category
16 {
17 public:
18         class Loader: public Msp::DataFile::ObjectLoader<Category>
19         {
20         private:
21                 const PoeFilter &poe;
22                 CompoundCondition *compound;
23                 Appearance::Loader app_loader;
24
25         public:
26                 Loader(Category &, const PoeFilter &, CompoundCondition * = 0);
27
28         protected:
29                 template<typename T>
30                 void add_range(const std::string &);
31
32                 void add_condition(Condition *);
33
34         private:
35                 void and_();
36
37                 template<typename T>
38                 void condition(typename T::Type);
39
40                 template<typename T>
41                 void condition_max(typename T::Type);
42
43                 template<typename T>
44                 void condition_min(typename T::Type);
45
46                 template<typename T>
47                 void condition_range(typename T::Type, typename T::Type);
48
49                 void linked_colors(const LinkedColorsCondition::Colors &);
50                 void or_();
51         };
52
53 private:
54         std::string name;
55         Condition *condition;
56         unsigned order;
57         Appearance appearance;
58
59 public:
60         Category(const std::string & = std::string());
61         Category(const Category &);
62         Category &operator=(const Category &);
63         ~Category();
64
65         const std::string &get_name() const { return name; }
66         unsigned get_order() const { return order; }
67         const Appearance &get_appearance() const { return appearance; }
68         void create_statements(std::list<FilterStatement> &) const;
69 };
70
71 #endif