AirInv Logo  1.00.0
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() (unsigned int iNumber) 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() (iterator_t iStr, iterator_t iStrEnd) const;
138  };
139 
145  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
146  };
147 
153  void operator() (char iChar) const;
154  };
155 
161  void operator() (double iReal) const;
162  };
163 
165  struct storeAU : public ParserSemanticAction {
169  void operator() (double iReal) const;
170  };
171 
173  struct storeUPR : public ParserSemanticAction {
177  void operator() (double iReal) const;
178  };
179 
185  void operator() (double iReal) const;
186  };
187 
189  struct storeNAV : public ParserSemanticAction {
193  void operator() (double iReal) const;
194  };
195 
197  struct storeGAV : public ParserSemanticAction {
201  void operator() (double iReal) const;
202  };
203 
205  struct storeACP : public ParserSemanticAction {
209  void operator() (double iReal) const;
210  };
211 
213  struct storeETB : public ParserSemanticAction {
217  void operator() (double iReal) const;
218  };
219 
225  void operator() (double iReal) const;
226  };
227 
233  void operator() (double iReal) const;
234  };
235 
241  void operator() (double iReal) const;
242  };
243 
249  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
250  };
251 
257  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
258  };
259 
265  void operator() (char iChar) const;
266  };
267 
273  void operator() (double iReal) const;
274  };
275 
281  void operator() (char iChar) const;
282  };
283 
289  void operator() (unsigned int iNumber) const;
290  };
291 
297  void operator() (char iChar) const;
298  };
299 
305  void operator() (unsigned int iNumber) const;
306  };
307 
313  void operator() (double iReal) const;
314  };
315 
321  void operator() (double iReal) const;
322  };
323 
325  struct storeNego : public ParserSemanticAction {
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 
369  void operator() (double iReal) const;
370  };
371 
377  void operator() (double iReal) const;
378  };
379 
386  void operator() (double iReal) const;
387  };
388 
394  void operator() (double iReal) const;
395  };
396 
403  void operator() (double iReal) const;
404  };
405 
412  void operator() (double iReal) const;
413  };
414 
421  void operator() (double iReal) const;
422  };
423 
429  void operator() (int iCode) const;
430  };
431 
437  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
438  };
439 
443  doEndFlightDate (stdair::BomRoot&, FlightDateStruct&,
444  unsigned int&);
446  void operator() (iterator_t iStr, iterator_t iStrEnd) const;
448  stdair::BomRoot& _bomRoot;
449  unsigned int& _nbOfFlights;
450  };
451 
452 
454  //
455  // (Boost Spirit) Grammar Definition
456  //
458 
470  struct InventoryParser :
471  public boost::spirit::classic::grammar<InventoryParser> {
472 
473  InventoryParser (stdair::BomRoot&, FlightDateStruct&, unsigned int&);
474 
475  template <typename ScannerT>
476  struct definition {
477  definition (InventoryParser const& self);
478 
479  // Instantiation of rules
480  boost::spirit::classic::rule<ScannerT> flight_date_list,
492 
494  boost::spirit::classic::rule<ScannerT> const& start() const;
495  };
496 
497  // Parser Context
498  stdair::BomRoot& _bomRoot;
500  unsigned int& _nbOfFlights;
501  };
502 
503  }
504 
505 
507  //
508  // Entry class for the file parser
509  //
511 
516  class InventoryFileParser : public stdair::CmdAbstract {
517  public:
519  InventoryFileParser (stdair::BomRoot&,
520  const stdair::Filename_T& iInventoryInputFilename);
521 
523  bool buildInventory ();
524 
525  private:
527  void init();
528 
529  private:
530  // Attributes
532  stdair::Filename_T _filename;
533 
535  iterator_t _startIterator;
536 
538  iterator_t _endIterator;
539 
541  stdair::BomRoot& _bomRoot;
542 
544  FlightDateStruct _flightDate;
545 
547  unsigned int _nbOfFlights;
548  };
549 
550 }
551 #endif // __AIRINV_CMD_INVENTORYPARSERHELPER_HPP