StdAir Logo  0.45.1
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DatePeriod.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // StdAir
11 
12 namespace stdair {
13 
14  // ////////////////////////////////////////////////////////////////////
15  DatePeriod::DatePeriod()
17  _parent (NULL) {
18  // That constructor is used by the serialisation process
19  }
20 
21  // ////////////////////////////////////////////////////////////////////
22  DatePeriod::DatePeriod (const DatePeriod& iDatePeriod)
23  : _key (iDatePeriod.getKey()), _parent (NULL) {
24  assert (false);
25  }
26 
27  // ////////////////////////////////////////////////////////////////////
28  DatePeriod::DatePeriod (const Key_T& iKey)
29  : _key (iKey), _parent (NULL) {
30  }
31 
32  // ////////////////////////////////////////////////////////////////////
34  }
35 
36  // ////////////////////////////////////////////////////////////////////
37  std::string DatePeriod::toString() const {
38  std::ostringstream oStr;
39  oStr << describeKey();
40  return oStr.str();
41  }
42 
43  // ////////////////////////////////////////////////////////////////////
44  bool DatePeriod::
45  isDepartureDateValid (const Date_T& iFlightDate) const {
46 
47  // Check if the departure date is within the date range.
48  const DatePeriod_T& lPeriod = getDatePeriod ();
49  if (lPeriod.contains (iFlightDate) == false) {
50  return false;
51  }
52 
53  return true;
54  }
55 
56 }
57