X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Floader.cpp;h=de9323a36269ebc51656c75e1c771a1f169bb706;hb=e2a4cefe59dd3e6e1b2fac2fb7232326bb2b0787;hp=6da8599ba550e373828ea96af9bd81942216180c;hpb=3eb3c5cce35d3d6193afadecc3707f9c2448f370;p=libs%2Fdatafile.git diff --git a/source/loader.cpp b/source/loader.cpp index 6da8599..de9323a 100644 --- a/source/loader.cpp +++ b/source/loader.cpp @@ -51,6 +51,12 @@ bool signature_match(const string &st_sig, const string &act_sig) namespace Msp { namespace DataFile { +Loader::Loader(): + cur_st(0), + allow_pointer_reload(true), + check_sub_loads(false) +{ } + Loader::~Loader() { for(ActionMap::iterator i = actions.begin(); i!=actions.end(); ++i) @@ -83,7 +89,12 @@ void Loader::load_statement(const Statement &st) { LoaderAction *act = find_action(ActionKey(st.keyword, st.get_signature())); if(act) + { + sub_loaded = false; act->execute(*this, st); + if(check_sub_loads && !st.sub.empty() && !sub_loaded) + throw Exception("Substatements were not loaded"); + } } catch(Exception &e) { @@ -103,6 +114,7 @@ void Loader::load_sub_with(Loader &ldr) throw InvalidState("load_sub called without current statement"); ldr.load(*cur_st); + sub_loaded = true; } void Loader::add(const string &kwd, LoaderAction *act)