AirInv Logo  1.00.0
C++ Simulated Airline Inventory Management System library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FFDisutilityParserHelper.hpp
Go to the documentation of this file.
1 #ifndef __AIRINV_CMD_FFDISUTILITYPARSERHELPER_HPP
2 #define __AIRINV_CMD_FFDISUTILITYPARSERHELPER_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 FFDisutilityParserHelper {
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&, FFDisutilityStruct&);
65  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
67  stdair::BomRoot& _bomRoot;
68  };
69 
71  //
72  // (Boost Spirit) Grammar Definition
73  //
75 
90  public boost::spirit::classic::grammar<FFDisutilityParser> {
91 
92  FFDisutilityParser (stdair::BomRoot&, FFDisutilityStruct&);
93 
94  template <typename ScannerT>
95  struct definition {
96  definition (FFDisutilityParser 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 
117  //
118  // Entry class for the file parser
119  //
121 
126  class FFDisutilityFileParser : public stdair::CmdAbstract {
127  public:
129  FFDisutilityFileParser (stdair::BomRoot& ioBomRoot,
130  const stdair::Filename_T& iFilename);
131 
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  FFDisutilityStruct _ffDisutility;
155  };
156 
157 }
158 #endif // __AIRINV_CMD_FFDISUTILITYPARSERHELPER_HPP