Recursive data structure to allow efficient parsing of various strings. More...
#include <string_parse_tree.hpp>
Public Types | |
typedef std::multimap< charT, string_parse_tree > | ptree_coll |
typedef ptree_coll::value_type | value_type |
typedef ptree_coll::iterator | iterator |
typedef ptree_coll::const_iterator | const_iterator |
typedef std::basic_string< charT > | string_type |
typedef std::vector < std::basic_string< charT > > | collection_type |
typedef parse_match_result< charT > | parse_match_result_type |
Public Member Functions | |
string_parse_tree (collection_type names, unsigned int starting_point=0) | |
Parameter "starting_point" designates where the numbering begins. More... | |
string_parse_tree (short value=-1) | |
void | insert (const string_type &s, unsigned short value) |
short | match (std::istreambuf_iterator< charT > &sitr, std::istreambuf_iterator< charT > &stream_end, parse_match_result_type &result, unsigned int &level) const |
Recursive function that finds a matching string in the tree. More... | |
parse_match_result_type | match (std::istreambuf_iterator< charT > &sitr, std::istreambuf_iterator< charT > &stream_end) const |
Must check match_results::has_remaining() after match() is called. More... | |
void | printme (std::ostream &os, int &level) |
void | print (std::ostream &os) |
void | printmatch (std::ostream &os, charT c) |
Public Attributes | |
ptree_coll | m_next_chars |
short | m_value |
Recursive data structure to allow efficient parsing of various strings.
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.
typedef std::vector<std::basic_string<charT> > boost::date_time::string_parse_tree< charT >::collection_type |
typedef ptree_coll::const_iterator boost::date_time::string_parse_tree< charT >::const_iterator |
typedef ptree_coll::iterator boost::date_time::string_parse_tree< charT >::iterator |
typedef parse_match_result<charT> boost::date_time::string_parse_tree< charT >::parse_match_result_type |
typedef std::multimap<charT, string_parse_tree > boost::date_time::string_parse_tree< charT >::ptree_coll |
typedef std::basic_string<charT> boost::date_time::string_parse_tree< charT >::string_type |
typedef ptree_coll::value_type boost::date_time::string_parse_tree< charT >::value_type |
|
inline |
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
|
inline |
|
inline |
|
inline |
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.
Referenced by boost::date_time::date_generator_parser< time_type::date_type, CharT >::get_nth_kday_type(), boost::date_time::special_values_parser< time_type::date_type, CharT >::match(), boost::date_time::string_parse_tree< CharT >::match(), boost::date_time::format_date_parser< time_type::date_type, CharT >::parse_date(), boost::date_time::format_date_parser< time_type::date_type, CharT >::parse_month(), and boost::date_time::format_date_parser< time_type::date_type, CharT >::parse_weekday().
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by boost::date_time::string_parse_tree< CharT >::print().
ptree_coll boost::date_time::string_parse_tree< charT >::m_next_chars |
short boost::date_time::string_parse_tree< charT >::m_value |