]> git.tdb.fi Git - libs/datafile.git/blob - source/collectionsource.h
61bb11555decbbf85d36500f18ed829073b64f31
[libs/datafile.git] / source / collectionsource.h
1 #ifndef COLLECTIONSOURCE_H_
2 #define COLLECTIONSOURCE_H_
3
4 #include <list>
5 #include <string>
6
7 namespace Msp {
8 namespace DataFile {
9
10 class Collection;
11 class CollectionItemTypeBase;
12
13 /**
14 Provides automatically loadable objects for collections.  This is a base class;
15 see DirectorySource and PackSource for concrete classes.
16 */
17 class CollectionSource
18 {
19 public:
20         typedef std::list<std::string> NameList;
21
22 protected:
23         CollectionSource() { }
24
25 public:
26         /** Determines */
27         virtual bool is_loadable(const CollectionItemTypeBase &type, const std::string &name) const = 0;
28
29         /** Returns the names of loadable objects of a specific type.  Implementors
30         should use the keyword and/or suffixes of the type to  */
31         virtual NameList get_names(const CollectionItemTypeBase &type) const = 0;
32
33         virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const = 0;
34 };
35
36 } // namespace DataFile
37 } // namespace Msp
38
39 #endif