X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fobjectloader.h;h=978366f730e51cc197fe7dd20ab7f56f4b52e84e;hb=fbe7e81c08a6b5a3f9ccdcbeb4dd4d351a5f4226;hp=a2a8720e840e6393f3e185950741fc6ba0df5729;hpb=07d4c0e55aa9571c9f24cf39d134f1f7474fd7cb;p=libs%2Fdatafile.git diff --git a/source/objectloader.h b/source/objectloader.h index a2a8720..978366f 100644 --- a/source/objectloader.h +++ b/source/objectloader.h @@ -1,18 +1,12 @@ #ifndef MSP_DATAFILE_OBJECTLOADER_H_ #define MSP_DATAFILE_OBJECTLOADER_H_ -#include +#include "except.h" #include "loader.h" namespace Msp { namespace DataFile { -class no_collection: public std::runtime_error -{ -public: - no_collection(const std::type_info &); -}; - class Collection; /** @@ -20,7 +14,7 @@ Provides the basic functionality of an object loader. Deriving from this allows loading values directly into member variables of the objects. */ template -class ObjectLoader: public Loader +class ObjectLoader: virtual public Loader { public: typedef O Object; @@ -48,10 +42,8 @@ public: protected: O &obj; - DerivedObjectLoader(O &o): B(o), obj(o) { } - - template - DerivedObjectLoader(O &o, T &a): B(o, a), obj(o) { } + template + DerivedObjectLoader(O &o, Args &&... a): B(o, std::forward(a)...), obj(o) { } public: O &get_object() const { return obj; } @@ -69,7 +61,7 @@ public: typedef C Collection; protected: - C *coll; + C *coll = nullptr; CollectionObjectLoader(O &o, C *c): ObjectLoader(o), coll(c) { }