KCalendarCore

freebusyperiod.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <[email protected]>
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 Period class.
12 
13  @brief
14  Represents a period of time.
15 
16  @author Cornelius Schumacher <[email protected]>
17 */
18 
19 #ifndef KCALCORE_FREEBUSYPERIOD_H
20 #define KCALCORE_FREEBUSYPERIOD_H
21 
22 #include "kcalendarcore_export.h"
23 #include "period.h"
24 
25 #include <QMetaType>
26 
27 namespace KCalendarCore
28 {
29 /**
30  The period can be defined by either a start time and an end time or
31  by a start time and a duration.
32 */
33 class KCALENDARCORE_EXPORT FreeBusyPeriod : public Period
34 {
35 public:
36  enum FreeBusyType {
37  Free,
38  Busy,
39  BusyUnavailable,
40  BusyTentative,
41  Unknown,
42  };
43 
44  /**
45  List of periods.
46  */
48 
49  /**
50  Constructs a period without a duration.
51  */
53 
54  /**
55  Constructs a period from @p start to @p end.
56 
57  @param start the time the period begins.
58  @param end the time the period ends.
59  */
60  FreeBusyPeriod(const QDateTime &start, const QDateTime &end);
61 
62  /**
63  Constructs a period from @p start and lasting @p duration.
64 
65  @param start the time when the period starts.
66  @param duration how long the period lasts.
67  */
68  FreeBusyPeriod(const QDateTime &start, const Duration &duration);
69 
70  /**
71  Constructs a period by copying another period object
72 
73  @param period the period to copy
74  */
75 
76  FreeBusyPeriod(const FreeBusyPeriod &period);
77 
78  /**
79  Constructs a period by copying another period object
80 
81  @param period the period to copy
82  */
83 
84  FreeBusyPeriod(const Period &period); // krazy:exclude=explicit
85 
86  /**
87  Destroys a period.
88  */
89  ~FreeBusyPeriod();
90 
91  /**
92  Sets this period equal to the @p other one.
93 
94  @param other is the other period to compare.
95  */
96  FreeBusyPeriod &operator=(const FreeBusyPeriod &other);
97 
98  /**
99  Sets the period summary.
100  @param summary is the period summary string.
101  @see summary().
102  */
103  void setSummary(const QString &summary);
104 
105  /**
106  Returns the period summary.
107  @see setSummary()
108  */
109  Q_REQUIRED_RESULT QString summary() const;
110 
111  /**
112  Sets the period location.
113  @param location is the period location string.
114  @see location().
115  */
116  void setLocation(const QString &location);
117 
118  /**
119  Returns the period location.
120  @see setLocation()
121  */
122  Q_REQUIRED_RESULT QString location() const;
123 
124  /**
125  Sets the free/busy type.
126  @param type is the type of free/busy period
127  @see type().
128  @since 5.0
129  */
130  void setType(FreeBusyType type);
131 
132  /**
133  Returns free/busy type
134  @see setType().
135  @since 5.0
136  */
137  Q_REQUIRED_RESULT FreeBusyType type() const;
138 
139 private:
140  //@cond PRIVATE
141  class Private;
142  Private *const d;
143  //@endcond
144 
145  friend KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::FreeBusyPeriod &period);
146  friend KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::FreeBusyPeriod &period);
147 };
148 
149 /** Write @p period to the datastream @p stream, in binary format. */
150 KCALENDARCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const KCalendarCore::FreeBusyPeriod &period);
151 
152 /** Read a Period object into @p period from @p stream, in binary format. */
153 KCALENDARCORE_EXPORT QDataStream &operator>>(QDataStream &stream, KCalendarCore::FreeBusyPeriod &period);
154 }
155 
156 //@cond PRIVATE
157 Q_DECLARE_METATYPE(KCalendarCore::FreeBusyPeriod)
158 //@endcond
159 
160 #endif
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:820
Represents a span of time measured in seconds or days.
Definition: duration.h:43
The period can be defined by either a start time and an end time or by a start time and a duration.
Definition: period.h:37
Namespace for all KCalendarCore types.
Definition: alarm.h:36
QVector< FreeBusyPeriod > List
List of periods.
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:833
Q_SCRIPTABLE Q_NOREPLY void start()
Represents a period of time.
The period can be defined by either a start time and an end time or by a start time and a duration.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:00:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.