diff --git a/alib2data/src/regexp/formal/FormalRegExp.cpp b/alib2data/src/regexp/formal/FormalRegExp.cpp index 5e89e7de567cd585dddb1deb0ca6ace0afc5615e..812d5a592f5f9d6543526647f6c07f69908c93b9 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.cpp +++ b/alib2data/src/regexp/formal/FormalRegExp.cpp @@ -25,7 +25,7 @@ namespace regexp { -FormalRegExp::FormalRegExp ( std::set < alphabet::Symbol > alphabet, FormalRegExpElement && regExp ) : std::Components < FormalRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), regExp ( NULL ) { +FormalRegExp::FormalRegExp ( std::set < alphabet::Symbol > alphabet, FormalRegExpElement && regExp ) : std::Components2 < FormalRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), regExp ( NULL ) { setRegExp ( std::move ( regExp ) ); } @@ -112,24 +112,6 @@ void FormalRegExp::compose ( std::deque < sax::Token > & out ) const { } /* namespace regexp */ -namespace std { - -template < > -bool regexp::FormalRegExp::Component < regexp::FormalRegExp, alphabet::Symbol, regexp::GeneralAlphabet >::used ( const alphabet::Symbol & symbol ) const { - return static_cast < const regexp::FormalRegExp * > ( this )->getRegExp ( ).testSymbol ( symbol ); -} - -template < > -bool regexp::FormalRegExp::Component < regexp::FormalRegExp, alphabet::Symbol, regexp::GeneralAlphabet >::available ( const alphabet::Symbol & ) const { - return true; -} - -template < > -void regexp::FormalRegExp::Component < regexp::FormalRegExp, alphabet::Symbol, regexp::GeneralAlphabet >::valid ( const alphabet::Symbol & ) const { -} - -} /* namespace std */ - namespace alib { auto formalRegExpParserRegister = xmlApi < regexp::RegExp >::ParserRegister < regexp::FormalRegExp > ( ); diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h index ce5edd54b88538910eee9f2e15804e83ee677dfd..038dc6db5fffa281621f88b3be2952a8cf29e3d4 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.h +++ b/alib2data/src/regexp/formal/FormalRegExp.h @@ -10,7 +10,7 @@ #include <string> #include <set> -#include <core/components.hpp> +#include <core/components2.hpp> #include "../RegExpBase.h" #include "FormalRegExpElement.h" @@ -25,7 +25,7 @@ class GeneralAlphabet; * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. */ -class FormalRegExp : public RegExpBase, public std::Components < FormalRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > { +class FormalRegExp : public RegExpBase, public std::Components2 < FormalRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > { protected: std::smart_ptr < FormalRegExpElement > regExp; @@ -99,4 +99,23 @@ public: } /* namespace regexp */ +namespace std { + +template < > +class ComponentConstraint2< regexp::FormalRegExp, alphabet::Symbol, regexp::GeneralAlphabet > { +public: + static bool used ( const regexp::FormalRegExp & regexp, const alphabet::Symbol & symbol ) { + return regexp.getRegExp ( ).testSymbol ( symbol ); + } + + static bool available ( const regexp::FormalRegExp &, const alphabet::Symbol & ) { + return true; + } + + static void valid ( const regexp::FormalRegExp &, const alphabet::Symbol & ) { + } +}; + +} /* namespace std */ + #endif /* FORMAL_REG_EXP_H_ */ diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp b/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp index 876367453801a9ce617eab5654810b41aa14f940..f8053212a03fb8b923a3717aa87a334ebb80ae95 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.cpp @@ -25,7 +25,7 @@ namespace regexp { -UnboundedRegExp::UnboundedRegExp ( std::set < alphabet::Symbol > alphabet, UnboundedRegExpElement && regExp ) : std::Components < UnboundedRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), regExp ( NULL ) { +UnboundedRegExp::UnboundedRegExp ( std::set < alphabet::Symbol > alphabet, UnboundedRegExpElement && regExp ) : std::Components2 < UnboundedRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), regExp ( NULL ) { setRegExp ( std::move ( regExp ) ); } @@ -112,24 +112,6 @@ void UnboundedRegExp::compose ( std::deque < sax::Token > & out ) const { } /* namespace regexp */ -namespace std { - -template < > -bool regexp::UnboundedRegExp::Component < regexp::UnboundedRegExp, alphabet::Symbol, regexp::GeneralAlphabet >::used ( const alphabet::Symbol & symbol ) const { - return static_cast < const regexp::UnboundedRegExp * > ( this )->getRegExp ( ).testSymbol ( symbol ); -} - -template < > -bool regexp::UnboundedRegExp::Component < regexp::UnboundedRegExp, alphabet::Symbol, regexp::GeneralAlphabet >::available ( const alphabet::Symbol & ) const { - return true; -} - -template < > -void regexp::UnboundedRegExp::Component < regexp::UnboundedRegExp, alphabet::Symbol, regexp::GeneralAlphabet >::valid ( const alphabet::Symbol & ) const { -} - -} /* namespace std */ - namespace alib { auto unboundedRegExpParserRegister = xmlApi < regexp::RegExp >::ParserRegister < regexp::UnboundedRegExp > ( ); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h index 983b8eae927f93bf86304717af9011adb2ab4a99..a8fd79293115dd8feb8499da989acb71ae15deca 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h @@ -10,7 +10,7 @@ #include <string> #include <set> -#include <core/components.hpp> +#include <core/components2.hpp> #include "../RegExpBase.h" #include "UnboundedRegExpElement.h" @@ -25,7 +25,7 @@ class GeneralAlphabet; * Represents regular expression parsed from the XML. Regular expression is stored * as a tree of RegExpElement. */ -class UnboundedRegExp : public RegExpBase, public std::Components < UnboundedRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > { +class UnboundedRegExp : public RegExpBase, public std::Components2 < UnboundedRegExp, alphabet::Symbol, std::tuple < GeneralAlphabet >, std::tuple < > > { protected: std::smart_ptr < UnboundedRegExpElement > regExp; @@ -99,4 +99,23 @@ public: } /* namespace regexp */ +namespace std { + +template < > +class ComponentConstraint2< regexp::UnboundedRegExp, alphabet::Symbol, regexp::GeneralAlphabet > { +public: + static bool used ( const regexp::UnboundedRegExp & regexp, const alphabet::Symbol & symbol ) { + return regexp.getRegExp ( ).testSymbol ( symbol ); + } + + static bool available ( const regexp::UnboundedRegExp &, const alphabet::Symbol & ) { + return true; + } + + static void valid ( const regexp::UnboundedRegExp &, const alphabet::Symbol & ) { + } +}; + +} /* namespace std */ + #endif /* UNBOUNDED_REG_EXP_H_ */