cttl_impl::xtl_text_ref_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_ref_begin< StringT >:

cttl_impl::xtl_primary< xtl_text_ref_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_ref_begin (StringT const *str_ptr_)
 Constructs and initializes the object.


Detailed Description

template<typename StringT>
class cttl_impl::xtl_text_ref_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 2162 of file xtl_primary.h.


Constructor & Destructor Documentation

template<typename StringT>
cttl_impl::xtl_text_ref_begin< StringT >::xtl_text_ref_begin ( StringT const *  str_ptr_  ) 

Constructs and initializes the object.

Definition at line 2172 of file xtl_primary.h.

02173         : m_any_text( *str_ptr_ )
02174     {
02175     }


Member Function Documentation

template<typename StringT>
template<typename SubstrT >
size_t cttl_impl::xtl_text_ref_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 2236 of file xtl_primary.h.

02237     {
02238         typename SubstrT::string_T const& str = edge_.parent();
02239         size_t new_offset = str.find_first_of( m_any_text, edge_.first.offset() );
02240         if ( new_offset != SubstrT::string_T::npos ) {
02241             // successful find
02242             // ending position is the same
02243             edge_.first.offset( new_offset );
02244             CTTL_TRACE_TEXT_RESULT( true, '<', m_any_text.c_str() );
02245             return new_offset;
02246         }
02247 
02248         CTTL_TRACE_TEXT_RESULT( false, '<', m_any_text.c_str() );
02249         return SubstrT::string_T::npos;
02250     }

template<typename StringT>
template<typename SubstrT >
size_t cttl_impl::xtl_text_ref_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 2203 of file xtl_primary.h.

02204     {
02205         typename SubstrT::string_T const& str = edge_.parent();
02206         if ( m_any_text.find( str[ edge_.first.offset() ] ) != SubstrT::string_T::npos ) {
02207             // successful match
02208             // ending position is current
02209             CTTL_TRACE_TEXT_RESULT( true, '<', m_any_text.c_str() );
02210             return edge_.first.offset();
02211         }
02212 
02213         CTTL_TRACE_TEXT_RESULT( false, '<', m_any_text.c_str() );
02214         return SubstrT::string_T::npos;
02215     }


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

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