]> git.tdb.fi Git - libs/datafile.git/blob - source/builtinsource.h
Use C++11 features to manipulate containers
[libs/datafile.git] / source / builtinsource.h
1 #ifndef MSP_DATAFILE_BUILTINSOURCE_H_
2 #define MSP_DATAFILE_BUILTINSOURCE_H_
3
4 #include "collectionsource.h"
5
6 namespace Msp {
7 namespace DataFile {
8
9 class BuiltinSource: public CollectionSource
10 {
11 private:
12         struct Object
13         {
14                 const char *data;
15                 unsigned size;
16
17                 Object();
18                 Object(const char *, unsigned);
19         };
20
21         std::map<std::string, Object> objects;
22
23 public:
24         void add_object(const std::string &, const char *, unsigned);
25         void add_object(const std::string &, const char *);
26
27         virtual bool is_loadable(const CollectionItemTypeBase &, const std::string &) const;
28         virtual NameList get_names(const CollectionItemTypeBase &) const;
29         virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const;
30         virtual IO::Seekable *open(const std::string &) const;
31 };
32
33 } // namespace DataFile
34 } // namespace Msp
35
36 #endif