namespace Msp {
namespace DataFile {
+Collection::Collection():
+ fallback(0)
+{ }
+
Collection::~Collection()
{
for(TypeList::iterator i = types.begin(); i!=types.end(); ++i)
(*j)->load(*this, *type, name);
loaded = items.count(name);
}
+ if(!loaded && fallback)
+ {
+ for(TypeList::const_iterator j=fallback->types.begin(); j!=fallback->types.end(); ++j)
+ if((*j)->is_same_type(*type))
+ {
+ if(fallback->get_status(name, **j))
+ return fallback->get_var(name, *j);
+ break;
+ }
+ }
}
return get_item(items, name);
sources.push_back(&s);
}
+IO::Seekable *Collection::open_from_sources(const string &name)
+{
+ for(SourceList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+ if(IO::Seekable *io = (*i)->open(name))
+ return io;
+
+ return 0;
+}
+
void Collection::gather_names_from_sources(list<string> &names, const CollectionItemTypeBase &type) const
{
for(SourceList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
}
}
+void Collection::set_fallback(Collection *f)
+{
+ fallback = f;
+}
+
Collection::Loader::Loader(Collection &c):
coll(c)