00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00036 #ifndef OW_CIMDATETIME_HPP_INCLUDE_GUARD_
00037 #define OW_CIMDATETIME_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_Types.hpp"
00040 #include "OW_COWIntrusiveReference.hpp"
00041 #include "OW_CIMException.hpp"
00042 #include "OW_CIMNULL.hpp"
00043 #include "OW_String.hpp"
00044 #include "OW_CommonFwd.hpp"
00045
00046 namespace OW_NAMESPACE
00047 {
00048
00049 OW_DECLARE_APIEXCEPTION(CIMDateTime, OW_COMMON_API);
00050
00051
00052
00113 class OW_COMMON_API CIMDateTime
00114 {
00115 public:
00116 struct DateTimeData;
00117
00121 CIMDateTime();
00122 ~CIMDateTime();
00127 explicit CIMDateTime(CIMNULL_t);
00132 CIMDateTime(const CIMDateTime& arg);
00133
00134 enum EErrorCodes
00135 {
00136 E_INVALID_DATE_TIME_FORMAT
00137 };
00138
00148 explicit CIMDateTime(const String& arg);
00156 CIMDateTime(const DateTime& arg);
00162 explicit CIMDateTime(UInt64 microSeconds);
00169 CIMDateTime& operator= (const CIMDateTime& arg);
00174 UInt16 getYear() const;
00179 UInt8 getMonth() const;
00184 UInt32 getDays() const;
00189 UInt32 getDay() const;
00194 UInt8 getHours() const;
00200 UInt8 getMinutes() const;
00206 UInt8 getSeconds() const;
00212 UInt32 getMicroSeconds() const;
00217 Int16 getUtc() const;
00224 bool equal(const CIMDateTime& arg) const;
00230 CIMDateTime& setYear(UInt16 arg);
00236 CIMDateTime& setMonth(UInt8 arg);
00242 CIMDateTime& setDays(UInt32 arg);
00248 CIMDateTime& setDay(UInt32 arg);
00254 CIMDateTime& setHours(UInt8 arg);
00260 CIMDateTime& setMinutes(UInt8 arg);
00266 CIMDateTime& setSeconds(UInt8 arg);
00272 CIMDateTime& setMicroSeconds(UInt32 arg);
00278 CIMDateTime& setUtc(Int16 arg);
00283 bool isInterval() const;
00287 void setInterval(bool val);
00292 void readObject(std::istream &istrm);
00297 void writeObject(std::ostream &ostrm) const;
00302 String toString() const;
00306 DateTime toDateTime() const;
00307
00308 typedef COWIntrusiveReference<DateTimeData> CIMDateTime::*safe_bool;
00312 operator safe_bool () const;
00313 bool operator!() const;
00314 private:
00315
00316 #ifdef OW_WIN32
00317 #pragma warning (push)
00318 #pragma warning (disable: 4251)
00319 #endif
00320
00321 COWIntrusiveReference<DateTimeData> m_dptr;
00322
00323 #ifdef OW_WIN32
00324 #pragma warning (pop)
00325 #endif
00326
00327 friend OW_COMMON_API bool operator==(const CIMDateTime& x, const CIMDateTime& y);
00334 friend OW_COMMON_API bool operator<(const CIMDateTime& x, const CIMDateTime& y);
00335 };
00336 OW_COMMON_API std::ostream& operator<< (std::ostream& ostr, const CIMDateTime& arg);
00337
00338 bool operator!=(const CIMDateTime& x, const CIMDateTime& y);
00339 bool operator>(const CIMDateTime& x, const CIMDateTime& y);
00340 bool operator<=(const CIMDateTime& x, const CIMDateTime& y);
00341 bool operator>=(const CIMDateTime& x, const CIMDateTime& y);
00342
00343
00344
00345 }
00346
00347 #endif