KCalendarCore

occurrenceiterator.h
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 SPDX-FileCopyrightText: 2013 Christian Mollekopf <mollekopf@kolabsys.com>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8/**
9 @file
10 This file is part of the API for handling calendar data and
11 defines the OccurrenceIterator class.
12
13 @author Christian Mollekopf <mollekopf@kolabsys.com>
14 */
15
16#ifndef KCALCORE_OCCURRENCEITERATOR_H
17#define KCALCORE_OCCURRENCEITERATOR_H
18
19#include "incidence.h"
20#include "kcalendarcore_export.h"
21
22namespace KCalendarCore
23{
24class Calendar;
25/**
26 * Iterate over calendar items in a calendar.
27 *
28 * The iterator takes recurrences and exceptions to recurrences into account
29 *
30 * The iterator does not iterate the occurrences of all incidences chronologically.
31 * @since 4.11
32 */
33class KCALENDARCORE_EXPORT OccurrenceIterator
34{
35public:
36 /**
37 * Creates iterator that iterates over all occurrences of all incidences
38 * between @param start and @param end (inclusive)
39 */
40 explicit OccurrenceIterator(const Calendar &calendar, const QDateTime &start = QDateTime(), const QDateTime &end = QDateTime());
41
42 /**
43 * Creates iterator that iterates over all occurrences
44 * of @param incidence between @param start and @param end (inclusive)
45 */
46 OccurrenceIterator(const Calendar &calendar,
47 const KCalendarCore::Incidence::Ptr &incidence,
48 const QDateTime &start = QDateTime(),
49 const QDateTime &end = QDateTime());
51 bool hasNext() const;
52
53 /**
54 * Advance iterator to the next occurrence.
55 */
56 void next();
57
58 /**
59 * Returns either main incidence or exception, depending on occurrence.
60 */
61 Incidence::Ptr incidence() const;
62
63 /**
64 * Returns the start date of the occurrence
65 *
66 * This is either the occurrence date, or the start date of an exception
67 * which overrides that occurrence.
68 */
69 QDateTime occurrenceStartDate() const;
70
71 /**
72 * Returns the end date of the occurrence
73 *
74 * For incidence that supports end date (events and due date for todos),
75 * this is computed from the duration or directly the end date of
76 * the occurrence or an exception overriding that occurrence. For incidences
77 * without end date, an invalid date is returned.
78 * @since 5.87
79 */
80 QDateTime occurrenceEndDate() const;
81
82 /**
83 * Returns the recurrence Id.
84 *
85 * This is the date where the occurrence starts without exceptions,
86 * this id is used to identify one exact occurrence.
87 */
88 QDateTime recurrenceId() const;
89
90private:
91 Q_DISABLE_COPY(OccurrenceIterator)
92 //@cond PRIVATE
93 class Private;
95 //@endcond
96};
97
98} // namespace
99
100#endif
Represents the main calendar class.
Definition calendar.h:133
Iterate over calendar items in a calendar.
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the API for handling calendar data and defines the Incidence class.
Namespace for all KCalendarCore types.
Definition alarm.h:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:01:36 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.