StdAir Logo  0.45.1
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CancellationStruct.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // StdAir
10 
11 namespace stdair {
12  // ////////////////////////////////////////////////////////////////////
14  const ClassList_String_T& iList,
15  const PartySize_T& iSize,
16  const DateTime_T& iDateTime)
17  : _segmentPath (iSegPath), _classList (iList), _partySize (iSize),
18  _datetime (iDateTime) {
19  }
20 
21  // ////////////////////////////////////////////////////////////////////
23  }
24 
25  // ////////////////////////////////////////////////////////////////////
26  void CancellationStruct::toStream (std::ostream& ioOut) const {
27  ioOut << describe();
28  }
29 
30  // ////////////////////////////////////////////////////////////////////
31  void CancellationStruct::fromStream (std::istream& ioIn) {
32  }
33 
34  // ////////////////////////////////////////////////////////////////////
35  const std::string CancellationStruct::describe() const {
36  std::ostringstream oStr;
37 
38  oStr << "Segment path: ";
39  unsigned short idx = 0;
40  for (SegmentPath_T::const_iterator lItSegmentPath = _segmentPath.begin();
41  lItSegmentPath != _segmentPath.end(); ++lItSegmentPath, ++idx) {
42  if (idx != 0) {
43  oStr << "-";
44  }
45  const std::string& lSegmentKey = *lItSegmentPath;
46  oStr << lSegmentKey;
47  }
48 
49  oStr << ";" << _classList << ";" << _partySize << ";" << _datetime;
50  return oStr.str();
51  }
52 
53  // ////////////////////////////////////////////////////////////////////
54  const std::string CancellationStruct::display() const {
55  std::ostringstream oStr;
56 
57  // List of segment keys (one per segment)
58  unsigned short idx = 0;
59  for (SegmentPath_T::const_iterator itSegPath = _segmentPath.begin();
60  itSegPath != _segmentPath.end(); ++itSegPath, ++idx) {
61  if (idx != 0) {
62  oStr << " ; ";
63  }
64  const std::string& lSegmentKey = *itSegPath;
65  oStr << "[" << idx << "] " << lSegmentKey;
66  }
67 
68  oStr << ";" << _classList << ";" << _partySize << ";" << _datetime;
69  return oStr.str();
70  }
71 }