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

slice parser More...

#include <slice_rule.hpp>

Inheritance diagram for pni::io::slice_rule< ITERT >:
Inheritance graph
[legend]
Collaboration diagram for pni::io::slice_rule< ITERT >:
Collaboration graph
[legend]

Public Member Functions

 slice_rule ()
 default constructor More...
 

Data Fields

boost::spirit::qi::rule< ITERT,
boost::spirit::qi::locals
< size_t, size_t, size_t >
, pni::core::slice() > 
slice_
 rule to parse a slice string More...
 

Detailed Description

template<typename ITERT>
struct pni::io::slice_rule< ITERT >

This parser reads slice objects from a string. A slice is represented by three numbers: the start index, the last index, and a stride. In string representation these three values are written as

start:stop:stride

where a : is used as separator between the numbers. There are several flavors of strings that can be used to denote a slice

This parser is capable of managing all these variations. It can be used like this

typedef string::iterator iterator_t;
typedef slice_parser<iterator_t> parser_t;
string slice_str = "1:100:2";
slice s;
parser_t parser; //generate a parser instance
parse(slice_str.begin(),slice_str.end(),parser,s);
Template Parameters
ITERTiterator type for the parser

Constructor & Destructor Documentation

template<typename ITERT >
pni::io::slice_rule< ITERT >::slice_rule ( )
inline

Field Documentation

template<typename ITERT >
boost::spirit::qi::rule<ITERT, boost::spirit::qi::locals<size_t,size_t,size_t>, pni::core::slice() > pni::io::slice_rule< ITERT >::slice_

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