]> git.tdb.fi Git - libs/datafile.git/blob - source/directorysource.h
dfce833562abb0cd3fd34e57d366740d1615da16
[libs/datafile.git] / source / directorysource.h
1 #ifndef MSP_DATAFILE_DIRECTORYSOURCE_H_
2 #define MSP_DATAFILE_DIRECTORYSOURCE_H_
3
4 #include <msp/fs/path.h>
5 #include "collectionsource.h"
6
7 namespace Msp {
8 namespace DataFile {
9
10 /**
11 A source that load items from files in a directory.
12 */
13 class DirectorySource: public CollectionSource
14 {
15 private:
16         typedef std::map<std::string, FS::Path> ObjectMap;
17
18         ObjectMap objects;
19
20 public:
21         void add_directory(const FS::Path &);
22
23         virtual bool is_loadable(const CollectionItemTypeBase &, const std::string &) const;
24         virtual NameList get_names(const CollectionItemTypeBase &) const;
25         virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const;
26
27         bool lookup_file(const std::string &, FS::Path &) const;
28 };
29
30 } // namespace DataFile
31 } // namespace Msp
32
33 #endif