+void Collection::gather_items(vector<const Variant *> *vars, list<string> *names, const CollectionItemTypeBase &type, bool include_sources) const
+{
+ for(const auto &kvp: items)
+ if(type.check_item_type(kvp.second))
+ {
+ if(vars)
+ vars->push_back(&kvp.second);
+ if(names)
+ names->push_back(kvp.first);
+ }
+
+ if(include_sources && names)
+ gather_names_from_sources(*names, type);
+}
+
+unsigned Collection::get_status(const string &name, const CollectionItemTypeBase &type) const
+{
+ ItemMap::const_iterator i = items.find(name);
+ if(i==items.end())
+ {
+ auto j = find_if(sources, [&name, &type](const CollectionSource *s){ return s->is_loadable(type, name); });
+ if(j!=sources.end())
+ return 2;
+ if(fallback)
+ if(CollectionItemTypeBase *fb_type = fallback->get_type(type))
+ return fallback->get_status(name, *fb_type);
+ return 0;
+ }
+
+ return type.check_item_type(i->second);
+}
+
+CollectionItemTypeBase *Collection::get_type(const CollectionItemTypeBase &type) const
+{
+ for(CollectionItemTypeBase *t: types)
+ if(t->is_same_type(type))
+ return t;
+ return nullptr;
+}
+
+CollectionItemTypeBase *Collection::get_type_for_item(const Variant &var) const
+{
+ for(CollectionItemTypeBase *t: types)
+ if(t->check_item_type(var))
+ return t;
+ return nullptr;
+}
+
+void Collection::add_source(const CollectionSource &s)