StdAir Logo  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
10
11namespace stdair {
12
13 // ////////////////////////////////////////////////////////////////////
17
18 // ////////////////////////////////////////////////////////////////////
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 // ////////////////////////////////////////////////////////////////////
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 // ////////////////////////////////////////////////////////////////////
99 _classPath.clear();
100 }
101
102}
Handle on the StdAir library context.
const Availability_T DEFAULT_AVAILABILITY
const Fare_T DEFAULT_FARE_VALUE
const std::string display() const
void fromStream(std::istream &ioIn)
const std::string describe() const
void addClassList(const std::string)
void toStream(std::ostream &ioOut) const