X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Floaderaction.h;h=4666687e71534fd15d63499898ce9217250f4ee9;hb=256b44a5009467171af53316141277027bcc0ba4;hp=a3b04437d279e3e6835bd20538d2c99311721064;hpb=b0186e8878204a29e25ca4063c1dac4dea908508;p=libs%2Fdatafile.git diff --git a/source/loaderaction.h b/source/loaderaction.h index a3b0443..4666687 100644 --- a/source/loaderaction.h +++ b/source/loaderaction.h @@ -8,7 +8,6 @@ namespace Msp { namespace DataFile { -#if __cplusplus>=201103L template std::string create_signature(const std::string &prefix = std::string()) { return prefix+std::string(1, TypeInfo::signature); } @@ -16,7 +15,6 @@ std::string create_signature(const std::string &prefix = std::string()) template std::string create_signature(const std::string &prefix = std::string()) { return create_signature(prefix+std::string(1, TypeInfo::signature)); } -#endif class Loader; @@ -115,8 +113,8 @@ public: { std::vector values; values.reserve(st.args.size()); - for(Statement::Arguments::const_iterator i=st.args.begin(); i!=st.args.end(); ++i) - values.push_back(i->get()); + for(const Value &a: st.args) + values.push_back(a.get()); (dynamic_cast(l).*func)(values); } @@ -169,137 +167,6 @@ public: }; -template -class LoaderFunc2: public LoaderAction -{ -private: - typedef void (L::*FuncType)(A0, A1); - - FuncType func; - -public: - LoaderFunc2(FuncType f): func(f) { } - - virtual void execute(Loader &l, const Statement &st) const - { - (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get()); - } - - virtual void execute(Loader &l, const ArgumentStore &as) const - { - (dynamic_cast(l).*func)(as.get(0), as.get(1)); - } - - virtual std::string get_signature() const - { - std::string result; - result += TypeInfo::signature; - result += TypeInfo::signature; - return result; - } -}; - - -template -class LoaderFunc3: public LoaderAction -{ -private: - typedef void (L::*FuncType)(A0, A1, A2); - - FuncType func; - -public: - LoaderFunc3(FuncType f): func(f) { } - - virtual void execute(Loader &l, const Statement &st) const - { - (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get()); - } - - virtual void execute(Loader &l, const ArgumentStore &as) const - { - (dynamic_cast(l).*func)(as.get(0), as.get(1), as.get(2)); - } - - virtual std::string get_signature() const - { - std::string result; - result += TypeInfo::signature; - result += TypeInfo::signature; - result += TypeInfo::signature; - return result; - } -}; - - -template -class LoaderFunc4: public LoaderAction -{ -private: - typedef void (L::*FuncType)(A0, A1, A2, A3); - - FuncType func; - -public: - LoaderFunc4(FuncType f): func(f) { } - - virtual void execute(Loader &l, const Statement &st) const - { - (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get(), st.args[3].get()); - } - - virtual void execute(Loader &l, const ArgumentStore &as) const - { - (dynamic_cast(l).*func)(as.get(0), as.get(1), as.get(2), as.get(3)); - } - - virtual std::string get_signature() const - { - std::string result; - result += TypeInfo::signature; - result += TypeInfo::signature; - result += TypeInfo::signature; - result += TypeInfo::signature; - return result; - } -}; - - -template -class LoaderFunc5: public LoaderAction -{ -private: - typedef void (L::*FuncType)(A0, A1, A2, A3, A4); - - FuncType func; - -public: - LoaderFunc5(FuncType f): func(f) { } - - virtual void execute(Loader &l, const Statement &st) const - { - (dynamic_cast(l).*func)(st.args[0].get(), st.args[1].get(), st.args[2].get(), st.args[3].get(), st.args[4].get()); - } - - virtual void execute(Loader &l, const ArgumentStore &as) const - { - (dynamic_cast(l).*func)(as.get(0), as.get(1), as.get(2), as.get(3), as.get(4)); - } - - virtual std::string get_signature() const - { - std::string result; - result += TypeInfo::signature; - result += TypeInfo::signature; - result += TypeInfo::signature; - result += TypeInfo::signature; - result += TypeInfo::signature; - return result; - } -}; - - -#if __cplusplus>=201103L template struct Apply; @@ -367,7 +234,7 @@ class LoaderFuncNBound1: public LoaderAction { protected: typedef void (L::*FuncType)(B0, Args...); - typedef typename RemoveReference::Type Bound0Type; + typedef typename std::remove_reference::type Bound0Type; FuncType func; Bound0Type bound0; @@ -388,7 +255,6 @@ public: virtual std::string get_signature() const { return create_signature(); } }; -#endif template