]> git.tdb.fi Git - libs/datafile.git/blob - source/directorysource.h
Move the definition of Input's operator bool to the header
[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 #include "mspdatafile_api.h"
7
8 namespace Msp {
9 namespace DataFile {
10
11 /**
12 A source that load items from files in a directory.
13 */
14 class MSPDATAFILE_API DirectorySource: public CollectionSource
15 {
16 private:
17         typedef std::map<std::string, FS::Path> ObjectMap;
18
19         ObjectMap objects;
20
21 public:
22         void add_directory(const FS::Path &, bool = true);
23
24         bool is_loadable(const CollectionItemTypeBase &, const std::string &) const override;
25         NameList get_names(const CollectionItemTypeBase &) const override;
26         void load(Collection &, const CollectionItemTypeBase &, const std::string &) const override;
27         IO::Seekable *open(const std::string &) const override;
28
29         bool lookup_file(const std::string &, FS::Path &) const;
30 };
31
32 } // namespace DataFile
33 } // namespace Msp
34
35 #endif