From: Mikko Rasa Date: Tue, 26 Jul 2011 10:09:07 +0000 (+0300) Subject: Rename CollectionItemType::create method to creator X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=57dc9929879076398467ae16d349cd0d453737fe;p=libs%2Fdatafile.git Rename CollectionItemType::create method to creator --- diff --git a/source/collection.h b/source/collection.h index 82339d8..8b4eba0 100644 --- a/source/collection.h +++ b/source/collection.h @@ -292,17 +292,17 @@ private: { Collection::Loader::Add::add(loader, kwd); } }; - CreatorBase *creator; + CreatorBase *creat; StoreBase *store; public: CollectionItemType(): - creator(0), store(new Store) + creat(0), store(new Store) { tag = new Tag; } ~CollectionItemType() { - delete creator; + delete creat; delete store; } @@ -313,10 +313,10 @@ public: } template - CollectionItemType &create(T *(C::*func)(const std::string &)) + CollectionItemType &creator(T *(C::*func)(const std::string &)) { - delete creator; - creator = new Creator(func); + delete creat; + creat = new Creator(func); return *this; } @@ -334,13 +334,13 @@ public: { store->add_to_loader(loader, kwd); } virtual bool can_create() const - { return creator!=0; } + { return creat!=0; } virtual void create_item(Collection &coll, const std::string &name) const { - if(!creator) + if(!creat) throw std::runtime_error("no creator"); - T *obj = creator->create(coll, name); + T *obj = creat->create(coll, name); store->store(coll, name, obj); } }; diff --git a/tests/collection.cpp b/tests/collection.cpp index 69aaf42..bb72c03 100644 --- a/tests/collection.cpp +++ b/tests/collection.cpp @@ -140,7 +140,7 @@ Base::Loader::Loader(Base &b): TestCollection::TestCollection() { - add_type().keyword("foo").create(&TestCollection::create_foo); + add_type().keyword("foo").creator(&TestCollection::create_foo); add_type().keyword("bar"); add_type().keyword("sub").store_as(); }