+ /** Opens a raw resource, without interpreting it as object data. Null is
+ returned if no such file is found. The caller must dispose of the returned
+ object when done with it. */
+ IO::Seekable *open_raw(const std::string &) const;
+
+protected:
+ // Deprecated. Use open_raw instead.
+ DEPRECATED IO::Seekable *open_from_sources(const std::string &n) { return open_raw(n); }
+
+private:
+ void gather_names_from_sources(std::list<std::string> &, const CollectionItemTypeBase &) const;
+
+ void load_items_from_sources(const CollectionItemTypeBase &);
+
+protected:
+ /** Sets a fallback collection, which will be consulted if an item is not
+ found. */
+ void set_fallback(Collection *);
+
+ Collection *get_fallback() const { return fallback; }
+};
+
+template<typename T>
+class Collection::ItemLoader<T, false>: public T::Loader
+{
+public:
+ ItemLoader(T &o, Collection &):
+ T::Loader(o)
+ { }
+};
+
+template<typename T>
+class Collection::ItemLoader<T, true>: public T::Loader
+{
+public:
+ ItemLoader(T &o, Collection &c):
+ T::Loader(o, dynamic_cast<typename T::Loader::Collection &>(c))
+ { }
+};
+
+
+class CollectionItemTypeBase
+{
+protected:
+ struct ExtractorBase
+ {
+ virtual ~ExtractorBase() { }
+ };