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 <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2007 David Jarvie <djarvie@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9/**
10 @file
11 This file is part of the API for handling calendar data and
12 defines the FreeBusyPeriod class.
13
14 @brief
15 Represents a period of time.
16
17 @author Cornelius Schumacher <schumacher@kde.org>
18*/
19
20#include "freebusyperiod.h"
21
22using namespace KCalendarCore;
23
24//@cond PRIVATE
25class Q_DECL_HIDDEN KCalendarCore::FreeBusyPeriod::Private
26{
27public:
28 Private()
29 : mType(Unknown)
30 {
31 }
32
33 QString mSummary;
34 QString mLocation;
35 FreeBusyType mType;
36};
37//@endcond
38
40 : Period()
41 , d(new KCalendarCore::FreeBusyPeriod::Private())
42{
43}
44
46 : Period(start, end)
47 , d(new KCalendarCore::FreeBusyPeriod::Private())
48{
49}
50
52 : Period(start, duration)
53 , d(new KCalendarCore::FreeBusyPeriod::Private())
54{
55}
56
58 : Period(period)
59 , d(new KCalendarCore::FreeBusyPeriod::Private(*period.d))
60{
61}
62
64 : Period(period)
65 , d(new KCalendarCore::FreeBusyPeriod::Private())
66{
67}
68
70{
71 delete d;
72}
73
75{
76 // check for self assignment
77 if (&other == this) {
78 return *this;
79 }
80
81 Period::operator=(other);
82 *d = *other.d;
83 return *this;
84}
85
87{
88 return d->mSummary;
89}
90
92{
93 d->mSummary = summary;
94}
95
97{
98 return d->mLocation;
99}
100
102{
103 d->mLocation = location;
104}
105
106FreeBusyPeriod::FreeBusyType FreeBusyPeriod::type() const
107{
108 return d->mType;
109}
110
111void FreeBusyPeriod::setType(FreeBusyPeriod::FreeBusyType type)
112{
113 d->mType = type;
114}
115
117{
118 KCalendarCore::Period periodParent = static_cast<KCalendarCore::Period>(period);
119 stream << periodParent;
120 stream << period.summary() << period.location() << static_cast<int>(period.type());
121 return stream;
122}
123
125{
126 KCalendarCore::Period periodParent;
127 QString summary;
128 QString location;
129 int type;
130
131 stream >> periodParent >> summary >> location >> type;
132
133 period = periodParent;
134 period.setLocation(location);
135 period.setSummary(summary);
136 period.setType(static_cast<FreeBusyPeriod::FreeBusyType>(type));
137 return stream;
138}
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.
void setType(FreeBusyType type)
Sets the free/busy type.
FreeBusyPeriod()
Constructs a period without a duration.
FreeBusyType type() const
Returns free/busy type.
QString summary() const
Returns the period summary.
void setLocation(const QString &location)
Sets the period location.
FreeBusyPeriod & operator=(const FreeBusyPeriod &other)
Sets this period equal to the other one.
~FreeBusyPeriod()
Destroys a period.
void setSummary(const QString &summary)
Sets the period summary.
QString location() const
Returns the period location.
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
Period & operator=(const Period &other)
Sets this period equal to the other one.
Definition period.cpp:89
This file is part of the API for handling calendar data and defines the Period class.
Q_SCRIPTABLE Q_NOREPLY void start()
Namespace for all KCalendarCore types.
Definition alarm.h:37
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition alarm.cpp:833
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition alarm.cpp:820
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.