1 #ifndef COLLECTIONSOURCE_H_
2 #define COLLECTIONSOURCE_H_
6 #include <msp/io/seekable.h>
12 class CollectionItemTypeBase;
15 Provides automatically loadable objects for collections. This is a base class;
16 see DirectorySource and PackSource for concrete classes.
18 class CollectionSource
21 typedef std::list<std::string> NameList;
24 CollectionSource() { }
26 virtual ~CollectionSource() { }
29 virtual bool is_loadable(const CollectionItemTypeBase &type, const std::string &name) const = 0;
31 /** Returns the names of loadable objects of a specific type. Implementors
32 should use the keyword and/or suffixes of the type to */
33 virtual NameList get_names(const CollectionItemTypeBase &type) const = 0;
35 virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const = 0;
37 /** Opens a file from the source. The caller is responsible for deleting
38 the returned object when done with it. */
39 virtual IO::Seekable *open(const std::string &) const = 0;
42 } // namespace DataFile