0.1.2
C++ Simulated Airline Inventory Management System library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
ScheduleParserHelper.hpp
Go to the documentation of this file.
1
#ifndef __AIRINV_CMD_SCHEDULEPARSERHELPER_HPP
2
#define __AIRINV_CMD_SCHEDULEPARSERHELPER_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
>
13
#include <
airinv/basic/BasParserTypes.hpp
>
14
#include <
airinv/bom/FlightPeriodStruct.hpp
>
15
16
// Forward declarations
17
namespace
stdair {
18
class
BomRoot;
19
}
20
21
namespace
AIRINV {
22
23
namespace
ScheduleParserHelper {
24
25
// ///////////////////////////////////////////////////////////////////
26
// Semantic actions
27
// ///////////////////////////////////////////////////////////////////
29
struct
ParserSemanticAction
{
31
ParserSemanticAction
(
FlightPeriodStruct
&);
33
FlightPeriodStruct
&
_flightPeriod
;
34
};
35
37
struct
storeAirlineCode
:
public
ParserSemanticAction
{
39
storeAirlineCode
(
FlightPeriodStruct
&);
41
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
42
};
43
45
struct
storeFlightNumber
:
public
ParserSemanticAction
{
47
storeFlightNumber
(
FlightPeriodStruct
&);
49
void
operator()
(
unsigned
int
iNumber)
const
;
50
};
51
53
struct
storeDateRangeStart
:
public
ParserSemanticAction
{
55
storeDateRangeStart
(
FlightPeriodStruct
&);
57
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
58
};
59
61
struct
storeDateRangeEnd
:
public
ParserSemanticAction
{
63
storeDateRangeEnd
(
FlightPeriodStruct
&);
65
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
66
};
67
69
struct
storeDow
:
public
ParserSemanticAction
{
71
storeDow
(
FlightPeriodStruct
&);
73
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
74
};
75
77
struct
storeLegBoardingPoint
:
public
ParserSemanticAction
{
79
storeLegBoardingPoint
(
FlightPeriodStruct
&);
81
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
82
};
83
85
struct
storeLegOffPoint
:
public
ParserSemanticAction
{
87
storeLegOffPoint
(
FlightPeriodStruct
&);
89
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
90
};
91
93
struct
storeBoardingTime
:
public
ParserSemanticAction
{
95
storeBoardingTime
(
FlightPeriodStruct
&);
97
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
98
};
99
101
struct
storeOffTime
:
public
ParserSemanticAction
{
103
storeOffTime
(
FlightPeriodStruct
&);
105
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
106
};
107
109
struct
storeElapsedTime
:
public
ParserSemanticAction
{
111
storeElapsedTime
(
FlightPeriodStruct
&);
113
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
114
};
115
117
struct
storeLegCabinCode
:
public
ParserSemanticAction
{
119
storeLegCabinCode
(
FlightPeriodStruct
&);
121
void
operator()
(
char
iChar)
const
;
122
};
123
125
struct
storeCapacity
:
public
ParserSemanticAction
{
127
storeCapacity
(
FlightPeriodStruct
&);
129
void
operator()
(
double
iReal)
const
;
130
};
131
136
struct
storeSegmentSpecificity
:
public
ParserSemanticAction
{
138
storeSegmentSpecificity
(
FlightPeriodStruct
&);
140
void
operator()
(
char
iChar)
const
;
141
};
142
144
struct
storeSegmentBoardingPoint
:
public
ParserSemanticAction
{
146
storeSegmentBoardingPoint
(
FlightPeriodStruct
&);
148
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
149
};
150
152
struct
storeSegmentOffPoint
:
public
ParserSemanticAction
{
154
storeSegmentOffPoint
(
FlightPeriodStruct
&);
156
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
157
};
158
160
struct
storeSegmentCabinCode
:
public
ParserSemanticAction
{
162
storeSegmentCabinCode
(
FlightPeriodStruct
&);
164
void
operator()
(
char
iChar)
const
;
165
};
166
168
struct
storeClasses
:
public
ParserSemanticAction
{
170
storeClasses
(
FlightPeriodStruct
&);
172
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
173
};
174
176
struct
storeFamilyCode
:
public
ParserSemanticAction
{
178
storeFamilyCode
(
FlightPeriodStruct
&);
180
void
operator()
(
int
iCode)
const
;
181
};
182
184
struct
storeFClasses
:
public
ParserSemanticAction
{
186
storeFClasses
(
FlightPeriodStruct
&);
188
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
189
};
190
192
struct
doEndFlight
:
public
ParserSemanticAction
{
194
doEndFlight
(stdair::BomRoot&,
FlightPeriodStruct
&);
196
void
operator()
(
iterator_t
iStr,
iterator_t
iStrEnd)
const
;
198
stdair::BomRoot&
_bomRoot
;
199
};
200
201
203
//
204
// (Boost Spirit) Grammar Definition
205
//
207
249
struct
FlightPeriodParser
:
250
public
boost::spirit::classic::grammar<FlightPeriodParser> {
251
252
FlightPeriodParser
(stdair::BomRoot&,
FlightPeriodStruct
&);
253
254
template
<
typename
ScannerT>
255
struct
definition
{
256
definition
(
FlightPeriodParser
const
&
self
);
257
258
// Instantiation of rules
259
boost::spirit::classic::rule<ScannerT>
flight_period_list
,
260
not_to_be_parsed
,
flight_period
,
flight_period_end
,
261
flight_key
,
airline_code
,
flight_number
,
262
date
,
dow
,
time
,
date_offset
,
263
leg
,
leg_key
,
leg_details
,
leg_cabin_details
,
264
segment_section
,
segment_key
,
full_segment_cabin_details
,
265
segment_cabin_details
,
full_family_cabin_details
,
266
family_cabin_details
,
generic_segment
,
specific_segment_list
;
267
269
boost::spirit::classic::rule<ScannerT>
const
&
start
()
const
;
270
};
271
272
// Parser Context
273
stdair::BomRoot&
_bomRoot
;
274
FlightPeriodStruct
&
_flightPeriod
;
275
};
276
277
}
282
283
//
284
// Entry class for the file parser
285
//
287
292
class
FlightPeriodFileParser
:
public
stdair::CmdAbstract {
293
public
:
295
FlightPeriodFileParser
(stdair::BomRoot& ioBomRoot,
296
const
stdair::Filename_T& iFilename);
297
299
bool
generateInventories
();
300
301
private
:
303
void
init();
304
305
private
:
306
// Attributes
308
stdair::Filename_T _filename;
309
311
iterator_t
_startIterator;
312
314
iterator_t
_endIterator;
315
317
stdair::BomRoot& _bomRoot;
318
320
FlightPeriodStruct
_flightPeriod;
321
};
322
323
}
324
#endif // __AIRINV_CMD_SCHEDULEPARSERHELPER_HPP
Generated on Sat Aug 18 2012 05:41:43 for AirInv by
1.8.1.2