]> git.tdb.fi Git - libs/datafile.git/commitdiff
Add missing virtual destructor to Collection::ItemKeywordBase
authorMikko Rasa <tdb@tdb.fi>
Thu, 27 Dec 2007 17:07:35 +0000 (17:07 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 27 Dec 2007 17:07:35 +0000 (17:07 +0000)
Add Loader::finish() to handle finishing actions in an exception-safe way

source/collection.h
source/loader.cpp
source/loader.h

index f293428c8cdd0fc046019531335ccf6d28b525fc..303697a8c726f7c71e99c3a8d8e6582be998b87b 100644 (file)
@@ -72,6 +72,7 @@ private:
        */
        struct ItemKeywordBase
        {
+               virtual ~ItemKeywordBase() { }
                virtual void add_to_loader(Loader &) const { };
        };
 
index 67668cdea1f5bc52b76c7c02c401fda501d9531e..284588afde9fba1462d4808d9891f49569b9c650 100644 (file)
@@ -16,6 +16,7 @@ void Loader::load(const Statement &st)
 {
        for(list<Statement>::const_iterator i=st.sub.begin(); i!=st.sub.end(); ++i)
                load_statement(*i);
+       finish();
 }
 
 void Loader::load(Parser &p)
@@ -26,6 +27,7 @@ void Loader::load(Parser &p)
                if(st.valid)
                        load_statement(st);
        }
+       finish();
 }
 
 Loader::~Loader()
index 951eeb0d2337f9ce2793fabe294a674c915ac34e..749c1047cd1a762084adb91d37956671fe8d6745 100644 (file)
@@ -343,6 +343,8 @@ protected:
                        throw InvalidState("get_source called without current statement");
                return cur_st->source;
        }
+
+       virtual void finish() { }
 private:
        typedef std::map<std::string, LoaderAction *> ActionMap;