KCalendarCore

conference.cpp
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 2020 Daniel Vrátil <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "conference.h"
10 
11 #include <QDataStream>
12 
13 using namespace KCalendarCore;
14 
15 /**
16  Private class that helps to provide binary compatibility between releases.
17  @internal
18 */
19 //@cond PRIVATE
20 class Q_DECL_HIDDEN KCalendarCore::Conference::Private : public QSharedData
21 {
22 public:
23  QString label;
24  QString language;
26  QUrl uri;
27  CustomProperties customProperties;
28 };
29 //@endcond
30 
32  : d(new Conference::Private)
33 {
34 }
35 
36 Conference::Conference(const QUrl &uri, const QString &label, const QStringList &features, const QString &language)
37  : d(new Conference::Private)
38 {
39  setUri(uri);
40  setLabel(label);
41  setFeatures(features);
42  setLanguage(language);
43 }
44 
45 Conference::Conference(const Conference &) = default;
46 
47 Conference::~Conference() = default;
48 
49 bool Conference::isNull() const
50 {
51  // isNull rather than isEmpty, as user code is actually creating empty but non-null conferences...
52  return !d->uri.isValid() && d->label.isNull();
53 }
54 
56 {
57  return std::tie(d->label, d->language, d->features, d->uri) == std::tie(other.d->label, other.d->language, other.d->features, other.d->uri);
58 }
59 
61 {
62  return !operator==(other);
63 }
64 
66 
67 QUrl Conference::uri() const
68 {
69  return d->uri;
70 }
71 
72 void Conference::setUri(const QUrl &uri)
73 {
74  d->uri = uri;
75 }
76 
77 QString Conference::label() const
78 {
79  return d->label;
80 }
81 
82 void Conference::setLabel(const QString &label)
83 {
84  d->label = label;
85 }
86 
87 QStringList Conference::features() const
88 {
89  return d->features;
90 }
91 
92 void Conference::addFeature(const QString &feature)
93 {
94  d->features.push_back(feature);
95 }
96 
97 void Conference::removeFeature(const QString &feature)
98 {
99  d->features.removeAll(feature);
100 }
101 
103 {
104  d->features = features;
105 }
106 
107 QString Conference::language() const
108 {
109  return d->language;
110 }
111 
112 void Conference::setLanguage(const QString &language)
113 {
114  d->language = language;
115 }
116 
117 void Conference::setCustomProperty(const QByteArray &xname, const QString &xvalue)
118 {
119  d->customProperties.setNonKDECustomProperty(xname, xvalue);
120 }
121 
123 {
124  return d->customProperties;
125 }
126 
128 {
129  return d->customProperties;
130 }
131 
133 {
134  return stream << conference.d->uri << conference.d->label << conference.d->features << conference.d->language << conference.d->customProperties;
135 }
136 
138 {
139  Conference conf;
140  stream >> conf.d->uri >> conf.d->label >> conf.d->features >> conf.d->language >> conf.d->customProperties;
141  conference = conf;
142 
143  return stream;
144 }
145 
146 #include "moc_conference.cpp"
~Conference()
Destroys the conference.
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:820
VehicleSection::Features features(QStringView coachNumber, QStringView coachClassification)
void setLabel(const QString &label)
Sets the URI label to label.
Definition: conference.cpp:82
Namespace for all KCalendarCore types.
Definition: alarm.h:36
void removeFeature(const QString &feature)
Removes feature from the list of features.
Definition: conference.cpp:97
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:833
void addFeature(const QString &feature)
Adds feature to the list of features.
Definition: conference.cpp:92
QMap< QByteArray, QString > customProperties() const
Returns all custom calendar property key/value pairs.
CustomProperties & customProperties()
Returns a reference to the CustomProperties object.
Definition: conference.cpp:122
bool operator==(const Conference &conference) const
Compares this with conference for equality.
Definition: conference.cpp:55
Conference()
Create a null Conference.
Definition: conference.cpp:31
Represents information related to a conference information of an Calendar Incidence,...
Definition: conference.h:31
Conference & operator=(const Conference &conference)
Sets this conference equal to conference.
QString label(StandardShortcut id)
void setLanguage(const QString &language)
Sets the language to language.
Definition: conference.cpp:112
void setFeatures(const QStringList &features)
Sets the list of features to features.
Definition: conference.cpp:102
void setCustomProperty(const QByteArray &xname, const QString &xvalue)
Adds a custom property.
Definition: conference.cpp:117
bool operator!=(const Conference &other) const
Compares this with conference for inequality.
Definition: conference.cpp:60
A class to manage custom calendar properties.
void setUri(const QUrl &uri)
Sets the URI to @uri.
Definition: conference.cpp:72
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.