libpniio
|
parser for primitive types More...
#include <parser.hpp>
Public Types | |
typedef ITERT | iterator_type |
iterator type More... | |
typedef T | result_type |
result type of the parsing process More... | |
typedef boost::spirit::qi::expectation_failure < iterator_type > | expectation_error |
parser exception type More... | |
Public Member Functions | |
result_type | operator() (const pni::core::string &data) const |
parser primitive type More... | |
Private Types | |
typedef conversion_trait < result_type > | trait_type |
conversion trait type More... | |
typedef trait_type::read_type | read_type |
type used for reading the data More... | |
Private Attributes | |
get_rule_type< iterator_type, read_type >::type | _rule |
rule which will be used to read the data More... | |
This version of the parser structure provides a default parsing implementation for primitive types. The aim of this class is to hide all the complexity of the boost::spirit::qi parsers. In addition it catches all spirit exceptions and wraps them into a parser_error exception.
Use this parser to parse a single primitive value from a string. The input data must be trimmed - so no leading or trailing blanks are allowed. The string is supposed to end with the last character assembling the value to parse.
By default the output iterator is a const string iterator.
T | primitive data type |
ITERT | iterator type |
typedef boost::spirit::qi::expectation_failure<iterator_type> pni::io::parser< T, ITERT >::expectation_error |
typedef ITERT pni::io::parser< T, ITERT >::iterator_type |
|
private |
typedef T pni::io::parser< T, ITERT >::result_type |
|
private |
|
inline |
Parses the input string and returns an instance of a primitive type. In case of errors parser_error is thrown.
parser_error | in case of any problems |
data | the string with input data |
|
private |