X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcollection.h;h=b2239905edb4d824cd14e1d763ff62d234672032;hb=e0af585ed57bdb5b1ea4f4a415fda13b5d99d2dc;hp=8b4eba01b0fb5b83f4a1fdc936d6d327ba4bc971;hpb=57dc9929879076398467ae16d349cd0d453737fe;p=libs%2Fdatafile.git diff --git a/source/collection.h b/source/collection.h index 8b4eba0..b223990 100644 --- a/source/collection.h +++ b/source/collection.h @@ -46,7 +46,7 @@ public: template friend class CollectionItemType; private: - template::value > + template::value> struct Add; Collection &coll; @@ -58,7 +58,7 @@ public: template void coll_item(const std::string &n) { - RefPtr it=new T; + RefPtr it = new T; load_sub(*it, dynamic_cast(coll)); coll.add(n, it.get()); it.release(); @@ -67,13 +67,11 @@ public: template void item(const std::string &n) { - RefPtr it=new T; + RefPtr it = new T; load_sub(*it); coll.add(n, it.get()); it.release(); } - - template friend class ItemKeyword; }; private: @@ -341,7 +339,8 @@ public: if(!creat) throw std::runtime_error("no creator"); T *obj = creat->create(coll, name); - store->store(coll, name, obj); + if(obj) + store->store(coll, name, obj); } };