StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
DatePeriodKey.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <ostream>
00006 #include <sstream>
00007 // Boost Date-Time
00008 #include <boost/date_time/gregorian/formatters.hpp>
00009 // STDAIR
00010 #include <stdair/basic/BasConst_Period_BOM.hpp>
00011 #include <stdair/bom/DatePeriodKey.hpp>
00012 
00013 namespace stdair {
00014 
00015   // ////////////////////////////////////////////////////////////////////
00016   DatePeriodKey::DatePeriodKey()
00017     : _datePeriod (BOOST_DEFAULT_DATE_PERIOD) {
00018     assert (false);
00019   }
00020 
00021   // ////////////////////////////////////////////////////////////////////
00022   DatePeriodKey::DatePeriodKey (const stdair::DatePeriod_T& iDatePeriod)
00023     : _datePeriod (iDatePeriod) {
00024   }
00025 
00026   // ////////////////////////////////////////////////////////////////////
00027   DatePeriodKey::DatePeriodKey (const DatePeriodKey& iKey)
00028     : _datePeriod (iKey._datePeriod) {
00029   }
00030 
00031   // ////////////////////////////////////////////////////////////////////
00032   DatePeriodKey::~DatePeriodKey () {
00033   }
00034 
00035   // ////////////////////////////////////////////////////////////////////
00036   void DatePeriodKey::toStream (std::ostream& ioOut) const {
00037     ioOut << "DatePeriodKey: " << toString() << std::endl;
00038   }
00039 
00040   // ////////////////////////////////////////////////////////////////////
00041   void DatePeriodKey::fromStream (std::istream& ioIn) {
00042   }
00043 
00044   // ////////////////////////////////////////////////////////////////////
00045   const std::string DatePeriodKey::toString() const {
00046     std::ostringstream oStr;
00047     const stdair::Date_T lStart = _datePeriod.begin();
00048     const stdair::Date_T lEnd = _datePeriod.end();
00049     oStr << "[" << boost::gregorian::to_simple_string(lStart)
00050          << "/" << boost::gregorian::to_simple_string(lEnd)
00051          << "]";
00052     return oStr.str();
00053   }
00054 
00055 }