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