virtual Condition *clone() const;
virtual bool can_merge(const Condition &, const CompoundCondition &) const;
virtual void add_lines(std::list<FilterStatement> &) const;
- virtual void add_merged_lines(const std::list<Condition *> &, const CompoundCondition &, std::list<FilterStatement> &) const;
+ virtual void add_merged_lines(const std::vector<Condition *> &, const CompoundCondition &, std::list<FilterStatement> &) const;
};
}
template<typename Traits>
-void ChoiceCondition<Traits>::add_merged_lines(const std::list<Condition *> &conditions, const CompoundCondition &parent, std::list<FilterStatement> &st) const
+void ChoiceCondition<Traits>::add_merged_lines(const std::vector<Condition *> &conditions, const CompoundCondition &parent, std::list<FilterStatement> &st) const
{
if(dynamic_cast<const OrCondition *>(&parent))
{
std::string line = Traits::get_keyword();
- for(std::list<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
+ for(std::vector<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
line += Msp::format(" \"%s\"", static_cast<const ChoiceCondition<Traits> *>(*i)->value);
FilterStatement::add_line(st, line);
}
CompoundCondition::~CompoundCondition()
{
- for(list<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
+ for(vector<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
delete *i;
}
void CompoundCondition::clone_to(CompoundCondition &other) const
{
- for(list<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
+ for(vector<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
other.add((*i)->clone());
}
void AndCondition::add_lines(list<FilterStatement> &st) const
{
- for(list<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
+ for(vector<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
(*i)->add_lines(st);
}
void OrCondition::add_lines(list<FilterStatement> &st) const
{
bool merge = conditions.size()>1;
- for(list<Condition *>::const_iterator i=conditions.begin(); (merge && ++i!=conditions.end()); )
+ for(vector<Condition *>::const_iterator i=conditions.begin(); (merge && ++i!=conditions.end()); )
merge = conditions.front()->can_merge(**i, *this);
if(merge)
else
{
list<FilterStatement> result;
- for(list<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
+ for(vector<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
{
list<FilterStatement> sub_result = st;
(*i)->add_lines(sub_result);
#include <list>
#include <string>
+#include <vector>
#include <msp/strings/format.h>
#include "rarity.h"
virtual Condition *clone() const = 0;
virtual bool can_merge(const Condition &, const CompoundCondition &) const { return false; }
virtual void add_lines(std::list<FilterStatement> &) const = 0;
- virtual void add_merged_lines(const std::list<Condition *> &, const CompoundCondition &, std::list<FilterStatement> &) const { }
+ virtual void add_merged_lines(const std::vector<Condition *> &, const CompoundCondition &, std::list<FilterStatement> &) const { }
};
class CompoundCondition: public Condition
{
protected:
- std::list<Condition *> conditions;
+ std::vector<Condition *> conditions;
public:
virtual ~CompoundCondition();
void Filter::Loader::add_categories(const string &name, bool show)
{
- list<const Category *> categs;
+ vector<const Category *> categs;
if(name.find('*')!=string::npos)
{
poe.find_categories(glob_to_re(name), categs);
if(categs.empty())
throw key_error(name);
- categs.sort(&category_order);
+ sort(categs, &category_order);
}
else
categs.push_back(&poe.get_category(name));
- for(list<const Category *>::const_iterator i=categs.begin(); i!=categs.end(); ++i)
+ for(vector<const Category *>::const_iterator i=categs.begin(); i!=categs.end(); ++i)
{
bool found = false;
for(list<Block>::const_iterator j=obj.blocks.begin(); (!found && j!=obj.blocks.end()); ++j)
void Filter::Loader::cancel(const string &name)
{
- list<const Category *> categs;
+ vector<const Category *> categs;
if(name.find('*')!=string::npos)
{
poe.find_categories(glob_to_re(name), categs);
else
categs.push_back(&poe.get_category(name));
- for(list<const Category *>::const_iterator i=categs.begin(); i!=categs.end(); ++i)
+ for(vector<const Category *>::const_iterator i=categs.begin(); i!=categs.end(); ++i)
for(list<Block>::iterator j=obj.blocks.begin(); j!=obj.blocks.end(); ++j)
if(j->category==*i)
{
return get_item(categories, name);
}
-void PoeFilter::find_categories(const Regex &re, list<const Category *> &categs) const
+void PoeFilter::find_categories(const Regex &re, vector<const Category *> &categs) const
{
for(map<string, Category>::const_iterator i=categories.begin(); i!=categories.end(); ++i)
if(re.match(i->first))
const Theme &get_theme() const { return theme; }
const Category &get_category(const std::string &) const;
- void find_categories(const Msp::Regex &, std::list<const Category *> &) const;
+ void find_categories(const Msp::Regex &, std::vector<const Category *> &) const;
const Filter &get_filter(const std::string &) const;
};