1 #include <msp/core/getopt.h>
2 #include <msp/core/maputils.h>
3 #include <msp/io/file.h>
11 PoeFilter::PoeFilter(int argc, char **argv)
14 getopt.add_argument("filename", filename, GetOpt::REQUIRED_ARG);
20 DataFile::load(*this, filename);
22 for(map<string, Filter>::const_iterator i=filters.begin(); i!=filters.end(); ++i)
23 if(!i->second.is_abstract())
25 IO::BufferedFile out(i->first+".filter", IO::M_WRITE);
32 const Category &PoeFilter::get_category(const string &name) const
34 return get_item(categories, name);
37 void PoeFilter::find_categories(const Regex &re, list<const Category *> &categs) const
39 for(map<string, Category>::const_iterator i=categories.begin(); i!=categories.end(); ++i)
40 if(re.match(i->first))
41 categs.push_back(&i->second);
44 const Filter &PoeFilter::get_filter(const string &name) const
46 return get_item(filters, name);
50 PoeFilter::Loader::Loader(PoeFilter &f):
51 DataFile::ObjectLoader<PoeFilter>(f)
53 add("category", &Loader::category);
54 add("filter", &Loader::filter);
55 add("theme", &Loader::theme);
58 void PoeFilter::Loader::category(const string &name)
62 obj.categories[name] = cat;
65 void PoeFilter::Loader::filter(const string &name)
69 obj.filters[name] = flt;
72 void PoeFilter::Loader::theme()