From: Mikko Rasa Date: Sun, 29 Aug 2021 10:29:29 +0000 (+0300) Subject: Require C++11 for building X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9c95942d24a92abea14bb9e11d33daae2d017321;p=libs%2Fdatafile.git Require C++11 for building --- diff --git a/Build b/Build index 147d82f..d934f3f 100644 --- a/Build +++ b/Build @@ -6,6 +6,11 @@ package "mspdatafile" require "mspcore"; require "sigc++-2.0"; + build_info + { + standard CXX "c++11"; + }; + library "mspdatafile" { source "source"; diff --git a/source/loader.h b/source/loader.h index cf2b545..574ecce 100644 --- a/source/loader.h +++ b/source/loader.h @@ -108,36 +108,15 @@ protected: void add(const std::string &k, void (L::*func)(A0)) { add(k, new LoaderFunc1(func)); } -#if __cplusplus>=201103L template void add(const std::string &k, void (L::*func)(Args...)) { add(k, new LoaderFuncN(func)); } -#else - template - void add(const std::string &k, void (L::*func)(A0, A1)) - { add(k, new LoaderFunc2(func)); } - - template - void add(const std::string &k, void (L::*func)(A0, A1, A2)) - { add(k, new LoaderFunc3(func)); } - - template - void add(const std::string &k, void (L::*func)(A0, A1, A2, A3)) - { add(k, new LoaderFunc4(func)); } - - template - void add(const std::string &k, void (L::*func)(A0, A1, A2, A3, A4)) - { add(k, new LoaderFunc5(func)); } -#endif - -#if __cplusplus>=201103L /** Adds a keyword that is loaded by calling a function with a bound first argument. */ template void add(const std::string &k, void (L::*func)(B0, Args...), const typename RemoveReference::Type &b0) { add(k, new LoaderFuncNBound1(func, b0)); } -#endif /** Adds a keyword that is loaded into a member of the loaded object. */ template @@ -176,7 +155,6 @@ protected: }; -#if __cplusplus>=201103L /** Loads an object from a file. The object must have a public Loader class. Any extra arguments are passed to the Loader constructor. @@ -224,36 +202,6 @@ typename EnableIf::value, void>::No load(T & loader.load(parser); } -#else - -/** -Loads an object from a file. The object must have a public Loader class. -*/ -template -void load(T &obj, const std::string &fn) -{ - IO::BufferedFile in(fn); - - Parser parser(in, fn); - typename T::Loader loader(obj); - loader.load(parser); -} - -/** -Loads an object from a file, passing one extra argument to the Loader -constructor. The object must have a public Loader class. -*/ -template -void load(T &obj, const std::string &fn, U &arg) -{ - IO::BufferedFile in(fn); - - Parser parser(in, fn); - typename T::Loader loader(obj, arg); - loader.load(parser); -} -#endif - } // namespace DataFile } // namespace Msp diff --git a/source/loaderaction.h b/source/loaderaction.h index a3b0443..c7c5938 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; @@ -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; @@ -388,7 +255,6 @@ public: virtual std::string get_signature() const { return create_signature(); } }; -#endif template