Class that represents duration. More...
#include <duration.h>
Public Member Functions | |
Duration (int seconds=1) | |
Duration (int weeks, int days, int hours=0, int minutes=0, int seconds=0) | |
int | weeks () const |
int | days () const |
int | hours () const |
int | minutes () const |
int | seconds () const |
int | totalSeconds () const |
QString | toString () const |
bool | operator== (const Duration &other) const |
bool | operator< (const Duration &other) const |
bool | operator> (const Duration &other) const |
Private Attributes | |
int | secs |
Related Functions | |
(Note that these are not member functions.) | |
QDateTime | operator+ (const QDateTime &left, const domain::Duration &right) |
Class that represents duration.
A duration can either be represented as a time in seconds or a time as a combination of weeks/days/hours/minutes/seconds.
Definition at line 19 of file duration.h.
domain::Duration::Duration | ( | int | seconds = 1 |
) |
Creates new Duration
seconds | The total number of seconds for this duration |
Definition at line 29 of file duration.cpp.
domain::Duration::Duration | ( | int | weeks, | |
int | days, | |||
int | hours = 0 , |
|||
int | minutes = 0 , |
|||
int | seconds = 0 | |||
) |
Creates new Duration.
weeks | The number of weeks for this duration | |
days | The number of days for this duration | |
hours | The number of hours for this duration | |
minutes | The number of minutes for this duration | |
seconds | The number of seconds for this duration |
Definition at line 41 of file duration.cpp.
int domain::Duration::days | ( | ) | const |
Returns the number of days of this duration
Definition at line 78 of file duration.cpp.
int domain::Duration::hours | ( | ) | const |
Returns the number of hours of this duration
Definition at line 83 of file duration.cpp.
int domain::Duration::minutes | ( | ) | const |
Returns the number of minutes of this duration
Definition at line 89 of file duration.cpp.
bool domain::Duration::operator< | ( | const Duration & | other | ) | const |
Indicates whether this duration is shorter than the given duration.
Definition at line 128 of file duration.cpp.
bool domain::Duration::operator== | ( | const Duration & | other | ) | const |
Indicates whether this duration is equal to the given duration.
Definition at line 123 of file duration.cpp.
bool domain::Duration::operator> | ( | const Duration & | other | ) | const |
Indicates whether this duration is longer than the given duration.
Definition at line 133 of file duration.cpp.
int domain::Duration::seconds | ( | ) | const |
Returns the number of seconds of this duration
Definition at line 95 of file duration.cpp.
QString domain::Duration::toString | ( | ) | const |
Returns a string representation of this duration
Definition at line 105 of file duration.cpp.
int domain::Duration::totalSeconds | ( | ) | const |
Returns the total number of seconds of this duration
Definition at line 100 of file duration.cpp.
int domain::Duration::weeks | ( | ) | const |
Returns the number of weeks of this duration
Definition at line 73 of file duration.cpp.
QDateTime operator+ | ( | const QDateTime & | left, | |
const domain::Duration & | right | |||
) | [related] |
Returns the time that is the given duration after the given time.
Definition at line 140 of file duration.cpp.