diff --git a/alib2str/src/core/stringApi.hpp b/alib2str/src/core/stringApi.hpp index 45bf8e733e6059fe96f6023cb9664f239cdbe1b2..08fef57b35220b5ac7db847cd914cb2121535d3c 100644 --- a/alib2str/src/core/stringApi.hpp +++ b/alib2str/src/core/stringApi.hpp @@ -46,33 +46,27 @@ private: template < class Type > class ReaderRegister < Type, typename std::enable_if < std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupReader { - std::function < Type ( std::istream & ) > parseFunction; - public: - ReaderRegister( ) : parseFunction ( stringApi < Type >::parse ) { - } + ReaderRegister( ) = default; virtual ~ReaderRegister ( ) { } virtual object::Object parse ( std::istream & input ) { - return object::Object ( parseFunction ( input ) ); + return object::Object ( stringApi < Type >::parse ( input ) ); } }; template < class Type > class ReaderRegister < Type, typename std::enable_if < ! std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupReader { - std::function < Type ( std::istream & ) > parseFunction; - public: - ReaderRegister( ) : parseFunction ( stringApi < Type >::parse ) { - } + ReaderRegister( ) = default; virtual ~ReaderRegister ( ) { } virtual object::Object parse ( std::istream & input ) { - return object::Object ( object::AnyObject < Type > ( parseFunction ( input ) ) ); + return object::Object ( object::AnyObject < Type > ( stringApi < Type >::parse ( input ) ) ); } }; @@ -95,33 +89,27 @@ private: template < class Type > class WriterRegister < Type, typename std::enable_if < std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupWriter { - std::function < void ( std::ostream &, const Type & ) > composeFunction; - public: - WriterRegister( ) : composeFunction ( stringApi < Type >::compose ) { - } + WriterRegister( ) = default; virtual ~WriterRegister ( ) { } virtual void compose ( std::ostream & output, const object::Object & group ) { - composeFunction ( output, static_cast < const Type & > ( group.getData ( ) ) ); + stringApi < Type >::compose ( output, static_cast < const Type & > ( group.getData ( ) ) ); } }; template < class Type > class WriterRegister < Type, typename std::enable_if < ! std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupWriter { - std::function < void ( std::ostream &, const Type & ) > composeFunction; - public: - WriterRegister( ) : composeFunction ( stringApi < Type >::compose ) { - } + WriterRegister( ) = default; virtual ~WriterRegister ( ) { } virtual void compose ( std::ostream & output, const object::Object & group ) { - composeFunction ( output, static_cast < const object::AnyObject < Type > & > ( group.getData ( ) ).getData ( ) ); + stringApi < Type >::compose ( output, static_cast < const object::AnyObject < Type > & > ( group.getData ( ) ).getData ( ) ); } }; diff --git a/alib2xml/src/core/xmlApi.hpp b/alib2xml/src/core/xmlApi.hpp index 568fc65a6eaf444320cf60025746923bd57962b9..441aac390306bfd923e2c8315e450f3248c7ebb9 100644 --- a/alib2xml/src/core/xmlApi.hpp +++ b/alib2xml/src/core/xmlApi.hpp @@ -82,34 +82,28 @@ private: template < class Type > class ParserRegister < Type, typename std::enable_if < std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupParser { - std::function < Type ( ext::deque < sax::Token >::iterator & ) > parseFunction; - public: - ParserRegister( ) : parseFunction ( xmlApi < Type >::parse ) { - } + ParserRegister( ) = default; virtual ~ParserRegister( ) { } virtual object::Object parse ( ext::deque < sax::Token >::iterator & input ) { - return object::Object ( parseFunction ( input ) ); + return object::Object ( xmlApi < Type >::parse ( input ) ); } }; template < class Type > class ParserRegister < Type, typename std::enable_if < ! std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupParser { - std::function < Type ( ext::deque < sax::Token >::iterator & ) > parseFunction; - public: - ParserRegister( ) : parseFunction ( xmlApi < Type >::parse ) { - } + ParserRegister( ) = default; virtual ~ParserRegister( ) { } virtual object::Object parse ( ext::deque < sax::Token >::iterator & input ) { - return object::Object ( object::AnyObject < Type > ( parseFunction ( input ) ) ); + return object::Object ( object::AnyObject < Type > ( xmlApi < Type >::parse ( input ) ) ); } }; @@ -133,17 +127,14 @@ private: template < class Type > class ComposerRegister < Type, typename std::enable_if < std::is_base_of < base::CommonBaseBase, Type >::value >::type > : public GroupComposer { - std::function < void ( ext::deque < sax::Token > &, const Type & ) > composeFunction; - public: - ComposerRegister( ) : composeFunction ( xmlApi < Type >::compose ) { - } + ComposerRegister( ) = default; virtual ~ComposerRegister ( ) { } virtual void compose ( ext::deque < sax::Token > & input, const object::Object & group ) { - composeFunction ( input, static_cast < const Type & > ( group.getData ( ) ) ); + xmlApi < Type >::compose ( input, static_cast < const Type & > ( group.getData ( ) ) ); } }; @@ -153,14 +144,13 @@ private: std::function < void ( ext::deque < sax::Token > &, const Type & ) > composeFunction; public: - ComposerRegister( ) : composeFunction ( xmlApi < Type >::compose ) { - } + ComposerRegister( ) = default; virtual ~ComposerRegister ( ) { } virtual void compose ( ext::deque < sax::Token > & input, const object::Object & group ) { - composeFunction ( input, static_cast < const object::AnyObject < Type > & > ( group.getData ( ) ).getData ( ) ); + xmlApi < Type >::compose ( input, static_cast < const object::AnyObject < Type > & > ( group.getData ( ) ).getData ( ) ); } };