KCalendarCore::Period

Search for usage in LXR

KCalendarCore::Period Class Reference

#include <period.h>

Inheritance diagram for KCalendarCore::Period:

Public Types

typedef QList< PeriodList
 

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
 
Periodoperator= (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.

Definition at line 37 of file period.h.

Member Typedef Documentation

◆ List

List of periods.

Definition at line 43 of file period.h.

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]

Period::Period ( const QDateTime & start,
const QDateTime & end )

Constructs a period from start to end.

Parameters
startthe time the period begins.
endthe time the period ends.

Definition at line 57 of file period.cpp.

◆ Period() [3/4]

Period::Period ( const QDateTime & start,
const Duration & duration )

Constructs a period from start and lasting duration.

Parameters
startthe time when the period starts.
durationhow 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
periodthe 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
typethe 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

Returns true if the Period is not empty.

Since
5.87

Definition at line 100 of file period.cpp.

◆ operator!=()

bool KCalendarCore::Period::operator!= ( const Period & other) const
inline

Returns true if this period is not equal to the other one.

Parameters
otherthe other period to compare
See also
operator==()

Definition at line 114 of file period.h.

◆ 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
otheris the other period to compare.

Definition at line 78 of file period.cpp.

◆ operator=()

Period & Period::operator= ( const Period & other)

Sets this period equal to the other one.

Parameters
otheris 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
otherthe other period to compare

Definition at line 83 of file period.cpp.

◆ operator>()

bool KCalendarCore::Period::operator> ( const Period & other) const
inline

Returns true if the start of this period is later than the start of the other one.

Parameters
otherthe other period to compare

Definition at line 93 of file period.h.

◆ shiftTimes()

void Period::shiftTimes ( const QTimeZone & oldZone,
const QTimeZone & newZone )

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
oldZonethe time zone which provides the clock times
newZonethe 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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.