#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 () IT_THROW_DECL(()) | |
Default constructor. | |
Duration (bool isNegative, Long years, Long months, Long days, Long hours, Long minutes, Long seconds, Long milliseconds) IT_THROW_DECL((Exception)) | |
Constructor. | |
Duration (const char *value) IT_THROW_DECL((Exception)) | |
Constructor. | |
Duration (const String &value) IT_THROW_DECL((Exception)) | |
Constructor. | |
Duration (const Duration ©) IT_THROW_DECL(()) | |
Copy constructor. | |
virtual | ~Duration () |
Destructor. | |
virtual const QName & | get_type () const |
Returns the IT_Bus::QName for the type. | |
void | from_string (const String &str) IT_THROW_DECL((Exception)) |
Initializes this instance with the duration corresponding to the string argument. | |
bool | is_zero () const IT_THROW_DECL(()) |
Returns whether or not the duration is zero. | |
bool | is_negative () const IT_THROW_DECL(()) |
Returns whether or not the duration is negative. | |
bool | is_years_set () const IT_THROW_DECL(()) |
Returns whether or not the years item in the duration is set. | |
bool | is_months_set () const IT_THROW_DECL(()) |
Returns whether or not the months item in the duration is set. | |
bool | is_days_set () const IT_THROW_DECL(()) |
Returns whether or not the days item in the duration is set. | |
bool | is_hours_set () const IT_THROW_DECL(()) |
Returns whether or not the hours item in the duration is set. | |
bool | is_minutes_set () const IT_THROW_DECL(()) |
Returns whether or not the minutes item in the duration is set. | |
bool | is_seconds_set () const IT_THROW_DECL(()) |
Returns whether or not the seconds item in the duration is set. | |
bool | is_seconds_fraction_set () const IT_THROW_DECL(()) |
Returns whether or not the fractional part of the seconds item in the duration is set. | |
Long | get_years () const IT_THROW_DECL(()) |
Returns the value of the years item in the duration. | |
Long | get_months () const IT_THROW_DECL(()) |
Returns the value of the months item in the duration. | |
Long | get_days () const IT_THROW_DECL(()) |
Returns the value of the days item in the duration. | |
Long | get_hours () const IT_THROW_DECL(()) |
Returns the value of the hours item in the duration. | |
Long | get_minutes () const IT_THROW_DECL(()) |
Returns the value of the minutes item in the duration. | |
Long | get_seconds () const IT_THROW_DECL(()) |
Returns the value of the non-fractional part of the seconds item in the duration. | |
Long | get_seconds_fraction () const IT_THROW_DECL(()) |
Returns the value of the fractional part of the seconds item in the duration as milliseconds. | |
void | reset () IT_THROW_DECL(()) |
Reset the duration to zero. | |
void | set_is_negative (bool is_negative) IT_THROW_DECL(()) |
Sets whether or not the duration is negative. | |
void | set_years (Long years) IT_THROW_DECL(()) |
Set the years item in the duration. | |
void | set_months (Long months) IT_THROW_DECL(()) |
Set the months item in the duration. | |
void | set_days (Long days) IT_THROW_DECL(()) |
Set the days item in the duration. | |
void | set_hours (Long hours) IT_THROW_DECL(()) |
Set the hours item in the duration. | |
void | set_minutes (Long minutes) IT_THROW_DECL(()) |
Set the minutes item in the duration. | |
void | set_seconds (Long seconds, Long milliseconds) IT_THROW_DECL((Exception)) |
Set the seconds item in the duration. | |
bool | operator== (const Duration &other) const IT_THROW_DECL(()) |
Equality operator. | |
bool | operator!= (const Duration &other) const IT_THROW_DECL(()) |
Inequality operator. | |
Duration & | operator= (const Duration &rhs) IT_THROW_DECL(()) |
Assignment operator. | |
Public Attributes | |
virtual IT_Reflect::Reflection *virtual get_reflection() IT_THROW_DECL((IT_Reflect const IT_Reflect::Reflection *get_reflection() const IT_THROW_DECL((IT_Reflect Strin | to_string )() const IT_THROW_DECL(()) |
Returns a string representation of the duration. | |
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 | |||
) |
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 | ) |
IT_Bus::Duration::Duration | ( | const String & | value | ) |
void IT_Bus::Duration::from_string | ( | const String & | str | ) |
Initializes this instance with the duration corresponding to the string argument.
String | representation of the duration. |
Long IT_Bus::Duration::get_days | ( | ) | const |
Returns the value of the days item in the duration.
Long IT_Bus::Duration::get_hours | ( | ) | const |
Returns the value of the hours item in the duration.
Long IT_Bus::Duration::get_minutes | ( | ) | const |
Returns the value of the minutes item in the duration.
Long IT_Bus::Duration::get_months | ( | ) | const |
Returns the value of the months item in the duration.
Long IT_Bus::Duration::get_seconds | ( | ) | const |
Returns the value of the non-fractional part of the seconds item in the duration.
Long IT_Bus::Duration::get_seconds_fraction | ( | ) | const |
Returns the value of the fractional part of the seconds item in the duration as milliseconds.
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.
Long IT_Bus::Duration::get_years | ( | ) | const |
Returns the value of the years item in the duration.
bool IT_Bus::Duration::is_days_set | ( | ) | const |
Returns whether or not the days item in the duration is set.
bool IT_Bus::Duration::is_hours_set | ( | ) | const |
Returns whether or not the hours item in the duration is set.
bool IT_Bus::Duration::is_minutes_set | ( | ) | const |
Returns whether or not the minutes item in the duration is set.
bool IT_Bus::Duration::is_months_set | ( | ) | const |
Returns whether or not the months item in the duration is set.
bool IT_Bus::Duration::is_negative | ( | ) | const |
Returns whether or not the duration is negative.
bool IT_Bus::Duration::is_seconds_fraction_set | ( | ) | const |
Returns whether or not the fractional part of the seconds item in the duration is set.
bool IT_Bus::Duration::is_seconds_set | ( | ) | const |
Returns whether or not the seconds item in the duration is set.
bool IT_Bus::Duration::is_years_set | ( | ) | const |
Returns whether or not the years item in the duration is set.
bool IT_Bus::Duration::is_zero | ( | ) | const |
Returns whether or not the duration is zero.
bool IT_Bus::Duration::operator!= | ( | const Duration & | other | ) | const |
Inequality operator.
Compares two durations for inequality.
bool IT_Bus::Duration::operator== | ( | const Duration & | other | ) | const |
Equality operator.
Compares two durations for equality.
void IT_Bus::Duration::set_days | ( | Long | days | ) |
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 | ) |
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_is_negative | ( | bool | is_negative | ) |
Sets whether or not the duration is negative.
bool | whether or not the duration is negative. |
void IT_Bus::Duration::set_minutes | ( | Long | minutes | ) |
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. |
void IT_Bus::Duration::set_months | ( | Long | months | ) |
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. |
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. |
void IT_Bus::Duration::set_years | ( | Long | years | ) |
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. |
virtual IT_Reflect::Reflection* virtual get_reflection () IT_THROW_DECL((IT_Reflect const IT_Reflect::Reflection* get_reflection () const IT_THROW_DECL((IT_Reflect Strin IT_Bus::Duration::to_string)() const IT_THROW_DECL(()) |