AirSched Logo  0.1.4
C++ Simulated Airline Schedule Manager Library
BasParserTypes.hpp
Go to the documentation of this file.
00001 #ifndef __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP
00002 #define __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <string>
00009 // Boost
00010 //#define BOOST_SPIRIT_DEBUG
00011 #include <boost/spirit/home/classic/core.hpp>
00012 #include <boost/spirit/home/classic/attribute.hpp>
00013 #include <boost/spirit/home/classic/utility/functor_parser.hpp>
00014 #include <boost/spirit/home/classic/utility/loops.hpp>
00015 #include <boost/spirit/home/classic/utility/chset.hpp>
00016 #include <boost/spirit/home/classic/utility/confix.hpp>
00017 #include <boost/spirit/home/classic/iterator/file_iterator.hpp>
00018 #include <boost/spirit/home/classic/actor/push_back_actor.hpp>
00019 #include <boost/spirit/home/classic/actor/assign_actor.hpp>
00020 
00021 namespace AIRSCHED {
00022 
00023   // ///////////////////////////////////////////////////////////////////////
00024   //
00025   //  Definition of Basic Types
00026   //
00027   // ///////////////////////////////////////////////////////////////////////
00028   // For a file, the parsing unit is the character (char). For a string,
00029   // it is a "char const *".
00030   // typedef char const* iterator_t;
00031   typedef char char_t;
00032     
00033   // The types of iterator, scanner and rule are then derived from
00034   // the parsing unit.
00035   typedef boost::spirit::classic::file_iterator<char_t> iterator_t;
00036   typedef boost::spirit::classic::scanner<iterator_t> scanner_t;
00037   typedef boost::spirit::classic::rule<scanner_t> rule_t;
00038     
00039   // ///////////////////////////////////////////////////////////////////////
00040   //
00041   //  Parser related types
00042   //
00043   // ///////////////////////////////////////////////////////////////////////
00045   typedef boost::spirit::classic::int_parser<unsigned int, 10, 1, 1> int1_p_t;
00046     
00048   typedef boost::spirit::classic::uint_parser<unsigned int, 10, 2, 2> uint2_p_t;
00049     
00051   typedef boost::spirit::classic::uint_parser<unsigned int, 10, 4, 4> uint4_p_t;
00052 
00054   typedef boost::spirit::classic::uint_parser<unsigned int, 10, 1, 4> uint1_4_p_t;    
00055 
00057   typedef boost::spirit::classic::chset<char_t> chset_t;
00058     
00061   typedef boost::spirit::classic::impl::loop_traits<chset_t,
00062                                            unsigned int,
00063                                            unsigned int>::type repeat_p_t;
00064 
00066   typedef boost::spirit::classic::bounded<uint2_p_t, unsigned int> bounded2_p_t;
00067   typedef boost::spirit::classic::bounded<uint4_p_t, unsigned int> bounded4_p_t;
00068   typedef boost::spirit::classic::bounded<uint1_4_p_t, unsigned int> bounded1_4_p_t;
00069     
00070 }
00071 #endif // __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP