#ifndef __JDB_JDATE_T__ #define __JDB_JDATE_T__ #include #include #include "Jeep/JDate.hh" #include "Jeep/JTime.hh" #include "JLang/JMultiComparable.hh" /** * \author mdejong */ namespace JDATABASE {} namespace JPP { using namespace JDATABASE; } namespace JDATABASE { using JLANG::JMultiComparable; using JLANG::JTYPELIST; typedef JEEP::JDate<'/'> JDate_t; //!< type defintion of date according database format typedef JEEP::JTime<':'> JTime_t; //!< type defintion of time according database format /** * Date and time. */ struct JDateAndTime_t : public JDate_t, public JTime_t, public JMultiComparable::typelist> { /** * Separation character. */ static const char SEPARATOR = '-'; /** * Default constructor; */ JDateAndTime_t() {} /** * Read date and time from input stream. * * \param in input stream * \param object date and time * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JDateAndTime_t& object) { in >> static_cast(object); if (in.get() == (int) SEPARATOR) { in >> static_cast(object); } return in; } /** * Write date and time to output stream. * * \param out output stream * \param object date and time * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JDateAndTime_t& object) { out << static_cast(object); out << SEPARATOR; out << static_cast(object); return out; } }; } #endif