1.00.16
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
FareOptionStruct.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// StdAir
8
#include <
stdair/basic/BasConst_BookingClass.hpp
>
9
#include <
stdair/bom/FareOptionStruct.hpp
>
10
11
namespace
stdair
{
12
13
// ////////////////////////////////////////////////////////////////////
14
FareOptionStruct::FareOptionStruct
()
15
: _fare (
DEFAULT_FARE_VALUE
), _avl (
DEFAULT_AVAILABILITY
) {
16
}
17
18
// ////////////////////////////////////////////////////////////////////
19
FareOptionStruct::FareOptionStruct
(
const
FareOptionStruct
& iFO)
20
: _classPath (iFO._classPath),
21
_fare (iFO._fare), _avl (iFO._avl), _changeFee (iFO._changeFee),
22
_nonRefundable (iFO._nonRefundable), _saturdayStay (iFO._saturdayStay) {
23
}
24
25
// ////////////////////////////////////////////////////////////////////
26
FareOptionStruct::FareOptionStruct
(
const
std::string& iClassPath,
27
const
Fare_T
& iFare,
28
const
ChangeFees_T
& iChangeFee,
29
const
NonRefundable_T
& iNonRefundable,
30
const
SaturdayStay_T
& iSaturdayNightStay)
31
: _fare (iFare), _avl (
DEFAULT_AVAILABILITY
),
32
_changeFee (iChangeFee), _nonRefundable (iNonRefundable),
33
_saturdayStay (iSaturdayNightStay) {
34
_classPath.push_back (iClassPath);
35
}
36
37
// ////////////////////////////////////////////////////////////////////
38
FareOptionStruct::~FareOptionStruct
() {
39
}
40
41
// ////////////////////////////////////////////////////////////////////
42
void
FareOptionStruct::toStream
(std::ostream& ioOut)
const
{
43
ioOut <<
describe
();
44
}
45
46
// ////////////////////////////////////////////////////////////////////
47
void
FareOptionStruct::fromStream
(std::istream& ioIn) {
48
}
49
50
// ////////////////////////////////////////////////////////////////////
51
const
std::string
FareOptionStruct::describe
()
const
{
52
std::ostringstream oStr;
53
54
oStr <<
"Class path: "
;
55
unsigned
short
idx = 0;
56
for
(ClassList_StringList_T::const_iterator itClassPath =
57
_classPath.begin(); itClassPath != _classPath.end();
58
++itClassPath, ++idx) {
59
if
(idx != 0) {
60
oStr <<
"-"
;
61
}
62
const
std::string& lClassPath = *itClassPath;
63
oStr << lClassPath;
64
}
65
66
oStr <<
"; "
<< _fare <<
" EUR"
;
67
oStr <<
"; conditions: "
<< _changeFee <<
" "
<< _nonRefundable
68
<<
" "
<< _saturdayStay;
69
return
oStr.str();
70
}
71
72
// ////////////////////////////////////////////////////////////////////
73
const
std::string
FareOptionStruct::display
()
const
{
74
std::ostringstream oStr;
75
76
unsigned
short
idx = 0;
77
for
(ClassList_StringList_T::const_iterator itClassPath =
78
_classPath.begin(); itClassPath != _classPath.end();
79
++itClassPath, ++idx) {
80
if
(idx != 0) {
81
oStr <<
"-"
;
82
}
83
const
std::string& lClassPath = *itClassPath;
84
oStr << lClassPath;
85
}
86
87
oStr <<
", "
<< _fare <<
", "
<< _changeFee <<
" "
<< _nonRefundable
88
<<
" "
<< _saturdayStay;
89
return
oStr.str();
90
}
91
92
// ////////////////////////////////////////////////////////////////////
93
void
FareOptionStruct::addClassList
(
const
std::string iClassCodeList) {
94
_classPath.push_back (iClassCodeList);
95
}
96
97
// ////////////////////////////////////////////////////////////////////
98
void
FareOptionStruct::emptyClassList
() {
99
_classPath.clear();
100
}
101
102
}
BasConst_BookingClass.hpp
FareOptionStruct.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::Fare_T
double Fare_T
Definition
stdair_basic_types.hpp:126
stdair::DEFAULT_AVAILABILITY
const Availability_T DEFAULT_AVAILABILITY
stdair::SaturdayStay_T
bool SaturdayStay_T
Definition
stdair_date_time_types.hpp:41
stdair::NonRefundable_T
bool NonRefundable_T
Definition
stdair_demand_types.hpp:27
stdair::DEFAULT_FARE_VALUE
const Fare_T DEFAULT_FARE_VALUE
Definition
BasConst_General.hpp:36
stdair::ChangeFees_T
bool ChangeFees_T
Definition
stdair_demand_types.hpp:24
stdair::FareOptionStruct::display
const std::string display() const
Definition
FareOptionStruct.cpp:73
stdair::FareOptionStruct::fromStream
void fromStream(std::istream &ioIn)
Definition
FareOptionStruct.cpp:47
stdair::FareOptionStruct::emptyClassList
void emptyClassList()
Definition
FareOptionStruct.cpp:98
stdair::FareOptionStruct::describe
const std::string describe() const
Definition
FareOptionStruct.cpp:51
stdair::FareOptionStruct::addClassList
void addClassList(const std::string)
Definition
FareOptionStruct.cpp:93
stdair::FareOptionStruct::FareOptionStruct
FareOptionStruct()
Definition
FareOptionStruct.cpp:14
stdair::FareOptionStruct::toStream
void toStream(std::ostream &ioOut) const
Definition
FareOptionStruct.cpp:42
stdair::FareOptionStruct::~FareOptionStruct
~FareOptionStruct()
Definition
FareOptionStruct.cpp:38
Generated for StdAir by
1.13.2