| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

iter_pos.hpp
Go to the documentation of this file.
1 // Copyright (c) 2001-2010 Hartmut Kaiser
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #if !defined(BOOST_SPIRIT_REPOSITORY_QI_ITER_POS_NOV_20_2009_1245PM)
7 #define BOOST_SPIRIT_REPOSITORY_QI_ITER_POS_NOV_20_2009_1245PM
8
9 #include <boost/spirit/include/qi_parse.hpp>
10
12 // definition the place holder
13 namespace boost { namespace spirit { namespace repository { namespace qi
14 {
15 BOOST_SPIRIT_TERMINAL(iter_pos)
16 }}}}
17
19 // implementation the enabler
20 namespace boost { namespace spirit
21 {
22 // We want custom_parser::iter_pos to be usable as a terminal only,
23 // and only for parser expressions (qi::domain).
24 template <>
25 struct use_terminal<qi::domain, repository::qi::tag::iter_pos>
26 : mpl::true_
27 {};
28 }}
29
31 // implementation of the parser
32 namespace boost { namespace spirit { namespace repository { namespace qi
33 {
34 struct iter_pos_parser
35 : boost::spirit::qi::primitive_parser<iter_pos_parser>
36 {
37 // Define the attribute type exposed by this parser component
38 template <typename Context, typename Iterator>
39 struct attribute
40 {
41 typedef Iterator type;
42 };
43
44 // This function is called during the actual parsing process
45 template <typename Iterator, typename Context
46 , typename Skipper, typename Attribute>
47 bool parse(Iterator& first, Iterator const& last
48 , Context&, Skipper const& skipper, Attribute& attr) const
49 {
50 boost::spirit::qi::skip_over(first, last, skipper);
51 boost::spirit::traits::assign_to(first, attr);
52 return true;
53 }
54
55 // This function is called during error handling to create
56 // a human readable string for the error context.
57 template <typename Context>
58 boost::spirit::info what(Context&) const
59 {
60 return boost::spirit::info("iter_pos");
61 }
62 };
63 }}}}
64
66 // instantiation of the parser
67 namespace boost { namespace spirit { namespace qi
68 {
69 // This is the factory function object invoked in order to create
70 // an instance of our iter_pos_parser.
71 template <typename Modifiers>
72 struct make_primitive<repository::qi::tag::iter_pos, Modifiers>
73 {
74 typedef repository::qi::iter_pos_parser result_type;
75
76 result_type operator()(unused_type, unused_type) const
77 {
78 return result_type();
79 }
80 };
81 }}}
82
83 #endif
boost
The namespace threadpool contains a thread pool and related utility classes.
Definition: iter_pos.hpp:13
Gaudi::Parsers::Skipper
SkipperGrammar< IteratorT > Skipper
Definition: ParsersFactory.h:30
boost::spirit::repository::qi::iter_pos_parser::attribute
Definition: iter_pos.hpp:39
boost::spirit::qi::make_primitive< repository::qi::tag::iter_pos, Modifiers >::operator()
result_type operator()(unused_type, unused_type) const
Definition: iter_pos.hpp:76
boost::spirit::qi::make_primitive< repository::qi::tag::iter_pos, Modifiers >::result_type
repository::qi::iter_pos_parser result_type
Definition: iter_pos.hpp:74
boost::spirit::repository::qi::iter_pos_parser::attribute::type
Iterator type
Definition: iter_pos.hpp:41
Iterator
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18
boost::spirit::repository::qi::iter_pos_parser::what
boost::spirit::info what(Context &) const
Definition: iter_pos.hpp:58
boost::spirit::repository::qi::iter_pos_parser
Definition: iter_pos.hpp:34
boost::spirit::repository::qi::iter_pos_parser::parse
bool parse(Iterator &first, Iterator const &last, Context &, Skipper const &skipper, Attribute &attr) const
Definition: iter_pos.hpp:47