00001 #ifndef _IT_BUS_DATE_H_
00002 #define _IT_BUS_DATE_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 DateImpl;
00022
00027 class IT_AFC_API Date : public AnySimpleType
00028 {
00029 public:
00030 typedef IT_Reflect::ValueRef<IT_Bus::Date> IT_ReflectionType;
00031
00035 Date();
00036
00046 Date(
00047 short wYear,
00048 short wMonth,
00049 short wDay
00050 ) throw((Exception));
00051
00059 Date(
00060 const char* value
00061 ) throw((Exception));
00062
00070 Date(
00071 const String& value
00072 ) throw((Exception));
00073
00077 Date(
00078 const Date& copy
00079 );
00080
00084 virtual ~Date();
00085
00086 virtual AnyType&
00087 copy(
00088 const AnyType& rhs
00089 );
00090
00091 virtual void
00092 write_value(
00093 AnySimpleTypeWriter& writer
00094 ) const throw((IT_Bus::SerializationException));
00095
00096 virtual void
00097 read_value(
00098 AnySimpleTypeReader& reader
00099 ) throw((IT_Bus::DeserializationException));
00100
00105 virtual AnyType::Kind
00106 get_kind() const;
00107
00113 virtual const QName&
00114 get_type() const;
00115
00116 virtual IT_Reflect::Reflection*
00117 get_reflection()
00118 throw((IT_Reflect::ReflectException));
00119
00120 virtual const IT_Reflect::Reflection*
00121 get_reflection() const
00122 throw((IT_Reflect::ReflectException));
00123
00129 String
00130 to_string() const;
00131
00137 void
00138 from_string(
00139 const String& str
00140 ) throw((Exception));
00141
00148 short
00149 getYear() const;
00150
00156 void
00157 setYear(
00158 short wYear
00159 ) throw((Exception));
00160
00167 short
00168 getMonth() const;
00169
00175 void
00176 setMonth(
00177 short wMonth
00178 ) throw((Exception));
00179
00186 short
00187 getDay() const;
00188
00194 void
00195 setDay(
00196 short wDay
00197 ) throw((Exception));
00198
00204 bool
00205 haveUTCTimeZoneOffset() const;
00206
00210 void
00211 setLocalTimeZone();
00212
00219 void
00220 setUTCTimeZoneOffset(
00221 short hour_offset,
00222 short minute_offset
00223 ) throw((Exception));
00224
00230 void
00231 getUTCTimeZoneOffset(
00232 short& hour_offset,
00233 short& minute_offset
00234 ) const;
00235
00241 bool
00242 operator==(
00243 const Date& other
00244 ) const;
00245
00251 bool
00252 operator!=(
00253 const Date& other
00254 ) const;
00255
00259 Date&
00260 operator=(
00261 const Date& rhs
00262 );
00263
00267 Date&
00268 operator+=(
00269 const Duration& rhs
00270 ) throw((IT_Bus::Exception));
00271
00275 Date&
00276 operator-=(
00277 const Duration& rhs
00278 ) throw((IT_Bus::Exception));
00279
00280 static const QName&
00281 get_static_type();
00282
00283 private:
00284 DateImpl* m_impl;
00285 };
00286
00290 extern IT_AFC_API Date
00291 operator+(
00292 const Date& lhs,
00293 const Duration& rhs
00294 ) throw((IT_Bus::Exception));
00295
00299 extern IT_AFC_API Date
00300 operator-(
00301 const Date& lhs,
00302 const Duration& rhs
00303 ) throw((IT_Bus::Exception));
00304
00305 }
00306
00307 #endif