libpniio
Public Member Functions | Data Fields
pni::io::string_sequence_rule< ITERT, ST > Struct Template Reference

container parser More...

#include <string_sequence_rule.hpp>

Inheritance diagram for pni::io::string_sequence_rule< ITERT, ST >:
Inheritance graph
[legend]
Collaboration diagram for pni::io::string_sequence_rule< ITERT, ST >:
Collaboration graph
[legend]

Public Member Functions

 string_sequence_rule ()
 default constructor More...
 
 string_sequence_rule (char del)
 constructor More...
 
 string_sequence_rule (char start, char stop)
 constructor More...
 
 string_sequence_rule (char start, char stop, char del)
 constructor More...
 

Data Fields

boost::spirit::qi::rule< ITERT,
pni::core::string()> 
element_rule_
 rule to parse a single element of the sequence More...
 
boost::spirit::qi::rule< ITERT > start_
 rule for the start symbol of the sequence More...
 
boost::spirit::qi::rule< ITERT > stop_
 rule for the stop symbol for the sequence More...
 
boost::spirit::qi::rule< ITERT > delimiter_
 rule for the delimiter symbol for the sequence More...
 
boost::spirit::qi::rule< ITERT,
ST()> 
sequence_
 the full rule to parse the sequence More...
 
boost::phoenix::function
< trim_string
trim
 lazy function to trim the read string More...
 

Detailed Description

template<typename ITERT, typename ST>
struct pni::io::string_sequence_rule< ITERT, ST >

This parser reads a linear container of data from a string. The data type of the container is assumed to be homogeneous. This means that all elements must match with the parser selected for the element type.

In their string representation container data is assumed to be embraced between a start and a stop token. The elements are assumed to be separated by a delimiter token.

The container can be any STL compliant container type.

Template Parameters
ITERTinput iterator type
STcontainer type

Constructor & Destructor Documentation

template<typename ITERT , typename ST >
pni::io::string_sequence_rule< ITERT, ST >::string_sequence_rule ( )
inline

When using the default constructor the elements are assumed to be separated by an arbitrary number of blanks. No start and stop symbol are taken into account.

template<typename ITERT , typename ST >
pni::io::string_sequence_rule< ITERT, ST >::string_sequence_rule ( char  del)
inline

This version of the sequence_rule constructor allows passing a a custom delimiter symbol. The delimiter_rule class is used to parse the delimiter. Thus, the delimiter symbol can have an arbitrary number of preceding and tailing blanks.

Parameters
deldelimiter character for the sequence
template<typename ITERT , typename ST >
pni::io::string_sequence_rule< ITERT, ST >::string_sequence_rule ( char  start,
char  stop 
)
inline

Set a start and stop symbol. In this case the rule expects that the sequence is embraced into a start and stop symbol. However, the individual elements are still separated by an arbitrary number of blanks.

Parameters
startthe start symbol for the sequence
stopthe stop symbol for the sequence
template<typename ITERT , typename ST >
pni::io::string_sequence_rule< ITERT, ST >::string_sequence_rule ( char  start,
char  stop,
char  del 
)
inline

Customizes the start and stop symbol as well as the delimiter symbol.

Parameters
startthe start symbol for the sequence
stopthe stop symbol for the sequence
delthe delimiter symbol for the sequence

Field Documentation

template<typename ITERT , typename ST >
boost::spirit::qi::rule<ITERT> pni::io::string_sequence_rule< ITERT, ST >::delimiter_
template<typename ITERT , typename ST >
boost::spirit::qi::rule<ITERT,pni::core::string()> pni::io::string_sequence_rule< ITERT, ST >::element_rule_
template<typename ITERT , typename ST >
boost::spirit::qi::rule<ITERT,ST()> pni::io::string_sequence_rule< ITERT, ST >::sequence_
template<typename ITERT , typename ST >
boost::spirit::qi::rule<ITERT> pni::io::string_sequence_rule< ITERT, ST >::start_
template<typename ITERT , typename ST >
boost::spirit::qi::rule<ITERT> pni::io::string_sequence_rule< ITERT, ST >::stop_
template<typename ITERT , typename ST >
boost::phoenix::function<trim_string> pni::io::string_sequence_rule< ITERT, ST >::trim

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