Skip to content
Snippets Groups Projects
Commit 037e5192 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

update regexps to components2

parent e9ddc18d
No related branches found
No related tags found
No related merge requests found
......@@ -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 > ( );
......
......@@ -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_ */
......@@ -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 > ( );
......
......@@ -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_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment