1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #ifndef ATTICA_EVENT_H |
10 | #define ATTICA_EVENT_H |
11 | |
12 | #include "attica_export.h" |
13 | |
14 | #include <QDate> |
15 | #include <QList> |
16 | #include <QMap> |
17 | #include <QSharedDataPointer> |
18 | #include <QUrl> |
19 | |
20 | namespace Attica |
21 | { |
22 | /** |
23 | * @class Event event.h <Attica/Event> |
24 | * |
25 | * Represents a single event |
26 | */ |
27 | class ATTICA_EXPORT Event |
28 | { |
29 | public: |
30 | typedef QList<Event> List; |
31 | class Parser; |
32 | |
33 | /** |
34 | * Creates an empty Event |
35 | */ |
36 | Event(); |
37 | |
38 | /** |
39 | * Copy constructor. |
40 | * @param other the Event to copy from |
41 | */ |
42 | Event(const Event &other); |
43 | |
44 | /** |
45 | * Assignment operator. |
46 | * @param other the Event to assign from |
47 | * @return pointer to this Event |
48 | */ |
49 | Event &operator=(const Event &other); |
50 | |
51 | /** |
52 | * Destructor. |
53 | */ |
54 | ~Event(); |
55 | |
56 | /** |
57 | * Sets the id of the Event. |
58 | * The id uniquely identifies a Event with the OCS API. |
59 | * @param id the new id |
60 | */ |
61 | void setId(const QString &id); |
62 | |
63 | /** |
64 | * Gets the id of the Event. |
65 | * The id uniquely identifies a Event with the OCS API. |
66 | * @return the id |
67 | */ |
68 | QString id() const; |
69 | |
70 | /** |
71 | * Sets the name of the Event. |
72 | * @param name the new name |
73 | */ |
74 | void setName(const QString &name); |
75 | |
76 | /** |
77 | * Gets the name of the Event. |
78 | * @return the name |
79 | */ |
80 | QString name() const; |
81 | |
82 | /** |
83 | * Sets the description of the Event. |
84 | * @param description the new description |
85 | */ |
86 | void setDescription(const QString &description); |
87 | |
88 | /** |
89 | * Gets the description of the Event. |
90 | * @return the description |
91 | */ |
92 | QString description() const; |
93 | |
94 | /** |
95 | * Sets the id of the user bound to the Event. |
96 | * @param user the new user id |
97 | */ |
98 | void setUser(const QString &user); |
99 | |
100 | /** |
101 | * Gets the id of the user bound to the Event. |
102 | * @return the user id |
103 | */ |
104 | QString user() const; |
105 | |
106 | /** |
107 | * Sets the start date of the Event. |
108 | * @param startDate the start date |
109 | */ |
110 | void setStartDate(const QDate &startDate); |
111 | |
112 | /** |
113 | * Gets the start date of the Event. |
114 | * @return the start date |
115 | */ |
116 | QDate startDate() const; |
117 | |
118 | /** |
119 | * Sets the end date of the Event. |
120 | * @param endDate the end date |
121 | */ |
122 | void setEndDate(const QDate &endDate); |
123 | |
124 | /** |
125 | * Gets the start date of the Event. |
126 | * @return the end date |
127 | */ |
128 | QDate endDate() const; |
129 | |
130 | /** |
131 | * Sets the latitude of the position the Event takes place. |
132 | * @param latitude the new latitude |
133 | */ |
134 | void setLatitude(qreal latitude); |
135 | |
136 | /** |
137 | * Gets the latitude of the position the Event takes place. |
138 | * @return the latitude |
139 | */ |
140 | qreal latitude() const; |
141 | |
142 | /** |
143 | * Sets the longitude of the position the Event takes place. |
144 | * @param longitude the new latitude |
145 | */ |
146 | void setLongitude(qreal longitude); |
147 | |
148 | /** |
149 | * Gets the longitude of the position the Event takes place. |
150 | * @return the latitude |
151 | */ |
152 | qreal longitude() const; |
153 | |
154 | /** |
155 | * Sets the homepage of the Event. |
156 | * @param homepage the new homepage |
157 | */ |
158 | void setHomepage(const QUrl &homepage); |
159 | |
160 | /** |
161 | * Gets the homepage of the Event. |
162 | * @return the homepage |
163 | */ |
164 | QUrl homepage() const; |
165 | |
166 | /** |
167 | * Sets the country where the Event takes place. |
168 | * @param country the new country |
169 | */ |
170 | void setCountry(const QString &country); |
171 | |
172 | /** |
173 | * Gets the country where the Event takes place. |
174 | * @return the country |
175 | */ |
176 | QString country() const; |
177 | |
178 | /** |
179 | * Sets the city where the Event takes place. |
180 | * @param city the new city |
181 | */ |
182 | void setCity(const QString &city); |
183 | |
184 | /** |
185 | * Gets the city where the Event takes place. |
186 | * @return the city |
187 | */ |
188 | QString city() const; |
189 | |
190 | /** |
191 | * Add an attribute that is not included in the basis set of attributes exposed by the Event class. |
192 | * If the attribute already exists it gets overwritten. |
193 | * @param key the key of the attribute |
194 | * @param value the value of the attribute |
195 | */ |
196 | void addExtendedAttribute(const QString &key, const QString &value); |
197 | |
198 | /** |
199 | * Get an attribute that is not included in the basis set of attributes exposed by the Event class. |
200 | * @param key the key of the attribute |
201 | * @return the value of the attribute with the specified key, or an empty string, if the key has not been found |
202 | */ |
203 | QString extendedAttribute(const QString &key) const; |
204 | |
205 | /** |
206 | * Get all attributes that are not included in the basis set of attributes exposed by the Event class. |
207 | * @return the attribute mappings |
208 | */ |
209 | QMap<QString, QString> extendedAttributes() const; |
210 | |
211 | /** |
212 | * Checks whether this Event has an id |
213 | * @return @c true if an id has been set, @c false otherwise |
214 | */ |
215 | bool isValid() const; |
216 | |
217 | private: |
218 | class Private; |
219 | QSharedDataPointer<Private> d; |
220 | }; |
221 | |
222 | } |
223 | |
224 | #endif |
225 | |