00001 #ifndef _IT_BUS_DATE_TIME_H_
00002 #define _IT_BUS_DATE_TIME_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <it_cal/types.h>
00013 #include <it_bus/exception.h>
00014 #include <it_bus/api_defines.h>
00015
00016 namespace IT_Bus
00017 {
00018 class Duration;
00019 class TimeConverter;
00020 class DateTimeImpl;
00021
00028 class IT_AFC_API DateTime
00029 {
00030 public:
00034 DateTime();
00035
00049 DateTime(
00050 short wYear,
00051 short wMonth,
00052 short wDay,
00053 short wHour = 0,
00054 short wMinute = 0,
00055 short wSecond = 0,
00056 short wMilliseconds = 0
00057 ) IT_THROW_DECL((Exception));
00058
00066 DateTime(
00067 const char* value
00068 ) IT_THROW_DECL((Exception));
00069
00077 DateTime(
00078 const String& value
00079 ) IT_THROW_DECL((Exception));
00080
00084 DateTime(
00085 const DateTime& copy
00086 );
00087
00091 ~DateTime();
00092
00096 DateTime&
00097 operator=(
00098 const DateTime& rhs
00099 );
00100
00106 String
00107 to_string() const;
00108
00114 void
00115 from_string(
00116 const String& str
00117 ) IT_THROW_DECL((Exception));
00118
00125 short
00126 getYear() const;
00127
00133 void
00134 setYear(
00135 short wYear
00136 ) IT_THROW_DECL((Exception));
00137
00144 short
00145 getMonth() const;
00146
00152 void
00153 setMonth(
00154 short wMonth
00155 ) IT_THROW_DECL((Exception));
00156
00163 short
00164 getDay() const;
00165
00171 void
00172 setDay(
00173 short wDay
00174 ) IT_THROW_DECL((Exception));
00175
00182 short
00183 getHour() const;
00184
00190 void
00191 setHour(
00192 short wHour
00193 ) IT_THROW_DECL((Exception));
00194
00201 short
00202 getMinute() const;
00203
00209 void
00210 setMinute(
00211 short wMinute
00212 ) IT_THROW_DECL((Exception));
00213
00220 short
00221 getSecond() const;
00222
00228 void
00229 setSecond(
00230 short wSecond
00231 ) IT_THROW_DECL((Exception));
00232
00239 short
00240 getMilliseconds() const;
00241
00247 void
00248 setMilliseconds(
00249 short wMilliseconds
00250 ) IT_THROW_DECL((Exception));
00251
00257 bool
00258 haveUTCTimeZoneOffset() const;
00259
00263 void
00264 setLocalTimeZone();
00265
00272 void
00273 setUTCTimeZoneOffset(
00274 short hour_offset,
00275 short minute_offset
00276 ) IT_THROW_DECL((Exception));
00277
00283 void
00284 getUTCTimeZoneOffset(
00285 short& hour_offset,
00286 short& minute_offset
00287 ) const;
00288
00294 bool
00295 operator==(
00296 const DateTime& rhs
00297 ) const;
00298
00304 bool
00305 operator!=(
00306 const DateTime& rhs
00307 ) const;
00308
00312 DateTime&
00313 operator+=(
00314 const Duration& rhs
00315 ) IT_THROW_DECL((IT_Bus::Exception));
00316
00320 DateTime&
00321 operator-=(
00322 const Duration& rhs
00323 ) IT_THROW_DECL((IT_Bus::Exception));
00324
00328 static DateTime
00329 current(
00330 ) IT_THROW_DECL((Exception));
00331
00332 private:
00333 DateTimeImpl* m_impl;
00334
00335 friend class TimeConverter;
00336 };
00337
00341 extern IT_AFC_API DateTime
00342 operator+(
00343 const DateTime& lhs,
00344 const Duration& rhs
00345 ) IT_THROW_DECL((IT_Bus::Exception));
00346
00350 extern IT_AFC_API DateTime
00351 operator-(
00352 const DateTime& lhs,
00353 const Duration& rhs
00354 ) IT_THROW_DECL((IT_Bus::Exception));
00355
00356 }
00357
00358 #endif