]> git.tdb.fi Git - libs/datafile.git/blob - source/directorysource.h
cd82ece11e10f606ade3eea92a598da5373e9bdc
[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         std::list<FS::Path> dirs;
17
18 public:
19         DirectorySource();
20
21         void set_directory(const FS::Path &);
22         void add_directory(const FS::Path &);
23
24         virtual bool is_loadable(const CollectionItemTypeBase &, const std::string &) const;
25         virtual NameList get_names(const CollectionItemTypeBase &) const;
26         virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const;
27
28         bool lookup_file(const std::string &, FS::Path &) const;
29 };
30
31 } // namespace DataFile
32 } // namespace Msp
33
34 #endif