00001 #ifndef _IT_BUS_TIME_H_
00002 #define _IT_BUS_TIME_H_
00003
00004
00005
00006
00007 #include <it_bus/types.h>
00008 #include <it_bus/exception.h>
00009 #include <it_bus/api_defines.h>
00010 #include <it_bus/any_simple_type.h>
00011
00012 namespace IT_Reflect
00013 {
00014 class Reflection;
00015 template <class T> class ValueRef;
00016 }
00017
00018 namespace IT_Bus
00019 {
00020 class Duration;
00021 class TimeImpl;
00022
00027 class IT_AFC_API Time : public AnySimpleType
00028 {
00029 public:
00030 typedef IT_Reflect::ValueRef<IT_Bus::Time> IT_ReflectionType;
00031
00042 Time(
00043 short wHour = 0,
00044 short wMinute = 0,
00045 short wSecond = 0,
00046 short wMilliseconds = 0
00047 ) throw((Exception));
00048
00056 Time(
00057 const char* value
00058 ) throw((Exception));
00059
00067 Time(
00068 const String& value
00069 ) throw((Exception));
00070
00074 Time(
00075 const Time& copy
00076 );
00077
00081 virtual ~Time();
00082
00088 virtual AnyType&
00089 copy(
00090 const AnyType& rhs
00091 );
00092
00093 virtual void
00094 write_value(
00095 AnySimpleTypeWriter& writer
00096 ) const throw((IT_Bus::SerializationException));
00097
00098 virtual void
00099 read_value(
00100 AnySimpleTypeReader& reader
00101 ) throw((IT_Bus::DeserializationException));
00102
00107 virtual AnyType::Kind
00108 get_kind() const;
00109
00114 virtual const QName&
00115 get_type() const;
00116
00117 virtual IT_Reflect::Reflection*
00118 get_reflection()
00119 throw((IT_Reflect::ReflectException));
00120
00121 virtual const IT_Reflect::Reflection*
00122 get_reflection() const
00123 throw((IT_Reflect::ReflectException));
00124
00130 String
00131 to_string() const;
00132
00138 void
00139 from_string(
00140 const String& str
00141 ) throw((Exception));
00142
00149 short
00150 getHour() const;
00151
00157 void
00158 setHour(
00159 short wHour
00160 ) throw((Exception));
00161
00168 short
00169 getMinute() const;
00170
00176 void
00177 setMinute(
00178 short wMinute
00179 ) throw((Exception));
00180
00187 short
00188 getSecond() const;
00189
00195 void
00196 setSecond(
00197 short wSecond
00198 ) throw((Exception));
00199
00206 short
00207 getMilliseconds() const;
00208
00214 void
00215 setMilliseconds(
00216 short wMilliseconds
00217 ) throw((Exception));
00218
00224 bool
00225 haveUTCTimeZoneOffset() const;
00226
00230 void
00231 setLocalTimeZone();
00232
00239 void
00240 setUTCTimeZoneOffset(
00241 short hour_offset,
00242 short minute_offset
00243 ) throw((Exception));
00244
00250 void
00251 getUTCTimeZoneOffset(
00252 short& hour_offset,
00253 short& minute_offset
00254 ) const;
00255
00261 bool
00262 operator==(
00263 const Time& other
00264 ) const;
00265
00271 bool
00272 operator!=(
00273 const Time& other
00274 ) const;
00275
00279 Time&
00280 operator=(
00281 const Time& rhs
00282 );
00283
00287 Time&
00288 operator+=(
00289 const Duration& rhs
00290 ) throw((IT_Bus::Exception));
00291
00295 Time&
00296 operator-=(
00297 const Duration& rhs
00298 ) throw((IT_Bus::Exception));
00299
00300 static const QName&
00301 get_static_type();
00302
00303 private:
00304 TimeImpl* m_impl;
00305 };
00306
00310 extern IT_AFC_API Time
00311 operator+(
00312 const Time& lhs,
00313 const Duration& rhs
00314 ) throw((IT_Bus::Exception));
00315
00319 extern IT_AFC_API Time
00320 operator-(
00321 const Time& lhs,
00322 const Duration& rhs
00323 ) throw((IT_Bus::Exception));
00324
00325 }
00326
00327 #endif