TraDemGen Logo  1.00.0
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
BasParserTypes.hpp
Go to the documentation of this file.
1 #ifndef __TRADEMGEN_BAS_BASCOMPARSERTYPES_HPP
2 #define __TRADEMGEN_BAS_BASCOMPARSERTYPES_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <string>
9 // Boost
10 //#define BOOST_SPIRIT_DEBUG
11 #include <boost/spirit/home/classic/core.hpp>
12 //#include <boost/spirit/home/classic/attribute.hpp>
13 //#include <boost/spirit/home/classic/utility/functor_parser.hpp>
14 #include <boost/spirit/home/classic/utility/loops.hpp>
15 #include <boost/spirit/home/classic/utility/chset.hpp>
16 #include <boost/spirit/home/classic/utility/confix.hpp>
17 #include <boost/spirit/home/classic/iterator/file_iterator.hpp>
18 //#include <boost/spirit/home/classic/actor/push_back_actor.hpp>
19 //#include <boost/spirit/home/classic/actor/assign_actor.hpp>
20 
21 namespace TRADEMGEN {
22 
23  // ///////////////////////////////////////////////////////////////////////
24  //
25  // Definition of Basic Types
26  //
27  // ///////////////////////////////////////////////////////////////////////
28  // For a file, the parsing unit is the character (char). For a string,
29  // it is a "char const *".
30  // typedef char const* iterator_t;
31  typedef char char_t;
32 
33  // The types of iterator, scanner and rule are then derived from
34  // the parsing unit.
35  typedef boost::spirit::classic::file_iterator<char_t> iterator_t;
36  typedef boost::spirit::classic::scanner<iterator_t> scanner_t;
37  typedef boost::spirit::classic::rule<scanner_t> rule_t;
38 
39  // ///////////////////////////////////////////////////////////////////////
40  //
41  // Parser related types
42  //
43  // ///////////////////////////////////////////////////////////////////////
45  typedef boost::spirit::classic::int_parser<unsigned int, 10, 1, 1> int1_p_t;
46 
48  typedef boost::spirit::classic::uint_parser<unsigned int, 10, 2, 2> uint2_p_t;
49 
51  typedef boost::spirit::classic::uint_parser<unsigned int, 10, 1, 2> uint1_2_p_t;
52 
54  typedef boost::spirit::classic::uint_parser<unsigned int, 10, 1, 3> uint1_3_p_t;
55 
57  typedef boost::spirit::classic::uint_parser<unsigned int, 10, 4, 4> uint4_p_t;
58 
60  typedef boost::spirit::classic::uint_parser<unsigned int, 10, 1, 4> uint1_4_p_t;
61 
63  typedef boost::spirit::classic::chset<char_t> chset_t;
64 
67  typedef boost::spirit::classic::impl::loop_traits<chset_t,
68  unsigned int,
69  unsigned int>::type repeat_p_t;
70 
72  typedef boost::spirit::classic::bounded<uint2_p_t, unsigned int> bounded2_p_t;
73  typedef boost::spirit::classic::bounded<uint1_2_p_t, unsigned int> bounded1_2_p_t;
74  typedef boost::spirit::classic::bounded<uint1_3_p_t, unsigned int> bounded1_3_p_t;
75  typedef boost::spirit::classic::bounded<uint4_p_t, unsigned int> bounded4_p_t;
76  typedef boost::spirit::classic::bounded<uint1_4_p_t, unsigned int> bounded1_4_p_t;
77 }
78 #endif // __TRADEMGEN_BAS_BASCOMPARSERTYPES_HPP