StdAir Logo  1.00.13
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
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
12namespace 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 }
25
26 // ////////////////////////////////////////////////////////////////////
27 DatePeriod::DatePeriod (const Key_T& iKey)
28 : _key (iKey), _parent (NULL) {
29 }
30
31 // ////////////////////////////////////////////////////////////////////
33 }
34
35 // ////////////////////////////////////////////////////////////////////
36 std::string DatePeriod::toString() const {
37 std::ostringstream oStr;
38 oStr << describeKey();
39 return oStr.str();
40 }
41
42 // ////////////////////////////////////////////////////////////////////
44 isDepartureDateValid (const Date_T& iFlightDate) const {
45
46 // Check if the departure date is within the date range.
47 const DatePeriod_T& lPeriod = getDatePeriod ();
48 if (lPeriod.contains (iFlightDate) == false) {
49 return false;
50 }
51
52 return true;
53 }
54
55}
56
Handle on the StdAir library context.
boost::gregorian::date Date_T
const DatePeriod_T BOOST_DEFAULT_DATE_PERIOD
boost::gregorian::date_period DatePeriod_T
bool isDepartureDateValid(const Date_T &) const
const std::string describeKey() const
virtual ~DatePeriod()
std::string toString() const
const DatePeriod_T & getDatePeriod() const
Key of date-period.