#include <xtl_primary.h>
Public Member Functions | |
template<typename SubstrT > | |
size_t | internal_find (SubstrT &edge_) |
Implements search evaluation grammar evaluation algorithm. | |
template<typename SubstrT > | |
size_t | internal_match (SubstrT &edge_) |
Implements match evaluation grammar evaluation algorithm. | |
xtl_text_entity (StringT const &any_text_) | |
Constructs and initializes the object. | |
xtl_text_entity (typename StringT::value_type const *any_text_) | |
Constructs and initializes the object. |
StringT | specifies type of the encapsulated string. |
Definition at line 2857 of file xtl_primary.h.
cttl_impl::xtl_text_entity< StringT >::xtl_text_entity | ( | typename StringT::value_type const * | any_text_ | ) |
cttl_impl::xtl_text_entity< StringT >::xtl_text_entity | ( | StringT const & | any_text_ | ) |
size_t cttl_impl::xtl_text_entity< StringT >::internal_find | ( | SubstrT & | edge_ | ) |
Implements search evaluation grammar evaluation algorithm.
SubstrT | specifies type of the parseable substring. Can be either cttl::const_edge or cttl::edge . |
edge_ | reference to the parseable substring. |
SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 2941 of file xtl_primary.h.
02942 { 02943 typename SubstrT::string_T const& str = edge_.parent(); 02944 size_t new_offset = str.find_first_of( m_any_text, edge_.first.offset() ); 02945 if ( new_offset != SubstrT::string_T::npos ) { 02946 // successful find 02947 // set find starting position 02948 size_t match_offset = new_offset; 02949 02950 // find ending position 02951 new_offset = str.find_first_not_of( m_any_text, new_offset ); 02952 if ( new_offset == SubstrT::string_T::npos ) 02953 new_offset = str.length(); 02954 02955 // set ending position 02956 edge_.first.offset( new_offset ); 02957 CTTL_TRACE_TEXT_RESULT( true, '$', m_any_text.c_str() ); 02958 return match_offset; 02959 } 02960 02961 CTTL_TRACE_TEXT_RESULT( false, '$', m_any_text.c_str() ); 02962 return SubstrT::string_T::npos; 02963 }
size_t cttl_impl::xtl_text_entity< StringT >::internal_match | ( | SubstrT & | edge_ | ) |
Implements match evaluation grammar evaluation algorithm.
SubstrT | specifies type of the parseable substring. Can be either cttl::const_edge or cttl::edge . |
edge_ | reference to the parseable substring. |
SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 2899 of file xtl_primary.h.
02900 { 02901 typename SubstrT::string_T const& str = edge_.parent(); 02902 if ( m_any_text.find( str[ edge_.first.offset() ] ) != SubstrT::string_T::npos ) { 02903 // successful match 02904 // set match starting position 02905 size_t match_offset = edge_.first.offset(); 02906 02907 // find ending position 02908 size_t new_offset = str.find_first_not_of( m_any_text, edge_.first.offset() ); 02909 if ( new_offset == SubstrT::string_T::npos ) 02910 new_offset = str.length(); 02911 02912 // set match ending position 02913 edge_.first.offset( new_offset ); 02914 CTTL_TRACE_TEXT_RESULT( true, '$', m_any_text.c_str() ); 02915 return match_offset; 02916 } 02917 02918 CTTL_TRACE_TEXT_RESULT( false, '$', m_any_text.c_str() ); 02919 return SubstrT::string_T::npos; 02920 }