Warning, file /frameworks/kcalendarcore/src/recurrence.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 1998 Preston Brown <pbrown@kde.org>
0005   SPDX-FileCopyrightText: 2001, 2003 Cornelius Schumacher <schumacher@kde.org>
0006   SPDX-FileCopyrightText: 2002, 2006 David Jarvie <djarvie@kde.org>
0007   SPDX-FileCopyrightText: 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
0008 
0009   SPDX-License-Identifier: LGPL-2.0-or-later
0010 */
0011 #ifndef KCALCORE_RECURRENCE_H
0012 #define KCALCORE_RECURRENCE_H
0013 
0014 #include "kcalendarcore_export.h"
0015 #include "recurrencerule.h"
0016 #include "period.h"
0017 
0018 class QBitArray;
0019 class QTimeZone;
0020 
0021 namespace KCalendarCore
0022 {
0023 class RecurrenceRule;
0024 
0025 /**
0026   This class represents a recurrence rule for a calendar incidence.
0027 
0028   It manages all recurrence rules, recurrence date/times, exception rules
0029   and exception date times that can appear inside calendar items.
0030   Each recurrence rule and exception rule is represented as an object
0031   of type RecurrenceRule.
0032 
0033   For the simple case where at most one recurrence
0034   rule is present, this class provides shortcut methods to set the type:
0035     setMinutely()
0036     setHourly()
0037     setDaily()
0038     setWeekly()
0039     setMonthly()
0040     setYearly()
0041   to set/get general information about the recurrence:
0042     setEndDate()
0043     setEndDateTime()
0044     duration()
0045     durationTo()
0046     setDuration()
0047     frequency()
0048     setFrequency()
0049   and to set/get specific information about the recurrence within the interval:
0050     days()
0051     monthDays()
0052     monthPositions()
0053     yearDays()
0054     yearDates()
0055     yearMonths()
0056     yearPositions()
0057     addMonthlyPos()
0058     addMonthlyDate()
0059     addYearlyDay()
0060     addYearlyDate()
0061     addYearlyPos()
0062     addYearlyMonth()
0063   These are all available so that you don't have to work on the RecurrenceRule
0064   objects themselves.
0065   In other words, in that simple situation the interface stays almost the
0066   same compared to the old Recurrence class, which allowed only one
0067   recurrence rule.
0068 
0069   As soon as your recurrence consists of multiple recurrence rules or exception
0070   rules, you cannot use the methods mentioned above any more (since each rule
0071   will have a different type and different settings). If you still call
0072   any of them, the set*ly methods will remove all rules and add one rule with
0073   the specified type. The add* and the other set* methods will change only
0074   the first recurrence rule, but leave the others untouched.
0075 */
0076 class KCALENDARCORE_EXPORT Recurrence : public RecurrenceRule::RuleObserver
0077 {
0078 public:
0079     class RecurrenceObserver
0080     {
0081     public:
0082         virtual ~RecurrenceObserver();
0083         /** This method will be called on each change of the recurrence object */
0084         virtual void recurrenceUpdated(Recurrence *r) = 0;
0085     };
0086 
0087     /** enumeration for describing how an event recurs, if at all. */
0088     enum {
0089         rNone = 0,
0090         rMinutely = 0x001,
0091         rHourly = 0x0002,
0092         rDaily = 0x0003,
0093         rWeekly = 0x0004,
0094         rMonthlyPos = 0x0005,
0095         rMonthlyDay = 0x0006,
0096         rYearlyMonth = 0x0007,
0097         rYearlyDay = 0x0008,
0098         rYearlyPos = 0x0009,
0099         rOther = 0x000A,
0100         rMax = 0x00FF,
0101     };
0102 
0103     /**
0104       Constructs an empty recurrence.
0105     */
0106     Recurrence();
0107 
0108     /**
0109       Copy constructor.
0110       @param r instance to copy from
0111     */
0112     Recurrence(const Recurrence &r);
0113 
0114     /**
0115       Destructor.
0116     */
0117     ~Recurrence() override;
0118 
0119     /**
0120       Comparison operator for equality.
0121       @param r instance to compare with
0122       @return true if recurrences are the same, false otherwise
0123     */
0124     bool operator==(const Recurrence &r) const;
0125 
0126     /**
0127       Comparison operator for inequality.
0128       @param r instance to compare with
0129       @return true if recurrences are the different, false if the same
0130     */
0131     bool operator!=(const Recurrence &r) const
0132     {
0133         return !operator==(r);
0134     }
0135 
0136 #if KCALENDARCORE_BUILD_DEPRECATED_SINCE(5, 64)
0137     /**
0138       Assignment operator.
0139       @param r the recurrence which will be assigned to this.
0140       @deprecated Do not use, will be removed in KF6
0141       @warning Broken implementation, do not use!
0142     */
0143     KCALENDARCORE_DEPRECATED_VERSION(5, 64, "Do not use")
0144     Recurrence &operator=(const Recurrence &r);
0145 #else
0146     Recurrence &operator=(const Recurrence &r) = delete;
0147 #endif
0148 
0149     /** Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00).
0150      @return the current start/time of the recurrence. */
0151     Q_REQUIRED_RESULT QDateTime startDateTime() const;
0152     /** Return the start date/time of the recurrence */
0153     Q_REQUIRED_RESULT QDate startDate() const;
0154     /** Set start of recurrence.
0155        @param start the new start date or date/time of the recurrence.
0156        @param isAllDay if true, the recurrence is set to all-day.  Otherwise the recurrence is set
0157        to non-all-day.
0158     */
0159     void setStartDateTime(const QDateTime &start, bool isAllDay);
0160 
0161     /** Set whether the recurrence has no time, just a date.
0162      * All-day means -- according to rfc2445 -- that the event has no time
0163      * associated.
0164      * N.B. This property is derived by default from whether setStartDateTime() is
0165      * called with a date-only or date/time parameter.
0166      * @return whether the recurrence has a time (false) or it is just a date (true). */
0167     Q_REQUIRED_RESULT bool allDay() const;
0168     /** Sets whether the dtstart is a all-day (i.e. has no time attached)
0169        @param allDay If the recurrence is for all-day item (true) or has a time associated (false).
0170        */
0171     void setAllDay(bool allDay);
0172 
0173     /** Set if recurrence is read-only or can be changed. */
0174     void setRecurReadOnly(bool readOnly);
0175 
0176     /** Returns true if the recurrence is read-only, or false if it can be changed. */
0177     Q_REQUIRED_RESULT bool recurReadOnly() const;
0178 
0179     /** Returns whether the event recurs at all. */
0180     Q_REQUIRED_RESULT bool recurs() const;
0181 
0182     /** Returns the event's recurrence status.  See the enumeration at the top
0183      * of this file for possible values. */
0184     Q_REQUIRED_RESULT ushort recurrenceType() const;
0185 
0186     /** Returns the recurrence status for a recurrence rule.
0187      * See the enumeration at the top of this file for possible values.
0188      *
0189      * @param rrule the recurrence rule to get the type for
0190      */
0191     static ushort recurrenceType(const RecurrenceRule *rrule);
0192 
0193     /**
0194       Returns true if the date specified is one on which the event will recur.
0195 
0196       @param date date to check.
0197       @param timeZone time zone for the @p date.
0198     */
0199     bool recursOn(const QDate &date, const QTimeZone &timeZone) const;
0200 
0201     /**
0202       Returns true if the date/time specified is one at which the event will
0203       recur. Times are rounded down to the nearest minute to determine the
0204       result.
0205 
0206       @param dt is the date/time to check.
0207     */
0208     bool recursAt(const QDateTime &dt) const;
0209 
0210     /**
0211       Removes all recurrence rules. Recurrence dates and exceptions are
0212       not removed.
0213     */
0214     void unsetRecurs();
0215 
0216     /**
0217       Removes all recurrence and exception rules and dates.
0218     */
0219     void clear();
0220 
0221     /** Returns a list of the times on the specified date at which the
0222      * recurrence will occur. The returned times should be interpreted in the
0223      * context of @p timeSpec.
0224      * @param date the date for which to find the recurrence times
0225      * @param timeZone timezone for @p date
0226      */
0227     Q_REQUIRED_RESULT TimeList recurTimesOn(const QDate &date, const QTimeZone &timeZone) const;
0228 
0229     /** Returns a list of all the times at which the recurrence will occur
0230      * between two specified times.
0231      *
0232      * There is a (large) maximum limit to the number of times returned. If due to
0233      * this limit the list is incomplete, this is indicated by the last entry being
0234      * set to an invalid QDateTime value. If you need further values, call the
0235      * method again with a start time set to just after the last valid time returned.
0236      *
0237      * @param start inclusive start of interval
0238      * @param end inclusive end of interval
0239      * @return list of date/time values
0240      */
0241     Q_REQUIRED_RESULT QList<QDateTime> timesInInterval(const QDateTime &start, const QDateTime &end) const;
0242 
0243     /** Returns the start date/time of the earliest recurrence with a start date/time after
0244      * the specified date/time.
0245      * If the recurrence has no time, the next date after the specified date is returned.
0246      * @param preDateTime the date/time after which to find the recurrence.
0247      * @return start date/time of next recurrence (strictly later than the given
0248      *         QDateTime), or invalid date if none.
0249      */
0250     Q_REQUIRED_RESULT QDateTime getNextDateTime(const QDateTime &preDateTime) const;
0251 
0252     /** Returns the date and time of the last previous recurrence, before the specified date/time.
0253      * If a time later than 00:00:00 is specified and the recurrence has no time, 00:00:00 on
0254      * the specified date is returned if that date recurs.
0255      *
0256      * @param afterDateTime the date/time before which to find the recurrence.
0257      * @return date/time of previous recurrence (strictly earlier than the given
0258      *         QDateTime), or invalid date if none.
0259      */
0260     Q_REQUIRED_RESULT QDateTime getPreviousDateTime(const QDateTime &afterDateTime) const;
0261 
0262     /** Returns frequency of recurrence, in terms of the recurrence time period type. */
0263     Q_REQUIRED_RESULT int frequency() const;
0264 
0265     /** Sets the frequency of recurrence, in terms of the recurrence time period type. */
0266     void setFrequency(int freq);
0267 
0268     /**
0269      * Returns -1 if the event recurs infinitely, 0 if the end date is set,
0270      * otherwise the total number of recurrences, including the initial occurrence.
0271      */
0272     Q_REQUIRED_RESULT int duration() const;
0273 
0274     /** Sets the total number of times the event is to occur, including both the
0275      * first and last. */
0276     void setDuration(int duration);
0277 
0278     /** Returns the number of recurrences up to and including the date/time specified.
0279      *  @warning This function can be very time consuming - use it sparingly!
0280      */
0281     Q_REQUIRED_RESULT int durationTo(const QDateTime &dt) const;
0282 
0283     /** Returns the number of recurrences up to and including the date specified.
0284      *  @warning This function can be very time consuming - use it sparingly!
0285      */
0286     Q_REQUIRED_RESULT int durationTo(const QDate &date) const;
0287 
0288     /** Returns the date/time of the last recurrence.
0289      * An invalid date is returned if the recurrence has no end.
0290      */
0291     Q_REQUIRED_RESULT QDateTime endDateTime() const;
0292 
0293     /** Returns the date of the last recurrence.
0294      * An invalid date is returned if the recurrence has no end.
0295      */
0296     Q_REQUIRED_RESULT QDate endDate() const;
0297 
0298     /** Sets the date of the last recurrence. The end time is set to the recurrence start time.
0299      * @param endDate the ending date after which to stop recurring. If the
0300      *   recurrence is not all-day, the end time will be 23:59.*/
0301     void setEndDate(const QDate &endDate);
0302 
0303     /** Sets the date and time of the last recurrence.
0304      * @param endDateTime the ending date/time after which to stop recurring. */
0305     void setEndDateTime(const QDateTime &endDateTime);
0306 
0307     /**
0308       Shift the times of the recurrence so that they appear at the same clock
0309       time as before but in a new time zone. The shift is done from a viewing
0310       time zone rather than from the actual recurrence time zone.
0311 
0312       For example, shifting a recurrence whose start time is 09:00 America/New York,
0313       using an old viewing time zone (@p oldSpec) of Europe/London, to a new time
0314       zone (@p newSpec) of Europe/Paris, will result in the time being shifted
0315       from 14:00 (which is the London time of the recurrence start) to 14:00 Paris
0316       time.
0317 
0318       @param oldZone the time specification which provides the clock times
0319       @param newZone the new time specification
0320     */
0321     void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone);
0322 
0323     /** Sets an event to recur minutely. By default infinite recurrence is used.
0324         To set an end date use the method setEndDate and to set the number
0325         of occurrences use setDuration.
0326 
0327         This method clears all recurrence rules and adds one rule with a
0328         minutely recurrence. All other recurrence components (recurrence
0329         date/times, exception date/times and exception rules) are not
0330         modified.
0331      * @param freq the frequency to recur, e.g. 2 is every other minute
0332      */
0333     void setMinutely(int freq);
0334 
0335     /** Sets an event to recur hourly. By default infinite recurrence is used.
0336         The minute of the recurrence is taken from the start date (if you
0337         need to change it, you will have to modify the defaultRRule's
0338         byMinute list manually.
0339         To set an end date use the method setEndDate and to set the number
0340         of occurrences use setDuration.
0341 
0342         This method clears all recurrence rules and adds one rule with a
0343         hourly recurrence. All other recurrence components (recurrence
0344         date/times, exception date/times and exception rules) are not
0345         modified.
0346      * @param freq the frequency to recur, e.g. 2 is every other hour
0347      */
0348     void setHourly(int freq);
0349 
0350     /** Sets an event to recur daily. By default infinite recurrence is used.
0351         The minute and second of the recurrence is taken from the start date
0352         (if you need to change them, you will have to modify the defaultRRule's
0353         byMinute list manually.
0354         To set an end date use the method setEndDate and to set the number
0355         of occurrences use setDuration.
0356 
0357         This method clears all recurrence rules and adds one rule with a
0358         daily recurrence. All other recurrence components (recurrence
0359         date/times, exception date/times and exception rules) are not
0360         modified.
0361      * @param freq the frequency to recur, e.g. 2 is every other day
0362      */
0363     void setDaily(int freq);
0364 
0365     /** Sets an event to recur weekly. By default infinite recurrence is used.
0366         To set an end date use the method setEndDate and to set the number
0367         of occurrences use setDuration.
0368 
0369         This method clears all recurrence rules and adds one rule with a
0370         weekly recurrence. All other recurrence components (recurrence
0371         date/times, exception date/times and exception rules) are not
0372         modified.
0373      * @param freq the frequency to recur, e.g. every other week etc.
0374      * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
0375      */
0376     void setWeekly(int freq, int weekStart = 1);
0377     /** Sets an event to recur weekly. By default infinite recurrence is used.
0378         To set an end date use the method setEndDate and to set the number
0379         of occurrences use setDuration.
0380 
0381         This method clears all recurrence rules and adds one rule with a
0382         weekly recurrence. All other recurrence components (recurrence
0383         date/times, exception date/times and exception rules) are not
0384         modified.
0385      * @param freq the frequency to recur, e.g. every other week etc.
0386      * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday).
0387      * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
0388      */
0389     void setWeekly(int freq, const QBitArray &days, int weekStart = 1);
0390 
0391     /** Adds days to the weekly day recurrence list.
0392      * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday).
0393      */
0394     void addWeeklyDays(const QBitArray &days);
0395     /** Returns the first day of the week.  Uses only the
0396      * first RRULE if present (i.e. a second RRULE as well as all EXRULES are
0397      * ignored!
0398      * @return Weekday of the first day of the week (Monday=1 .. Sunday=7)
0399      */
0400     int weekStart() const;
0401 
0402     /** Returns week day mask (bit 0 = Monday). */
0403     Q_REQUIRED_RESULT QBitArray days() const; // Emulate the old behavior
0404 
0405     /** Sets an event to recur monthly. By default infinite recurrence is used.
0406         The date of the monthly recurrence will be taken from the start date
0407         unless you explicitly add one or more recurrence dates with
0408         addMonthlyDate or a recurrence position in the month (e.g. first
0409         monday) using addMonthlyPos.
0410         To set an end date use the method setEndDate and to set the number
0411         of occurrences use setDuration.
0412 
0413         This method clears all recurrence rules and adds one rule with a
0414         monthly recurrence. All other recurrence components (recurrence
0415         date/times, exception date/times and exception rules) are not
0416         modified.
0417      * @param freq the frequency to recur, e.g. 3 for every third month.
0418      */
0419     void setMonthly(int freq);
0420 
0421     /** Adds a position (e.g. first monday) to the monthly recurrence rule.
0422      * @param pos the position in the month for the recurrence, with valid
0423      * values being 1-5 (5 weeks max in a month).
0424      * @param days the days for the position to recur on (bit 0 = Monday).
0425      * Example: pos = 2, and bits 0 and 2 are set in days:
0426      * the rule is to repeat every 2nd Monday and Wednesday in the month.
0427      */
0428     void addMonthlyPos(short pos, const QBitArray &days);
0429     void addMonthlyPos(short pos, ushort day);
0430 
0431     void setMonthlyPos(const QList<RecurrenceRule::WDayPos> &monthlyDays);
0432 
0433     /** Adds a date (e.g. the 15th of each month) to the monthly day
0434      *  recurrence list.
0435      * @param day the date in the month to recur.
0436      */
0437     void addMonthlyDate(short day);
0438 
0439     void setMonthlyDate(const QList<int> &monthlyDays);
0440 
0441     /** Returns list of day positions in months. */
0442     Q_REQUIRED_RESULT QList<RecurrenceRule::WDayPos> monthPositions() const;
0443 
0444     /** Returns list of day numbers of a  month. */
0445     // Emulate old behavior
0446     Q_REQUIRED_RESULT QList<int> monthDays() const;
0447 
0448     /** Sets an event to recur yearly. By default, this will recur every year
0449      *  on the same date (e.g. every year on April 15 if the start date was
0450      *  April 15).
0451      *  The day of the year can be specified with addYearlyDay().
0452      *  The day of the month can be specified with addYearlyByDate
0453      *  If both a month and a day ar specified with addYearlyMonth and
0454      *  addYearlyDay, the day is understood as day number within the month.
0455      *
0456      *  A position (e.g. 3rd Sunday of year/month, or last Friday of year/month)
0457      *  can be specified with addYearlyPos. Again, if a month is specified,
0458      *  this position is understood as within that month, otherwise within
0459      *  the year.
0460      *
0461      *  By default infinite recurrence is used. To set an end date use the
0462      *  method setEndDate and to set the number of occurrences use setDuration.
0463 
0464         This method clears all recurrence rules and adds one rule with a
0465         yearly recurrence. All other recurrence components (recurrence
0466         date/times, exception date/times and exception rules) are not
0467         modified.
0468      * @param freq the frequency to recur, e.g. 3 for every third year.
0469      */
0470     void setYearly(int freq);
0471 
0472     /** Adds day number of year within a yearly recurrence.
0473      *  By default infinite recurrence is used. To set an end date use the
0474      *  method setEndDate and to set the number of occurrences use setDuration.
0475      * @param day the day of the year for the event. E.g. if day is 60, this
0476      *            means Feb 29 in leap years and March 1 in non-leap years.
0477      */
0478     void addYearlyDay(int day);
0479 
0480     void setYearlyDay(const QList<int> &days);
0481 
0482     /** Adds date within a yearly recurrence. The month(s) for the recurrence
0483      *  can be specified with addYearlyMonth(), otherwise the month of the
0484      *  start date is used.
0485      *
0486      *   By default infinite recurrence is used. To set an end date use the
0487      *   method setEndDate and to set the number of occurrences use setDuration.
0488      * @param date the day of the month for the event
0489      */
0490     void addYearlyDate(int date);
0491 
0492     void setYearlyDate(const QList<int> &dates);
0493 
0494     /** Adds month in yearly recurrence. You can specify specific day numbers
0495      *  within the months (by calling addYearlyDate()) or specific day positions
0496      *  within the month (by calling addYearlyPos).
0497      * @param _rNum the month in which the event shall recur.
0498      */
0499     void addYearlyMonth(short _rNum);
0500 
0501     void setYearlyMonth(const QList<int> &months);
0502 
0503     /** Adds position within month/year within a yearly recurrence. If months
0504      *  are specified (via addYearlyMonth()), the parameters are understood as
0505      *  position within these months, otherwise within the year.
0506      *
0507      *  By default infinite recurrence is used.
0508      *   To set an end date use the method setEndDate and to set the number
0509      *   of occurrences use setDuration.
0510      * @param pos the position in the month/year for the recurrence, with valid
0511      * values being 1 to 53 and -1 to -53 (53 weeks max in a year).
0512      * @param days the days for the position to recur on (bit 0 = Monday).
0513      * Example: pos = 2, and bits 0 and 2 are set in days
0514      *   If months are specified (via addYearlyMonth), e.g. March, the rule is
0515      *   to repeat every year on the 2nd Monday and Wednesday of March.
0516      *   If no months are specified, the file is to repeat every year on the
0517      *   2nd Monday and Wednesday of the year.
0518      */
0519     void addYearlyPos(short pos, const QBitArray &days);
0520 
0521     void setYearlyPos(const QList<RecurrenceRule::WDayPos> &days);
0522 
0523     /** Returns the day numbers within a yearly recurrence.
0524      * @return the days of the year for the event. E.g. if the list contains
0525      *         60, this means the recurrence happens on day 60 of the year, i.e.
0526      *         on Feb 29 in leap years and March 1 in non-leap years.
0527      */
0528     Q_REQUIRED_RESULT QList<int> yearDays() const;
0529 
0530     /** Returns the dates within a yearly recurrence.
0531      * @return the days of the month for the event. E.g. if the list contains
0532      *         13, this means the recurrence happens on the 13th of the month.
0533      *         The months for the recurrence can be obtained through
0534      *         yearlyMonths(). If this list is empty, the month of the start
0535      *         date is used.
0536      */
0537     Q_REQUIRED_RESULT QList<int> yearDates() const;
0538 
0539     /** Returns the months within a yearly recurrence.
0540      * @return the months for the event. E.g. if the list contains
0541      *         11, this means the recurrence happens in November.
0542      *         The days for the recurrence can be obtained either through
0543      *         yearDates() if they are given as dates within the month or
0544      *         through yearlyPositions() if they are given as positions within the
0545      *         month. If none is specified, the date of the start date is used.
0546      */
0547     Q_REQUIRED_RESULT QList<int> yearMonths() const;
0548 
0549     /** Returns the positions within a yearly recurrence.
0550      * @return the positions for the event, either within a month (if months
0551      *         are set through addYearlyMonth()) or within the year.
0552      *         E.g. if the list contains {Pos=3, Day=5}, this means the third
0553      *         friday. If a month is set this position is understoodas third
0554      *         Friday in the given months, otherwise as third Friday of the
0555      *         year.
0556      */
0557     /** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */
0558     Q_REQUIRED_RESULT QList<RecurrenceRule::WDayPos> yearPositions() const;
0559 
0560     /** Upper date limit for recurrences */
0561     static const QDate MAX_DATE;
0562 
0563     /**
0564       Debug output.
0565     */
0566     void dump() const;
0567 
0568     // RRULE
0569     Q_REQUIRED_RESULT RecurrenceRule::List rRules() const;
0570     /**
0571       Add a recurrence rule to the recurrence.
0572       @param rrule the recurrence rule to add
0573      */
0574     void addRRule(RecurrenceRule *rrule);
0575 
0576     /**
0577       Remove a recurrence rule from the recurrence.
0578       @p rrule is not deleted; it is the responsibility of the caller
0579       to ensure that it is deleted.
0580       @param rrule the recurrence rule to remove
0581      */
0582     void removeRRule(RecurrenceRule *rrule);
0583 
0584     /**
0585       Remove a recurrence rule from the recurrence and delete it.
0586       @param rrule the recurrence rule to remove
0587      */
0588     void deleteRRule(RecurrenceRule *rrule);
0589 
0590     // EXRULE
0591     Q_REQUIRED_RESULT RecurrenceRule::List exRules() const;
0592 
0593     /**
0594       Add an exception rule to the recurrence.
0595       @param exrule the exception rule to add
0596      */
0597     void addExRule(RecurrenceRule *exrule);
0598 
0599     /**
0600       Remove an exception rule from the recurrence.
0601       @p exrule is not deleted; it is the responsibility of the caller
0602       to ensure that it is deleted.
0603       @param exrule the exception rule to remove
0604      */
0605     void removeExRule(RecurrenceRule *exrule);
0606 
0607     /**
0608       Remove an exception rule from the recurrence and delete it.
0609       @param exrule the exception rule to remove
0610      */
0611     void deleteExRule(RecurrenceRule *exrule);
0612 
0613     // RDATE
0614     Q_REQUIRED_RESULT QList<QDateTime> rDateTimes() const;
0615     Q_REQUIRED_RESULT DateList rDates() const;
0616     /**
0617       Inquire if the given RDATE is associated to a PERIOD.
0618       @param rdate a given RDATE in date time format.
0619       @return a Period, invalid if there is no period associated to @param rdate.
0620       @since 5.87
0621      */
0622     Q_REQUIRED_RESULT Period rDateTimePeriod(const QDateTime &rdate) const;
0623     void setRDateTimes(const QList<QDateTime> &rdates);
0624     void setRDates(const DateList &rdates);
0625     void addRDateTime(const QDateTime &rdate);
0626     void addRDate(const QDate &rdate);
0627     /**
0628       Add a RDATE defined as a PERIOD. The start date-time of the period is added
0629       to the recurring date time list, and will be listed by a call to
0630       rDateTimes(). Use then rDateTimePeriod() to fetch the associated
0631       period defintion.
0632       @param period a given RDATE in period defintion.
0633       @since 5.87
0634      */
0635     void addRDateTimePeriod(const Period &period);
0636 
0637     // ExDATE
0638     Q_REQUIRED_RESULT QList<QDateTime> exDateTimes() const;
0639     Q_REQUIRED_RESULT DateList exDates() const;
0640     void setExDateTimes(const QList<QDateTime> &exdates);
0641     void setExDates(const DateList &exdates);
0642     void addExDateTime(const QDateTime &exdate);
0643     void addExDate(const QDate &exdate);
0644 
0645     RecurrenceRule *defaultRRule(bool create = false) const;
0646     RecurrenceRule *defaultRRuleConst() const;
0647     void updated();
0648 
0649     /**
0650       Installs an observer. Whenever some setting of this recurrence
0651       object is changed, the recurrenceUpdated( Recurrence* ) method
0652       of each observer will be called to inform it of changes.
0653       @param observer the Recurrence::Observer-derived object, which
0654       will be installed as an observer of this object.
0655     */
0656     void addObserver(RecurrenceObserver *observer);
0657     /**
0658       Removes an observer that was added with addObserver. If the
0659       given object was not an observer, it does nothing.
0660       @param observer the Recurrence::Observer-derived object to
0661       be removed from the list of observers of this object.
0662     */
0663     void removeObserver(RecurrenceObserver *observer);
0664 
0665     void recurrenceChanged(RecurrenceRule *) override;
0666 
0667 protected:
0668     RecurrenceRule *setNewRecurrenceType(RecurrenceRule::PeriodType type, int freq);
0669 
0670 private:
0671     //@cond PRIVATE
0672     class Private;
0673     Private *const d;
0674     //@endcond
0675 
0676     friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, KCalendarCore::Recurrence *);
0677     friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Recurrence *);
0678 };
0679 
0680 /**
0681  * Recurrence serializer and deserializer.
0682  * @since 4.12
0683  */
0684 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &out, KCalendarCore::Recurrence *);
0685 KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &in, KCalendarCore::Recurrence *);
0686 
0687 }
0688 
0689 #endif