X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Floader.h;h=39a50d0b7fe4a56b88a28ec1be68c82e78ed0d5e;hb=9094bc6a657e5587e7e17827c35e3fd388fb91ec;hp=c6936f96f6eef5869f62ffe3ed9307f34038dd2c;hpb=47597fd1b0b11c915466dd7f3f1281906442377c;p=libs%2Fdatafile.git diff --git a/source/loader.h b/source/loader.h index c6936f9..39a50d0 100644 --- a/source/loader.h +++ b/source/loader.h @@ -8,7 +8,7 @@ Distributed under the LGPL #include #include -#include +#include "error.h" #include "parser.h" #include "statement.h" #include "value.h" @@ -37,7 +37,7 @@ public: LoaderFunc0(FuncType f): func(f) { } void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=0) throw TypeError("Wrong number of arguments"); + if(st.args.size()!=0) throw TypeError(st.get_location()+": Wrong number of arguments"); (dynamic_cast(l).*func)(); }; private: @@ -53,7 +53,7 @@ public: LoaderFunc1(FuncType f): func(f) { } void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=1) throw TypeError("Wrong number of arguments"); + if(st.args.size()!=1) throw TypeError(st.get_location()+": Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get()); } private: @@ -69,7 +69,7 @@ public: LoaderFunc2(FuncType f): func(f) { } void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=2) throw TypeError("Wrong number of arguments"); + if(st.args.size()!=2) throw TypeError(st.get_location()+": Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get()); } private: @@ -85,7 +85,7 @@ public: LoaderFunc3(FuncType f): func(f) { } void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=3) throw TypeError("Wrong number of arguments"); + if(st.args.size()!=3) throw TypeError(st.get_location()+": Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get()); } private: @@ -101,7 +101,7 @@ public: LoaderFunc4(FuncType f): func(f) { } void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=4) throw TypeError("Wrong number of arguments"); + if(st.args.size()!=4) throw TypeError(st.get_location()+": Wrong number of arguments"); (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get(), st.args[3].get()); } private: @@ -117,7 +117,7 @@ public: LoadValue(PointerType p): ptr(p) { } void execute(Loader &l, const Statement &st) const { - if(st.args.size()!=1) throw TypeError("Wrong number of arguments"); + if(st.args.size()!=1) throw TypeError(st.get_location()+": Wrong number of arguments"); dynamic_cast(l).get_object().*ptr=st.args[0].get(); } private: