3 This file is part of libmspdatafile
4 Copyright © 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_DATAFILE_OBJECTLOADER_H_
9 #define MSP_DATAFILE_OBJECTLOADER_H_
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 InvalidState("No collection");
62 } // namespace DataFile