Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template string_parse_tree

boost::date_time::string_parse_tree — Recursive data structure to allow efficient parsing of various strings.

Synopsis

// In header: <boost/date_time/string_parse_tree.hpp>

template<typename charT> 
struct string_parse_tree {
  // types
  typedef string_parse_tree<  ;             
  typedef string_parse_tree >          ;             
  typedef                              ;             
  typedef                                ;               
  typedef                          ;         
  typedef                          ;            
  typedef           ;        
  typedef parse_match_result<                         ;

  // construct/copy/destruct
  (,  = );
  ( = );

  // public member functions
   (, );
   (, 
              , parse_match_result_type &, 
              ) ;
  parse_match_result_type 
  (, 
        ) ;
   (, );
   ();
   (, );

  // public data members
   m_next_chars;
   m_value;
};

Description

This class provides a quick lookup by building what amounts to a tree data structure. It also features a match function which can can handle nasty input interators by caching values as it recurses the tree so that it can backtrack as needed.

string_parse_tree public construct/copy/destruct

  1. ( names,  starting_point = );

    Parameter "starting_point" designates where the numbering begins. A starting_point of zero will start the numbering at zero (Sun=0, Mon=1, ...) were a starting_point of one starts the numbering at one (Jan=1, Feb=2, ...). The default is zero, negative vaules are not allowed

  2. ( value = );

string_parse_tree public member functions

  1.  ( s,  value);
  2.  ( sitr, 
                 stream_end, 
                parse_match_result_type & result,  level) ;
    Recursive function that finds a matching string in the tree.

    Must check match_results::has_remaining() after match() is called. This is required so the user can determine if stream iterator is already pointing to the expected character or not (match() might advance sitr to next char in stream).

    A parse_match_result that has been returned from a failed match attempt can be sent in to the match function of a different string_parse_tree to attempt a match there. Use the iterators for the partially consumed stream, the parse_match_result object, and '0' for the level parameter.

  3. parse_match_result_type 
    ( sitr, 
           stream_end) ;

    Must check match_results::has_remaining() after match() is called. This is required so the user can determine if stream iterator is already pointing to the expected character or not (match() might advance sitr to next char in stream).

  4.  ( os,  level);
  5.  ( os);
  6.  ( os,  c);

PrevUpHomeNext