1 #ifndef MSP_DATAFILE_OBJECTLOADER_H_
2 #define MSP_DATAFILE_OBJECTLOADER_H_
10 class no_collection: public std::runtime_error
13 no_collection(const std::type_info &);
19 Provides the basic functionality of an object loader. Deriving from this
20 allows loading values directly into member variables of the objects.
23 class ObjectLoader: public Loader
31 ObjectLoader(O &o): obj(o) { }
34 O &get_object() const { return obj; }
39 Provides functionality for loading objects with a Collection. Deriving from
40 this allows loading pointers to objects in the collection automatically.
42 template<typename O, typename C = Collection>
43 class CollectionObjectLoader: public ObjectLoader<O>
51 CollectionObjectLoader(O &o, C *c): ObjectLoader<O>(o), coll(c) { }
54 C &get_collection() const
57 throw no_collection(typeid(O));
62 } // namespace DataFile