]> git.tdb.fi Git - poefilter.git/blob - source/category.h
0c549fa9811e54a72a8bcc4a9ad7c2be11033ddb
[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                 void appearance(const std::string &);
37
38                 template<typename T>
39                 void condition(typename T::Type);
40
41                 template<typename T>
42                 void condition_max(typename T::Type);
43
44                 template<typename T>
45                 void condition_min(typename T::Type);
46
47                 template<typename T>
48                 void condition_range(typename T::Type, typename T::Type);
49
50                 void linked_colors(const LinkedColorsCondition::Colors &);
51                 void or_();
52         };
53
54 private:
55         Condition *condition;
56         unsigned order;
57         Appearance appearance;
58
59 public:
60         Category();
61         Category(const Category &);
62         Category &operator=(const Category &);
63         ~Category();
64
65         unsigned get_order() const { return order; }
66         void create_statements(std::list<FilterStatement> &) const;
67 };
68
69 #endif