KCalendarCore

freebusyperiod.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 2001 Cornelius Schumacher <[email protected]>
5  SPDX-FileCopyrightText: 2007 David Jarvie <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
20 #include "freebusyperiod.h"
21 
22 using namespace KCalendarCore;
23 
24 //@cond PRIVATE
25 class Q_DECL_HIDDEN KCalendarCore::FreeBusyPeriod::Private
26 {
27 public:
28  Private():
29  mType(Unknown)
30  {}
31 
32  QString mSummary;
33  QString mLocation;
34  FreeBusyType mType;
35 };
36 //@endcond
37 
39 {
40 }
41 
43  : Period(start, end), d(new KCalendarCore::FreeBusyPeriod::Private())
44 {
45 }
46 
48  : Period(start, duration), d(new KCalendarCore::FreeBusyPeriod::Private())
49 {
50 }
51 
53  : Period(period), d(new KCalendarCore::FreeBusyPeriod::Private(*period.d))
54 {
55 }
56 
58  : Period(period), d(new KCalendarCore::FreeBusyPeriod::Private())
59 {
60 }
61 
63 {
64  delete d;
65 }
66 
68 {
69  // check for self assignment
70  if (&other == this) {
71  return *this;
72  }
73 
74  Period::operator=(other);
75  *d = *other.d;
76  return *this;
77 }
78 
80 {
81  return d->mSummary;
82 }
83 
85 {
86  d->mSummary = summary;
87 }
88 
90 {
91  return d->mLocation;
92 }
93 
95 {
96  d->mLocation = location;
97 }
98 
99 FreeBusyPeriod::FreeBusyType FreeBusyPeriod::type() const
100 {
101  return d->mType;
102 }
103 
104 void FreeBusyPeriod::setType(FreeBusyPeriod::FreeBusyType type)
105 {
106  d->mType = type;
107 }
108 
110 {
111  KCalendarCore::Period periodParent = static_cast<KCalendarCore::Period>(period);
112  stream << periodParent;
113  stream << period.summary() << period.location() << static_cast<int>(period.type());
114  return stream;
115 }
116 
118 {
119  KCalendarCore::Period periodParent;
121  int type;
122 
123  stream >> periodParent >> summary >> location >> type;
124 
125  period = periodParent;
126  period.setLocation(location);
127  period.setSummary(summary);
128  period.setType(static_cast<FreeBusyPeriod::FreeBusyType>(type));
129  return stream;
130 }
131 
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:825
QDateTime end() const
Returns when this period ends.
Definition: period.cpp:102
~FreeBusyPeriod()
Destroys a period.
FreeBusyPeriod()
Constructs a period without a duration.
FreeBusyType type() const
Returns free/busy type.
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:849
QString summary() const
Returns the period summary.
void setLocation(const QString &location)
Sets the period location.
Duration duration() const
Returns the duration of the period.
Definition: period.cpp:107
Represents a span of time measured in seconds or days.
Definition: duration.h:44
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:38
void setSummary(const QString &summary)
Sets the period summary.
FreeBusyPeriod & operator=(const FreeBusyPeriod &other)
Sets this period equal to the other one.
QDateTime start() const
Returns when this period starts.
Definition: period.cpp:97
Period & operator=(const Period &other)
Sets this period equal to the other one.
Definition: period.cpp:86
void setType(FreeBusyType type)
Sets the free/busy type.
QString location() const
Returns the period location.
This file is part of the API for handling calendar data and defines the Period class.
The period can be defined by either a start time and an end time or by a start time and a duration...
Namespace for all KCalendarCore types.
Definition: alarm.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:50:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.