X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Floaderaction.h;h=03a9da7bcc1aa8fc33823f404a0426f704aaeaed;hb=e2a4cefe59dd3e6e1b2fac2fb7232326bb2b0787;hp=cfbe281f399c4071df30e12b17f53f6d99843d18;hpb=3eb3c5cce35d3d6193afadecc3707f9c2448f370;p=libs%2Fdatafile.git diff --git a/source/loaderaction.h b/source/loaderaction.h index cfbe281..03a9da7 100644 --- a/source/loaderaction.h +++ b/source/loaderaction.h @@ -47,9 +47,8 @@ private: public: LoaderFunc0(FuncType f): func(f) { } - virtual void execute(Loader &l, const Statement &st) const + virtual void execute(Loader &l, const Statement &) const { - if(st.args.size()!=0) throw TypeError("Wrong number of arguments"); (dynamic_cast(l).*func)(); }; @@ -74,7 +73,6 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=1) throw TypeError("Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get()); } @@ -153,7 +151,6 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=2) throw TypeError("Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get()); } @@ -180,7 +177,6 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=3) throw TypeError("Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get()); } @@ -208,7 +204,6 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=4) throw TypeError("Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get(), st.args[3].get()); } @@ -237,7 +232,6 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=5) throw TypeError("Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get(), st.args[3].get(), st.args[4].get()); } @@ -267,8 +261,7 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=1) throw TypeError("Wrong number of arguments"); - dynamic_cast(l).get_object().*ptr0=st.args[0].get(); + dynamic_cast(l).get_object().*ptr0 = st.args[0].get(); } virtual std::string get_signature() const @@ -289,9 +282,10 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=1) throw TypeError("Wrong number of arguments"); - typename L::Loader &ldr=dynamic_cast(l); - ldr.get_object().*ptr0=ldr.get_collection().template get(st.args[0].get()); + typename L::Loader &ldr = dynamic_cast(l); + if(!ldr.is_pointer_reload_allowed() && ldr.get_object().*ptr0) + throw InvalidState("The pointer has already been loaded"); + ldr.get_object().*ptr0 = ldr.get_collection().template get(st.args[0].get()); } virtual std::string get_signature() const @@ -314,9 +308,8 @@ public: virtual void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=2) throw TypeError("Wrong number of arguments"); - dynamic_cast(l).get_object().*ptr0=st.args[0].get(); - dynamic_cast(l).get_object().*ptr1=st.args[1].get(); + dynamic_cast(l).get_object().*ptr0 = st.args[0].get(); + dynamic_cast(l).get_object().*ptr1 = st.args[1].get(); } virtual std::string get_signature() const