cttl_impl::xtl_text_begin< StringT > Class Template Reference

Implements behavior of begin(text), upper boundary of the user-defined multi-character entity lexeme inside CTTL grammar expression. More...

#include <xtl_primary.h>

Inheritance diagram for cttl_impl::xtl_text_begin< StringT >:

cttl_impl::xtl_primary< xtl_text_begin< StringT > >

List of all members.

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_begin (StringT const &any_text_)
 Constructs and initializes the object.


Detailed Description

template<typename StringT>
class cttl_impl::xtl_text_begin< StringT >

Implements behavior of begin(text), upper boundary of the user-defined multi-character entity lexeme inside CTTL grammar expression.

Template Parameters:
StringT specifies type of the encapsulated string.

Definition at line 2063 of file xtl_primary.h.


Constructor & Destructor Documentation

template<typename StringT >
cttl_impl::xtl_text_begin< StringT >::xtl_text_begin ( StringT const &  any_text_  ) 

Constructs and initializes the object.

Definition at line 2073 of file xtl_primary.h.

02074         : m_any_text( any_text_ )
02075     {
02076     }


Member Function Documentation

template<typename StringT >
template<typename SubstrT >
size_t cttl_impl::xtl_text_begin< StringT >::internal_find ( SubstrT &  edge_  ) 

Implements search evaluation grammar evaluation algorithm.

Template Parameters:
SubstrT specifies type of the parseable substring. Can be either cttl::const_edge or cttl::edge.
Parameters:
edge_ reference to the parseable substring.
Returns:
evaluation result: if algorithm succeeds, it returns absolute offset corresponding to the upper boundary of the matched text. Otherwise, it returns SubstrT::string_T::npos, indicating that the evaluation algorithm has failed.

Definition at line 2132 of file xtl_primary.h.

02133     {
02134         typename SubstrT::string_T const& str = edge_.parent();
02135         size_t new_offset = str.find_first_of( m_any_text, edge_.first.offset() );
02136         if ( new_offset != SubstrT::string_T::npos ) {
02137             // successful find
02138             // ending position is the same
02139             edge_.first.offset( new_offset );
02140             CTTL_TRACE_TEXT_RESULT( true, '<', m_any_text.c_str() );
02141             return new_offset;
02142         }
02143 
02144         CTTL_TRACE_TEXT_RESULT( false, '<', m_any_text.c_str() );
02145         return SubstrT::string_T::npos;
02146     }

template<typename StringT >
template<typename SubstrT >
size_t cttl_impl::xtl_text_begin< StringT >::internal_match ( SubstrT &  edge_  ) 

Implements match evaluation grammar evaluation algorithm.

Template Parameters:
SubstrT specifies type of the parseable substring. Can be either cttl::const_edge or cttl::edge.
Parameters:
edge_ reference to the parseable substring.
Returns:
evaluation result: if algorithm succeeds, it returns absolute offset corresponding to the upper boundary of the matched text. Otherwise, it returns SubstrT::string_T::npos, indicating that the evaluation algorithm has failed.

Definition at line 2099 of file xtl_primary.h.

02100     {
02101         typename SubstrT::string_T const& str = edge_.parent();
02102         if ( m_any_text.find( str[ edge_.first.offset() ] ) != SubstrT::string_T::npos ) {
02103             // successful match
02104             // ending position is the same
02105             CTTL_TRACE_TEXT_RESULT( true, '<', m_any_text.c_str() );
02106             return edge_.first.offset();
02107         }
02108 
02109         CTTL_TRACE_TEXT_RESULT( false, '<', m_any_text.c_str() );
02110         return SubstrT::string_T::npos;
02111     }


The documentation for this class was generated from the following file:

Generated on Sun Aug 23 13:43:47 2009 for Common Text Transformation Library by  doxygen 1.5.9