#include <it_bus/duration.h>
Inheritance diagram for IT_Bus::Duration:
Definition at line 26 of file duration.h.
Public Types | |
typedef IT_Reflect::ValueRef< IT_Bus::Duration > | IT_ReflectionType |
Public Member Functions | |
Duration () throw (()) | |
Default constructor. | |
Duration (bool isNegative, Long years, Long months, Long days, Long hours, Long minutes, Long seconds, Long milliseconds) throw ((Exception)) | |
Constructor. | |
Duration (const char *value) throw ((Exception)) | |
Constructor. | |
Duration (const String &value) throw ((Exception)) | |
Constructor. | |
Duration (const Duration ©) throw (()) | |
Copy constructor. | |
virtual | ~Duration () |
Destructor. | |
virtual AnyType & | copy (const AnyType &rhs) |
Returns a reference to an AnyType that is a copy of the AnyType parameter. | |
virtual void | write_value (AnySimpleTypeWriter &writer) const throw ((IT_Bus::SerializationException)) |
Write the instance value. | |
virtual void | read_value (AnySimpleTypeReader &reader) throw ((IT_Bus::DeserializationException)) |
Read the value into the instance. | |
virtual AnyType::Kind | get_kind () const |
Returns the IT_Bus::AnyType::Kind for the type. | |
virtual const QName & | get_type () const |
Returns the IT_Bus::QName for the type. | |
virtual IT_Reflect::Reflection * | get_reflection () throw ((IT_Reflect::ReflectException)) |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance. | |
virtual const IT_Reflect::Reflection * | get_reflection () const throw ((IT_Reflect::ReflectException)) |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance. | |
String | to_string () const throw (()) |
Returns a string representation of the duration. | |
void | from_string (const String &str) throw ((Exception)) |
Initializes this instance with the duration corresponding to the string argument. | |
bool | is_zero () const throw (()) |
Returns whether or not the duration is zero. | |
bool | is_negative () const throw (()) |
Returns whether or not the duration is negative. | |
bool | is_years_set () const throw (()) |
Returns whether or not the years item in the duration is set. | |
bool | is_months_set () const throw (()) |
Returns whether or not the months item in the duration is set. | |
bool | is_days_set () const throw (()) |
Returns whether or not the days item in the duration is set. | |
bool | is_hours_set () const throw (()) |
Returns whether or not the hours item in the duration is set. | |
bool | is_minutes_set () const throw (()) |
Returns whether or not the minutes item in the duration is set. | |
bool | is_seconds_set () const throw (()) |
Returns whether or not the seconds item in the duration is set. | |
bool | is_seconds_fraction_set () const throw (()) |
Returns whether or not the fractional part of the seconds item in the duration is set. | |
Long | get_years () const throw (()) |
Returns the value of the years item in the duration. | |
Long | get_months () const throw (()) |
Returns the value of the months item in the duration. | |
Long | get_days () const throw (()) |
Returns the value of the days item in the duration. | |
Long | get_hours () const throw (()) |
Returns the value of the hours item in the duration. | |
Long | get_minutes () const throw (()) |
Returns the value of the minutes item in the duration. | |
Long | get_seconds () const throw (()) |
Returns the value of the non-fractional part of the seconds item in the duration. | |
Long | get_seconds_fraction () const throw (()) |
Returns the value of the fractional part of the seconds item in the duration as milliseconds. | |
void | reset () throw (()) |
Reset the duration to zero. | |
void | set_is_negative (bool is_negative) throw (()) |
Sets whether or not the duration is negative. | |
void | set_years (Long years) throw (()) |
Set the years item in the duration. | |
void | set_months (Long months) throw (()) |
Set the months item in the duration. | |
void | set_days (Long days) throw (()) |
Set the days item in the duration. | |
void | set_hours (Long hours) throw (()) |
Set the hours item in the duration. | |
void | set_minutes (Long minutes) throw (()) |
Set the minutes item in the duration. | |
void | set_seconds (Long seconds, Long milliseconds) throw ((Exception)) |
Set the seconds item in the duration. | |
bool | operator== (const Duration &other) const throw (()) |
Equality operator. | |
bool | operator!= (const Duration &other) const throw (()) |
Inequality operator. | |
Duration & | operator= (const Duration &rhs) throw (()) |
Assignment operator. | |
Private Attributes | |
DurationImpl * | m_impl |
Friends | |
class | DateTime |
class | Date |
class | Time |
class | GYearMonth |
class | GYear |
class | GMonthDay |
class | GMonth |
class | GDay |
IT_Bus::Duration::Duration | ( | bool | isNegative, | |
Long | years, | |||
Long | months, | |||
Long | days, | |||
Long | hours, | |||
Long | minutes, | |||
Long | seconds, | |||
Long | milliseconds | |||
) | throw ((Exception)) |
Constructor.
The seconds and milliseconds values will be normalized so that milliseconds is less than 1000. A value that is less than zero indicates that the item should not be set.
isNegative | is this a negative duration? | |
years | the number of years in the duration | |
months | the number of months in the duration | |
days | the number of days in the duration | |
hours | the number of hours in the duration | |
minutes | the number of minutes in the duration | |
seconds | the number of seconds in the duration | |
milliseconds | the number of milliseconds in the duration |
Exception | if the normalization of the seconds and milliseconds would result in an overflow. |
IT_Bus::Duration::Duration | ( | const char * | value | ) | throw ((Exception)) |
Returns a reference to an AnyType that is a copy of the AnyType parameter.
Derived classes override this method, providing an appropriate implementation. In this base class, this method is not supported; an exception is always thrown.
AnyType | to be copied. |
IT_Bus::Exception | with message "Copy not supported" |
Reimplemented from IT_Bus::AnyType.
virtual void IT_Bus::Duration::write_value | ( | AnySimpleTypeWriter & | writer | ) | const throw ((IT_Bus::SerializationException)) [virtual] |
virtual void IT_Bus::Duration::read_value | ( | AnySimpleTypeReader & | reader | ) | throw ((IT_Bus::DeserializationException)) [virtual] |
Read the value into the instance.
Derived classes implement this method.
Implements IT_Bus::AnySimpleType.
virtual AnyType::Kind IT_Bus::Duration::get_kind | ( | ) | const [virtual] |
Returns the IT_Bus::AnyType::Kind for the type.
Reimplemented from IT_Bus::AnySimpleType.
virtual const QName& IT_Bus::Duration::get_type | ( | ) | const [virtual] |
Returns the IT_Bus::QName for the type.
Derived subclasses implement this method and return their QName.
Implements IT_Bus::AnyType.
virtual IT_Reflect::Reflection* IT_Bus::Duration::get_reflection | ( | ) | throw ((IT_Reflect::ReflectException)) [virtual] |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance.
IT_Reflect::ReflectException |
Reimplemented from IT_Bus::AnyType.
virtual const IT_Reflect::Reflection* IT_Bus::Duration::get_reflection | ( | ) | const throw ((IT_Reflect::ReflectException)) [virtual] |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance.
IT_Reflect::ReflectException |
Reimplemented from IT_Bus::AnyType.
String IT_Bus::Duration::to_string | ( | ) | const throw (()) |
Initializes this instance with the duration corresponding to the string argument.
String | representation of the duration. |
bool IT_Bus::Duration::is_zero | ( | ) | const throw (()) |
Returns whether or not the duration is zero.
bool IT_Bus::Duration::is_negative | ( | ) | const throw (()) |
Returns whether or not the duration is negative.
bool IT_Bus::Duration::is_years_set | ( | ) | const throw (()) |
Returns whether or not the years item in the duration is set.
bool IT_Bus::Duration::is_months_set | ( | ) | const throw (()) |
Returns whether or not the months item in the duration is set.
bool IT_Bus::Duration::is_days_set | ( | ) | const throw (()) |
Returns whether or not the days item in the duration is set.
bool IT_Bus::Duration::is_hours_set | ( | ) | const throw (()) |
Returns whether or not the hours item in the duration is set.
bool IT_Bus::Duration::is_minutes_set | ( | ) | const throw (()) |
Returns whether or not the minutes item in the duration is set.
bool IT_Bus::Duration::is_seconds_set | ( | ) | const throw (()) |
Returns whether or not the seconds item in the duration is set.
bool IT_Bus::Duration::is_seconds_fraction_set | ( | ) | const throw (()) |
Returns whether or not the fractional part of the seconds item in the duration is set.
Long IT_Bus::Duration::get_years | ( | ) | const throw (()) |
Returns the value of the years item in the duration.
Long IT_Bus::Duration::get_months | ( | ) | const throw (()) |
Returns the value of the months item in the duration.
Long IT_Bus::Duration::get_days | ( | ) | const throw (()) |
Returns the value of the days item in the duration.
Long IT_Bus::Duration::get_hours | ( | ) | const throw (()) |
Returns the value of the hours item in the duration.
Long IT_Bus::Duration::get_minutes | ( | ) | const throw (()) |
Returns the value of the minutes item in the duration.
Long IT_Bus::Duration::get_seconds | ( | ) | const throw (()) |
Returns the value of the non-fractional part of the seconds item in the duration.
Long IT_Bus::Duration::get_seconds_fraction | ( | ) | const throw (()) |
Returns the value of the fractional part of the seconds item in the duration as milliseconds.
void IT_Bus::Duration::set_is_negative | ( | bool | is_negative | ) | throw (()) |
Sets whether or not the duration is negative.
bool | whether or not the duration is negative. |
void IT_Bus::Duration::set_years | ( | Long | years | ) | throw (()) |
Set the years item in the duration.
A value that is less than zero unsets the item.
IT_Bus::Long | representing the number of years. |
void IT_Bus::Duration::set_months | ( | Long | months | ) | throw (()) |
Set the months item in the duration.
A value that is less than zero unsets the item.
IT_Bus::Long | representing the number of months. |
void IT_Bus::Duration::set_days | ( | Long | days | ) | throw (()) |
Set the days item in the duration.
A value that is less than zero unsets the item.
IT_Bus::Long | representing the number of days. |
void IT_Bus::Duration::set_hours | ( | Long | hours | ) | throw (()) |
Set the hours item in the duration.
A value that is less than zero unsets the item.
IT_Bus::Long | representing the number of hours. |
void IT_Bus::Duration::set_minutes | ( | Long | minutes | ) | throw (()) |
Set the minutes item in the duration.
A value that is less than zero unsets the item.
IT_Bus::Long | representing the number of minutes. |
Set the seconds item in the duration.
The fractional part of the seconds item is set using milliseconds. A second value that is less than zero unsets the item. A millisecond value that is less than zero indicates that item should not contain a fractional part.
The seconds and milliseconds values will be normalized so that milliseconds is less than 1000.
IT_Bus::Long | representing the number of seconds. | |
IT_Bus::Long | representing the number of milliseconds. |
Exception | if the normalization of the seconds and milliseconds would result in an overflow. |
bool IT_Bus::Duration::operator== | ( | const Duration & | other | ) | const throw (()) |
Equality operator.
Compares two durations for equality.
bool IT_Bus::Duration::operator!= | ( | const Duration & | other | ) | const throw (()) |
Inequality operator.
Compares two durations for inequality.