+ ItemMap::iterator i = items.find(name);
+ if(i!=items.end())
+ return i->second;
+
+ if(type)
+ {
+ bool loaded = false;
+ if(type->can_create())
+ {
+ type->create_item(*this, name);
+ loaded = items.count(name);
+ }
+ for(SourceList::iterator j=sources.begin(); (!loaded && j!=sources.end()); ++j)
+ {
+ (*j)->load(*this, *type, name);
+ loaded = items.count(name);
+ }
+ }
+
+ return get_item(items, name);
+}
+
+CollectionItemTypeBase *Collection::get_type_for_item(const Variant &var) const
+{
+ for(TypeList::const_iterator i=types.begin(); i!=types.end(); ++i)
+ if((*i)->check_item_type(var))
+ return *i;
+ return 0;
+}
+
+void Collection::add_source(CollectionSource &s)
+{
+ sources.push_back(&s);