AirInv Logo  0.1.2
C++ Simulated Airline Inventory Management System library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InventoryParserHelper.hpp
Go to the documentation of this file.
1 #ifndef __AIRINV_CMD_INVENTORYPARSERHELPER_HPP
2 #define __AIRINV_CMD_INVENTORYPARSERHELPER_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 InventoryParserHelper {
24 
25  // ///////////////////////////////////////////////////////////////////
26  // Semantic actions
27  // ///////////////////////////////////////////////////////////////////
34  };
35 
41  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
42  };
43 
49  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
50  };
51 
57  void operator() (unsigned int iNumber) const;
58  };
59 
65  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
66  };
67 
73  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
74  };
75 
81  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
82  };
83 
89  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
90  };
91 
97  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
98  };
99 
105  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
106  };
107 
113  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
114  };
115 
121  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
122  };
123 
129  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
130  };
131 
137  void operator() (char iChar) const;
138  };
139 
145  void operator() (double iReal) const;
146  };
147 
149  struct storeAU : public ParserSemanticAction {
153  void operator() (double iReal) const;
154  };
155 
157  struct storeUPR : public ParserSemanticAction {
161  void operator() (double iReal) const;
162  };
163 
169  void operator() (double iReal) const;
170  };
171 
173  struct storeNAV : public ParserSemanticAction {
177  void operator() (double iReal) const;
178  };
179 
181  struct storeGAV : public ParserSemanticAction {
185  void operator() (double iReal) const;
186  };
187 
189  struct storeACP : public ParserSemanticAction {
193  void operator() (double iReal) const;
194  };
195 
197  struct storeETB : public ParserSemanticAction {
201  void operator() (double iReal) const;
202  };
203 
209  void operator() (double iReal) const;
210  };
211 
217  void operator() (double iReal) const;
218  };
219 
225  void operator() (double iReal) const;
226  };
227 
233  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
234  };
235 
241  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
242  };
243 
249  void operator() (char iChar) const;
250  };
251 
257  void operator() (double iReal) const;
258  };
259 
265  void operator() (char iChar) const;
266  };
267 
273  void operator() (unsigned int iNumber) const;
274  };
275 
281  void operator() (char iChar) const;
282  };
283 
289  void operator() (unsigned int iNumber) const;
290  };
291 
297  void operator() (double iReal) const;
298  };
299 
305  void operator() (double iReal) const;
306  };
307 
309  struct storeNego : public ParserSemanticAction {
313  void operator() (double iReal) const;
314  };
315 
321  void operator() (double iReal) const;
322  };
323 
329  void operator() (double iReal) const;
330  };
331 
337  void operator() (double iReal) const;
338  };
339 
345  void operator() (double iReal) const;
346  };
347 
353  void operator() (double iReal) const;
354  };
355 
361  void operator() (double iReal) const;
362  };
363 
370  void operator() (double iReal) const;
371  };
372 
378  void operator() (double iReal) const;
379  };
380 
387  void operator() (double iReal) const;
388  };
389 
396  void operator() (double iReal) const;
397  };
398 
405  void operator() (double iReal) const;
406  };
407 
413  void operator() (int iCode) const;
414  };
415 
421  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
422  };
423 
427  doEndFlightDate (stdair::BomRoot&, FlightDateStruct&,
428  unsigned int&);
430  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
432  stdair::BomRoot& _bomRoot;
433  unsigned int& _nbOfFlights;
434  };
435 
436 
438  //
439  // (Boost Spirit) Grammar Definition
440  //
442 
454  struct InventoryParser :
455  public boost::spirit::classic::grammar<InventoryParser> {
456 
457  InventoryParser (stdair::BomRoot&, FlightDateStruct&, unsigned int&);
458 
459  template <typename ScannerT>
460  struct definition {
461  definition (InventoryParser const& self);
462 
463  // Instantiation of rules
464  boost::spirit::classic::rule<ScannerT> flight_date_list,
476 
478  boost::spirit::classic::rule<ScannerT> const& start() const;
479  };
480 
481  // Parser Context
482  stdair::BomRoot& _bomRoot;
484  unsigned int& _nbOfFlights;
485  };
486 
487  }
488 
489 
491  //
492  // Entry class for the file parser
493  //
495 
500  class InventoryFileParser : public stdair::CmdAbstract {
501  public:
503  InventoryFileParser (stdair::BomRoot&,
504  const stdair::Filename_T& iInventoryInputFilename);
505 
507  bool buildInventory ();
508 
509  private:
511  void init();
512 
513  private:
514  // Attributes
516  stdair::Filename_T _filename;
517 
519  iterator_t _startIterator;
520 
522  iterator_t _endIterator;
523 
525  stdair::BomRoot& _bomRoot;
526 
528  FlightDateStruct _flightDate;
529 
531  unsigned int _nbOfFlights;
532  };
533 
534 }
535 #endif // __AIRINV_CMD_INVENTORYPARSERHELPER_HPP