00001 #ifndef _IT_BUS_DURATION_H_
00002 #define _IT_BUS_DURATION_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 DurationImpl;
00021
00026 class IT_AFC_API Duration : public AnySimpleType
00027 {
00028 public:
00029 typedef IT_Reflect::ValueRef<IT_Bus::Duration> IT_ReflectionType;
00030
00034 Duration() IT_THROW_DECL(());
00035
00055 Duration(
00056 bool isNegative,
00057 Long years,
00058 Long months,
00059 Long days,
00060 Long hours,
00061 Long minutes,
00062 Long seconds,
00063 Long milliseconds
00064 ) IT_THROW_DECL((Exception));
00065
00073 Duration(
00074 const char* value
00075 ) IT_THROW_DECL((Exception));
00076
00084 Duration(
00085 const String& value
00086 ) IT_THROW_DECL((Exception));
00087
00091 Duration(
00092 const Duration& copy
00093 ) IT_THROW_DECL(());
00094
00098 virtual ~Duration();
00099
00100 virtual AnyType&
00101 copy(
00102 const AnyType& rhs
00103 );
00104
00105 virtual void
00106 write_value(
00107 AnySimpleTypeWriter& writer
00108 ) const IT_THROW_DECL((IT_Bus::SerializationException));
00109
00110 virtual void
00111 read_value(
00112 AnySimpleTypeReader& reader
00113 ) IT_THROW_DECL((IT_Bus::DeserializationException));
00114
00119 virtual AnyType::Kind
00120 get_kind() const;
00121
00127 virtual const QName&
00128 get_type() const;
00129
00130 virtual IT_Reflect::Reflection*
00131 get_reflection()
00132 IT_THROW_DECL((IT_Reflect::ReflectException));
00133
00134 virtual const IT_Reflect::Reflection*
00135 get_reflection() const
00136 IT_THROW_DECL((IT_Reflect::ReflectException));
00137
00143 String
00144 to_string() const IT_THROW_DECL(());
00145
00152 void
00153 from_string(
00154 const String& str
00155 ) IT_THROW_DECL((Exception));
00156
00162 bool
00163 is_zero() const IT_THROW_DECL(());
00164
00170 bool
00171 is_negative() const IT_THROW_DECL(());
00172
00178 bool
00179 is_years_set() const IT_THROW_DECL(());
00180
00186 bool
00187 is_months_set() const IT_THROW_DECL(());
00188
00194 bool
00195 is_days_set() const IT_THROW_DECL(());
00196
00202 bool
00203 is_hours_set() const IT_THROW_DECL(());
00204
00210 bool
00211 is_minutes_set() const IT_THROW_DECL(());
00212
00218 bool
00219 is_seconds_set() const IT_THROW_DECL(());
00220
00227 bool
00228 is_seconds_fraction_set() const IT_THROW_DECL(());
00229
00235 Long
00236 get_years() const IT_THROW_DECL(());
00237
00243 Long
00244 get_months() const IT_THROW_DECL(());
00245
00251 Long
00252 get_days() const IT_THROW_DECL(());
00253
00259 Long
00260 get_hours() const IT_THROW_DECL(());
00261
00267 Long
00268 get_minutes() const IT_THROW_DECL(());
00269
00276 Long
00277 get_seconds() const IT_THROW_DECL(());
00278
00285 Long
00286 get_seconds_fraction() const IT_THROW_DECL(());
00287
00291 void
00292 reset() IT_THROW_DECL(());
00293
00299 void
00300 set_is_negative(
00301 bool is_negative
00302 ) IT_THROW_DECL(());
00303
00310 void
00311 set_years(
00312 Long years
00313 ) IT_THROW_DECL(());
00314
00321 void
00322 set_months(
00323 Long months
00324 ) IT_THROW_DECL(());
00325
00332 void
00333 set_days(
00334 Long days
00335 ) IT_THROW_DECL(());
00336
00343 void
00344 set_hours(
00345 Long hours
00346 ) IT_THROW_DECL(());
00347
00354 void
00355 set_minutes(
00356 Long minutes
00357 ) IT_THROW_DECL(());
00358
00375 void
00376 set_seconds(
00377 Long seconds,
00378 Long milliseconds
00379 ) IT_THROW_DECL((Exception));
00380
00386 bool
00387 operator==(
00388 const Duration& other
00389 ) const IT_THROW_DECL(());
00390
00396 bool
00397 operator!=(
00398 const Duration& other
00399 ) const IT_THROW_DECL(());
00400
00404 Duration&
00405 operator=(
00406 const Duration& rhs
00407 ) IT_THROW_DECL(());
00408
00409 static const QName&
00410 get_static_type();
00411
00412 private:
00413 DurationImpl* m_impl;
00414
00415 friend class DateTime;
00416 friend class Date;
00417 friend class Time;
00418 friend class GYearMonth;
00419 friend class GYear;
00420 friend class GMonthDay;
00421 friend class GMonth;
00422 friend class GDay;
00423 };
00424
00428 extern IT_AFC_API Duration
00429 operator+(
00430 const Duration& rhs
00431 ) IT_THROW_DECL(());
00432
00436 extern IT_AFC_API Duration
00437 operator-(
00438 const Duration& rhs
00439 ) IT_THROW_DECL(());
00440
00441 }
00442
00443 #endif
00444