kplato
KPlato::Duration Class Reference
#include <kptduration.h>
Detailed Description
The duration class can be used to store a timespan in a convenient format.The timespan can be in length in many many hours down to miliseconds.
Definition at line 34 of file kptduration.h.
Public Types | |
enum | Format { Format_DayTime, Format_Day, Format_Hour, Format_HourFraction, Format_i18nDayTime, Format_i18nDay, Format_i18nHour, Format_i18nHourFraction } |
enum | Unit { Unit_d, Unit_h, Unit_m, Unit_s, Unit_ms } |
Public Member Functions | |
Duration () | |
Duration (const Duration &d) | |
Duration (unsigned d, unsigned h, unsigned m, unsigned s=0, unsigned ms=0) | |
Duration (Q_INT64 seconds) | |
~Duration () | |
void | addMilliseconds (Q_INT64 delta) |
void | addSeconds (Q_INT64 delta) |
void | addMinutes (Q_INT64 delta) |
void | addHours (Q_INT64 delta) |
void | addDays (Q_INT64 delta) |
Q_INT64 | milliseconds () const |
Q_INT64 | seconds () const |
Q_INT64 | minutes () const |
unsigned | hours () const |
unsigned | days () const |
void | get (unsigned *days, unsigned *hours, unsigned *minutes, unsigned *seconds=0, unsigned *milliseconds=0) const |
bool | operator== (const Duration &d) const |
bool | operator== (Q_INT64 d) const |
bool | operator!= (const Duration &d) const |
bool | operator!= (Q_INT64 d) const |
bool | operator< (const Duration &d) const |
bool | operator< (Q_INT64 d) const |
bool | operator<= (const Duration &d) const |
bool | operator<= (Q_INT64 d) const |
bool | operator> (const Duration &d) const |
bool | operator> (Q_INT64 d) const |
bool | operator>= (const Duration &d) const |
bool | operator>= (Q_INT64 d) const |
Duration & | operator= (const Duration &d) |
Duration | operator * (int unit) const |
Duration | operator * (const double value) const |
Duration | operator/ (int unit) const |
double | operator/ (const Duration &d) const |
Duration | operator+ (Duration &d) const |
Duration & | operator+= (const Duration &d) |
Duration | operator- (const Duration &d) const |
Duration & | operator-= (const Duration &d) |
QString | toString (Format format=Format_DayTime) const |
double | toDouble (Unit u=Unit_ms) const |
Static Public Member Functions | |
static Duration | fromString (const QString &s, Format format=Format_DayTime, bool *ok=0) |
Static Public Attributes | |
static const Duration | zeroDuration |
Member Enumeration Documentation
|
DayTime = d hh:mm:ss.sss Day = d.ddd Hour = hh:mm HourFraction = h.fraction of an hour.
Definition at line 42 of file kptduration.h. |
Member Function Documentation
|
Adds.
Definition at line 73 of file kptduration.h. |
|
Adds.
Definition at line 68 of file kptduration.h. |
|
Adds.
Definition at line 53 of file kptduration.h. |
|
Adds.
Definition at line 63 of file kptduration.h. |
|
Adds.
Definition at line 58 of file kptduration.h. |
Member Data Documentation
|
This is useful for occasions where we need a zero duration.
Definition at line 126 of file kptduration.h. |
The documentation for this class was generated from the following files: