1 #include "collection.h"
8 Collection::~Collection()
10 for(TypeList::iterator i = types.begin(); i!=types.end(); ++i)
14 void Collection::add_future(const string &name)
16 for(TypeList::const_iterator i=types.begin(); i!=types.end(); ++i)
17 if((*i)->match_name(name))
19 insert_unique(items, name, (*i)->create_future());
24 void Collection::add_future_with_keyword(const string &name, const string &keyword)
26 for(TypeList::const_iterator i=types.begin(); i!=types.end(); ++i)
27 if((*i)->get_keyword()==keyword)
29 insert_unique(items, name, (*i)->create_future());
33 throw runtime_error("Collection::add_future_with_keyword");
37 Collection::Loader::Loader(Collection &c):
40 for(TypeList::const_iterator i = coll.types.begin(); i!=coll.types.end(); ++i)
41 (*i)->add_to_loader(*this);
45 CollectionItemTypeBase::CollectionItemTypeBase():
49 CollectionItemTypeBase::~CollectionItemTypeBase()
54 void CollectionItemTypeBase::set_keyword(const string &k)
61 void CollectionItemTypeBase::add_suffix(const string &s)
63 suffixes.push_back(s);
66 bool CollectionItemTypeBase::match_name(const string &name) const
68 for(vector<string>::const_iterator i=suffixes.begin(); i!=suffixes.end(); ++i)
69 if(name.size()>i->size() && !name.compare(name.size()-i->size(), string::npos, *i))
74 } // namespace DataFile