AirInv Logo  1.00.3
C++ Simulated Airline Inventory Management System library
FRAT5ParserHelper.hpp
Go to the documentation of this file.
1 #ifndef __AIRINV_CMD_FRAT5PARSERHELPER_HPP
2 #define __AIRINV_CMD_FRAT5PARSERHELPER_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <string>
9 // StdAir
10 #include <stdair/command/CmdAbstract.hpp>
11 // Airinv
12 #include <airinv/AIRINV_Types.hpp>
15 
16 // Forward declarations
17 namespace stdair {
18  class BomRoot;
19 }
20 
21 namespace AIRINV {
22 
23  namespace FRAT5ParserHelper {
24 
25  // ///////////////////////////////////////////////////////////////////
26  // Semantic actions
27  // ///////////////////////////////////////////////////////////////////
34  };
35 
41  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
42  };
43 
45  struct storeDTD : public ParserSemanticAction {
49  void operator() (int iDTD) const;
50  };
51 
57  void operator() (double iReal) const;
58  };
59 
61  struct doEndCurve : public ParserSemanticAction {
63  doEndCurve (stdair::BomRoot&, FRAT5Struct&);
65  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
67  stdair::BomRoot& _bomRoot;
68  };
69 
71  //
72  // (Boost Spirit) Grammar Definition
73  //
75 
89  struct FRAT5Parser :
90  public boost::spirit::classic::grammar<FRAT5Parser> {
91 
92  FRAT5Parser (stdair::BomRoot&, FRAT5Struct&);
93 
94  template <typename ScannerT>
95  struct definition {
96  definition (FRAT5Parser const& self);
97 
98  // Instantiation of rules
99  boost::spirit::classic::rule<ScannerT> curve_list,
101 
103  boost::spirit::classic::rule<ScannerT> const& start() const;
104  };
105 
106  // Parser Context
107  stdair::BomRoot& _bomRoot;
109  };
110  }
111 
116  //
118  // Entry class for the file parser
119  //
121 
126  class FRAT5FileParser : public stdair::CmdAbstract {
127  public:
129  FRAT5FileParser (stdair::BomRoot& ioBomRoot,
130  const stdair::Filename_T& iFilename);
131 
133  bool generateFRAT5Curves ();
134 
135  private:
137  void init();
138 
139  private:
140  // Attributes
142  stdair::Filename_T _filename;
143 
145  iterator_t _startIterator;
146 
148  iterator_t _endIterator;
149 
151  stdair::BomRoot& _bomRoot;
152 
154  FRAT5Struct _frat5;
155  };
156 
157 }
158 #endif // __AIRINV_CMD_FRAT5PARSERHELPER_HPP
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::value_pair
boost::spirit::classic::rule< ScannerT > value_pair
Definition: FRAT5ParserHelper.hpp:100
AIRINV::FRAT5ParserHelper::FRAT5Parser
Definition: FRAT5ParserHelper.hpp:89
AIRINV::FRAT5Struct
Definition: FRAT5Struct.hpp:15
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::definition
definition(FRAT5Parser const &self)
Definition: FRAT5ParserHelper.cpp:124
FRAT5Struct.hpp
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::start
boost::spirit::classic::rule< ScannerT > const & start() const
Definition: FRAT5ParserHelper.cpp:164
AIRINV::FRAT5ParserHelper::storeDTD
Definition: FRAT5ParserHelper.hpp:45
AIRINV::FRAT5ParserHelper::FRAT5Parser::FRAT5Parser
FRAT5Parser(stdair::BomRoot &, FRAT5Struct &)
Definition: FRAT5ParserHelper.cpp:115
AIRINV::FRAT5ParserHelper::ParserSemanticAction::_frat5
FRAT5Struct & _frat5
Definition: FRAT5ParserHelper.hpp:33
AIRINV::iterator_t
boost::spirit::classic::file_iterator< char_t > iterator_t
Definition: BasParserTypes.hpp:35
AIRINV::FRAT5ParserHelper::storeDTD::storeDTD
storeDTD(FRAT5Struct &)
Definition: FRAT5ParserHelper.cpp:46
stdair
Forward declarations.
Definition: AIRINV_Master_Service.hpp:25
AIRINV::FRAT5ParserHelper::storeCurveKey::storeCurveKey
storeCurveKey(FRAT5Struct &)
Definition: FRAT5ParserHelper.cpp:33
AIRINV::FRAT5ParserHelper::FRAT5Parser::_bomRoot
stdair::BomRoot & _bomRoot
Definition: FRAT5ParserHelper.hpp:107
AIRINV::FRAT5ParserHelper::storeFRAT5Value::storeFRAT5Value
storeFRAT5Value(FRAT5Struct &)
Definition: FRAT5ParserHelper.cpp:57
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::map
boost::spirit::classic::rule< ScannerT > map
Definition: FRAT5ParserHelper.hpp:100
AIRINV::FRAT5FileParser::FRAT5FileParser
FRAT5FileParser(stdair::BomRoot &ioBomRoot, const stdair::Filename_T &iFilename)
Definition: FRAT5ParserHelper.cpp:178
AIRINV::FRAT5ParserHelper::storeCurveKey
Definition: FRAT5ParserHelper.hpp:37
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::not_to_be_parsed
boost::spirit::classic::rule< ScannerT > not_to_be_parsed
Definition: FRAT5ParserHelper.hpp:100
AIRINV::FRAT5FileParser
Definition: FRAT5ParserHelper.hpp:126
AIRINV_Types.hpp
AIRINV::FRAT5ParserHelper::doEndCurve::operator()
void operator()(iterator_t iStr, iterator_t iStrEnd) const
Definition: FRAT5ParserHelper.cpp:88
AIRINV::FRAT5ParserHelper::ParserSemanticAction
Definition: FRAT5ParserHelper.hpp:29
AIRINV::FRAT5ParserHelper::ParserSemanticAction::ParserSemanticAction
ParserSemanticAction(FRAT5Struct &)
Definition: FRAT5ParserHelper.cpp:27
AIRINV::FRAT5ParserHelper::storeCurveKey::operator()
void operator()(iterator_t iStr, iterator_t iStrEnd) const
Definition: FRAT5ParserHelper.cpp:38
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::curve
boost::spirit::classic::rule< ScannerT > curve
Definition: FRAT5ParserHelper.hpp:100
AIRINV::FRAT5ParserHelper::storeFRAT5Value::operator()
void operator()(double iReal) const
Definition: FRAT5ParserHelper.cpp:62
AIRINV::FRAT5ParserHelper::doEndCurve::_bomRoot
stdair::BomRoot & _bomRoot
Definition: FRAT5ParserHelper.hpp:67
AIRINV
Definition: AIRINV_Master_Service.hpp:38
BasParserTypes.hpp
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::curve_end
boost::spirit::classic::rule< ScannerT > curve_end
Definition: FRAT5ParserHelper.hpp:100
AIRINV::FRAT5ParserHelper::storeFRAT5Value
Definition: FRAT5ParserHelper.hpp:53
AIRINV::FRAT5ParserHelper::storeDTD::operator()
void operator()(int iDTD) const
Definition: FRAT5ParserHelper.cpp:51
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition
Definition: FRAT5ParserHelper.hpp:95
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::curve_list
boost::spirit::classic::rule< ScannerT > curve_list
Definition: FRAT5ParserHelper.hpp:99
AIRINV::FRAT5ParserHelper::FRAT5Parser::_frat5
FRAT5Struct & _frat5
Definition: FRAT5ParserHelper.hpp:108
AIRINV::FRAT5FileParser::generateFRAT5Curves
bool generateFRAT5Curves()
Definition: FRAT5ParserHelper.cpp:202
AIRINV::FRAT5ParserHelper::FRAT5Parser::definition::key
boost::spirit::classic::rule< ScannerT > key
Definition: FRAT5ParserHelper.hpp:100
AIRINV::FRAT5ParserHelper::doEndCurve::doEndCurve
doEndCurve(stdair::BomRoot &, FRAT5Struct &)
Definition: FRAT5ParserHelper.cpp:80
AIRINV::FRAT5ParserHelper::doEndCurve
Definition: FRAT5ParserHelper.hpp:61