KCalCore Library
#include <period.h>
Public Types | |
typedef QVector< Period > | List |
Public Member Functions | |
Period () | |
Period (const KDateTime &start, const KDateTime &end) | |
Period (const KDateTime &start, const Duration &duration) | |
Period (const Period &period) | |
~Period () | |
Duration | duration () const |
Duration | duration (Duration::Type type) const |
KDateTime | end () const |
bool | hasDuration () const |
bool | operator!= (const Period &other) const |
bool | operator< (const Period &other) const |
Period & | operator= (const Period &other) |
bool | operator== (const Period &other) const |
bool | operator> (const Period &other) const |
void | shiftTimes (const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec) |
KDateTime | start () const |
Friends | |
KCALCORE_EXPORT QDataStream & | operator<< (QDataStream &stream, const KCalCore::Period &period) |
KCALCORE_EXPORT QDataStream & | operator>> (QDataStream &stream, KCalCore::Period &period) |
Detailed Description
The period can be defined by either a start time and an end time or by a start time and a duration.
Member Typedef Documentation
typedef QVector<Period> KCalCore::Period::List |
Constructor & Destructor Documentation
Period::Period | ( | ) |
Constructs a period without a duration.
Definition at line 60 of file period.cpp.
Period::Period | ( | const KDateTime & | start, |
const KDateTime & | end | ||
) |
Constructs a period from start
to end
.
- Parameters
-
start the time the period begins. end the time the period ends.
Definition at line 64 of file period.cpp.
Period::Period | ( | const KDateTime & | start, |
const Duration & | duration | ||
) |
Constructs a period from start
and lasting duration
.
- Parameters
-
start the time when the period starts. duration how long the period lasts.
Definition at line 69 of file period.cpp.
Period::Period | ( | const Period & | period | ) |
Constructs a period by copying another period object.
- Parameters
-
period the period to copy
Definition at line 75 of file period.cpp.
Period::~Period | ( | ) |
Destroys a period.
Definition at line 80 of file period.cpp.
Member Function Documentation
Duration Period::duration | ( | ) | const |
Returns the duration of the period.
If the period is defined in terms of a start and end time, the duration is computed from these. In this case, if the time of day in start
and end
is equal, and their time specifications (i.e. time zone etc.) are the same, the duration will be set in terms of days. Otherwise, the duration will be set in terms of seconds.
If the period is defined in terms of a duration, that duration is returned unchanged.
Definition at line 121 of file period.cpp.
Duration Period::duration | ( | Duration::Type | type | ) | const |
Returns the duration of the period.
If the period is defined in terms of a start and end time, the duration is first computed from these.
If type
is Days, and the duration is not an exact number of days, the duration will be rounded down to the nearest whole number of days.
- Parameters
-
type the unit of time to use (seconds or days)
Definition at line 131 of file period.cpp.
KDateTime Period::end | ( | ) | const |
Returns when this period ends.
Definition at line 116 of file period.cpp.
bool Period::hasDuration | ( | ) | const |
Returns true if this period has a set duration, false if it just has a start and an end.
Definition at line 136 of file period.cpp.
|
inline |
Returns true if this period is not equal to the other
one.
- Parameters
-
other the other period to compare
- See also
- operator==()
bool Period::operator< | ( | const Period & | other | ) | const |
Returns true if the start of this period is earlier than the start of the other
one.
- Parameters
-
other is the other period to compare.
Definition at line 85 of file period.cpp.
Sets this period equal to the other
one.
- Parameters
-
other is the other period to compare.
Definition at line 100 of file period.cpp.
bool Period::operator== | ( | const Period & | other | ) | const |
Returns true if this period is equal to the other
one.
Even if their start and end times are the same, two periods are considered not equal if one is defined in terms of a duration and the other in terms of a start and end time.
- Parameters
-
other the other period to compare
Definition at line 90 of file period.cpp.
|
inline |
void Period::shiftTimes | ( | const KDateTime::Spec & | oldSpec, |
const KDateTime::Spec & | newSpec | ||
) |
Shift the times of the period so that they appear at the same clock time as before but in a new time zone.
The shift is done from a viewing time zone rather than from the actual period time zone.
For example, shifting a period whose start time is 09:00 America/New York, using an old viewing time zone (oldSpec
) of Europe/London, to a new time zone (newSpec
) of Europe/Paris, will result in the time being shifted from 14:00 (which is the London time of the period start) to 14:00 Paris time.
- Parameters
-
oldSpec the time specification which provides the clock times newSpec the new time specification
Definition at line 141 of file period.cpp.
KDateTime Period::start | ( | ) | const |
Returns when this period starts.
Definition at line 111 of file period.cpp.
Friends And Related Function Documentation
|
friend |
Write period
to the datastream stream
, in binary format.
|
friend |
Read a Period object into period
from stream
, in binary format.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:36:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.