Attica

event.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2009 Eckhart W├Ârner <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #include "event.h"
10 
11 using namespace Attica;
12 
13 class Event::Private : public QSharedData
14 {
15 public:
16  QString m_id;
17  QString m_name;
18  QString m_description;
19  QString m_user;
20  QDate m_startDate;
21  QDate m_endDate;
22  qreal m_latitude;
23  qreal m_longitude;
24  QUrl m_homepage;
25  QString m_country;
26  QString m_city;
27  QMap<QString, QString> m_extendedAttributes;
28 
29  Private()
30  : m_latitude(0),
31  m_longitude(0)
32  {
33  }
34 };
35 
37  : d(new Private)
38 {
39 }
40 
41 Event::Event(const Event &other)
42  : d(other.d)
43 {
44 }
45 
47 {
48  d = other.d;
49  return *this;
50 }
51 
53 {
54 }
55 
56 void Event::setId(const QString &id)
57 {
58  d->m_id = id;
59 }
60 
62 {
63  return d->m_id;
64 }
65 
67 {
68  d->m_name = name;
69 }
70 
72 {
73  return d->m_name;
74 }
75 
76 void Event::setDescription(const QString &text)
77 {
78  d->m_description = text;
79 }
80 
82 {
83  return d->m_description;
84 }
85 
86 void Event::setUser(const QString &id)
87 {
88  d->m_user = id;
89 }
90 
92 {
93  return d->m_user;
94 }
95 
96 void Event::setStartDate(const QDate &date)
97 {
98  d->m_startDate = date;
99 }
100 
102 {
103  return d->m_startDate;
104 }
105 
106 void Event::setEndDate(const QDate &date)
107 {
108  d->m_endDate = date;
109 }
110 
112 {
113  return d->m_endDate;
114 }
115 
116 void Event::setLatitude(qreal lat)
117 {
118  d->m_latitude = lat;
119 }
120 
121 qreal Event::latitude() const
122 {
123  return d->m_latitude;
124 }
125 
126 void Event::setLongitude(qreal lon)
127 {
128  d->m_longitude = lon;
129 }
130 
131 qreal Event::longitude() const
132 {
133  return d->m_longitude;
134 }
135 
136 void Event::setHomepage(const QUrl &url)
137 {
138  d->m_homepage = url;
139 }
140 
142 {
143  return d->m_homepage;
144 }
145 
147 {
148  d->m_country = country;
149 }
150 
152 {
153  return d->m_country;
154 }
155 
157 {
158  d->m_city = city;
159 }
160 
162 {
163  return d->m_city;
164 }
165 
166 void Event::addExtendedAttribute(const QString &key, const QString &value)
167 {
168  d->m_extendedAttributes.insert(key, value);
169 }
170 
172 {
173  return d->m_extendedAttributes.value(key);
174 }
175 
177 {
178  return d->m_extendedAttributes;
179 }
180 
181 bool Event::isValid() const
182 {
183  return !(d->m_id.isEmpty());
184 }
QString user() const
Gets the id of the user bound to the Event.
Definition: event.cpp:91
void setDescription(const QString &description)
Sets the description of the Event.
Definition: event.cpp:76
QDate startDate() const
Gets the start date of the Event.
Definition: event.cpp:101
Represents a single event.
Definition: event.h:26
Event & operator=(const Event &other)
Assignment operator.
Definition: event.cpp:46
qreal latitude() const
Gets the latitude of the position the Event takes place.
Definition: event.cpp:121
void setEndDate(const QDate &endDate)
Sets the end date of the Event.
Definition: event.cpp:106
QString city() const
Gets the city where the Event takes place.
Definition: event.cpp:161
void setCity(const QString &city)
Sets the city where the Event takes place.
Definition: event.cpp:156
QString id() const
Gets the id of the Event.
Definition: event.cpp:61
QMap< QString, QString > extendedAttributes() const
Get all attributes that are not included in the basis set of attributes exposed by the Event class...
Definition: event.cpp:176
void setUser(const QString &user)
Sets the id of the user bound to the Event.
Definition: event.cpp:86
void setLongitude(qreal longitude)
Sets the longitude of the position the Event takes place.
Definition: event.cpp:126
QString name() const
Gets the name of the Event.
Definition: event.cpp:71
void setLatitude(qreal latitude)
Sets the latitude of the position the Event takes place.
Definition: event.cpp:116
qreal longitude() const
Gets the longitude of the position the Event takes place.
Definition: event.cpp:131
void setStartDate(const QDate &startDate)
Sets the start date of the Event.
Definition: event.cpp:96
QUrl homepage() const
Gets the homepage of the Event.
Definition: event.cpp:141
Event()
Creates an empty Event.
Definition: event.cpp:36
QString country() const
Gets the country where the Event takes place.
Definition: event.cpp:151
QString extendedAttribute(const QString &key) const
Get an attribute that is not included in the basis set of attributes exposed by the Event class...
Definition: event.cpp:171
void setCountry(const QString &country)
Sets the country where the Event takes place.
Definition: event.cpp:146
~Event()
Destructor.
Definition: event.cpp:52
bool isValid() const
Checks whether this Event has an id.
Definition: event.cpp:181
void addExtendedAttribute(const QString &key, const QString &value)
Add an attribute that is not included in the basis set of attributes exposed by the Event class...
Definition: event.cpp:166
void setHomepage(const QUrl &homepage)
Sets the homepage of the Event.
Definition: event.cpp:136
void setId(const QString &id)
Sets the id of the Event.
Definition: event.cpp:56
QDate endDate() const
Gets the start date of the Event.
Definition: event.cpp:111
QString description() const
Gets the description of the Event.
Definition: event.cpp:81
void setName(const QString &name)
Sets the name of the Event.
Definition: event.cpp:66
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:06:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.