KCalendarCore::Period
#include <period.h>
Public Types | |
typedef QList< Period > | List |
Public Member Functions | |
Period () | |
Period (const Period &period) | |
Period (const QDateTime &start, const Duration &duration) | |
Period (const QDateTime &start, const QDateTime &end) | |
~Period () | |
Duration | duration () const |
Duration | duration (Duration::Type type) const |
QDateTime | end () const |
bool | hasDuration () const |
bool | isValid () 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 QTimeZone &oldZone, const QTimeZone &newZone) |
QDateTime | start () const |
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
◆ List
Constructor & Destructor Documentation
◆ Period() [1/4]
Period::Period | ( | ) |
Constructs a period without a duration.
Definition at line 52 of file period.cpp.
◆ Period() [2/4]
Constructs a period from start
to end
.
- Parameters
-
start the time the period begins. end the time the period ends.
Definition at line 57 of file period.cpp.
◆ Period() [3/4]
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 62 of file period.cpp.
◆ Period() [4/4]
Period::Period | ( | const Period & | period | ) |
Constructs a period by copying another period object.
- Parameters
-
period the period to copy
Definition at line 68 of file period.cpp.
◆ ~Period()
Period::~Period | ( | ) |
Destroys a period.
Definition at line 73 of file period.cpp.
Member Function Documentation
◆ duration() [1/2]
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 115 of file period.cpp.
◆ duration() [2/2]
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 124 of file period.cpp.
◆ end()
QDateTime Period::end | ( | ) | const |
Returns when this period ends.
Definition at line 110 of file period.cpp.
◆ hasDuration()
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 129 of file period.cpp.
◆ isValid()
bool Period::isValid | ( | ) | const |
◆ operator!=()
|
inline |
Returns true if this period is not equal to the other
one.
- Parameters
-
other the other period to compare
- See also
- operator==()
◆ 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 78 of file period.cpp.
◆ operator=()
Sets this period equal to the other
one.
- Parameters
-
other is the other period to compare.
Definition at line 89 of file period.cpp.
◆ operator==()
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 83 of file period.cpp.
◆ operator>()
|
inline |
◆ shiftTimes()
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
-
oldZone the time zone which provides the clock times newZone the new time zone
Definition at line 134 of file period.cpp.
◆ start()
QDateTime Period::start | ( | ) | const |
Returns when this period starts.
Definition at line 105 of file period.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:01:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.