]> git.tdb.fi Git - poefilter.git/blob - source/filter.h
Correctly merge icon and light beam appearances
[poefilter.git] / source / filter.h
1 #ifndef FILTER_H_
2 #define FILTER_H_
3
4 #include <list>
5 #include <map>
6 #include <string>
7 #include <msp/datafile/objectloader.h>
8 #include <msp/io/base.h>
9 #include "appearance.h"
10
11 class Category;
12 class PoeFilter;
13 class Theme;
14
15 class FilterStatement
16 {
17 private:
18         bool show;
19         std::list<std::string> lines;
20
21 public:
22         FilterStatement();
23
24         void set_show(bool);
25         void add_line(const std::string &);
26
27         static void add_line(std::list<FilterStatement> &, const std::string &);
28
29         void write(Msp::IO::Base &) const;
30 };
31
32
33 class Filter
34 {
35 public:
36         class Loader: public Msp::DataFile::ObjectLoader<Filter>
37         {
38         private:
39                 const PoeFilter &poe;
40
41         public:
42                 Loader(Filter &, const PoeFilter &);
43
44         private:
45                 static std::string glob_to_re(const std::string &);
46                 static bool category_order(const Category *, const Category *);
47                 void add_categories(const std::string &, bool);
48
49                 void cancel(const std::string &);
50                 void hide(const std::string &);
51                 void include(const std::string &);
52                 void show(const std::string &);
53         };
54
55 private:
56         struct Block
57         {
58                 bool show;
59                 const Category *category;
60                 Appearance appearance;
61         };
62
63         std::list<Block> blocks;
64         bool abstract;
65
66 public:
67         Filter();
68
69         bool is_abstract() const { return abstract; }
70         void write(Msp::IO::Base &) const;
71 };
72
73 #endif