File indexing completed on 2024-10-06 12:15:11

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef ATTICA_EVENT_H
0010 #define ATTICA_EVENT_H
0011 
0012 #include "attica_export.h"
0013 
0014 #include <QDate>
0015 #include <QList>
0016 #include <QMap>
0017 #include <QSharedDataPointer>
0018 #include <QUrl>
0019 
0020 namespace Attica
0021 {
0022 /**
0023  * @class Event event.h <Attica/Event>
0024  *
0025  * Represents a single event
0026  */
0027 class ATTICA_EXPORT Event
0028 {
0029 public:
0030     typedef QList<Event> List;
0031     class Parser;
0032 
0033     /**
0034      * Creates an empty Event
0035      */
0036     Event();
0037 
0038     /**
0039      * Copy constructor.
0040      * @param other the Event to copy from
0041      */
0042     Event(const Event &other);
0043 
0044     /**
0045      * Assignment operator.
0046      * @param other the Event to assign from
0047      * @return pointer to this Event
0048      */
0049     Event &operator=(const Event &other);
0050 
0051     /**
0052      * Destructor.
0053      */
0054     ~Event();
0055 
0056     /**
0057      * Sets the id of the Event.
0058      * The id uniquely identifies a Event with the OCS API.
0059      * @param id the new id
0060      */
0061     void setId(const QString &id);
0062 
0063     /**
0064      * Gets the id of the Event.
0065      * The id uniquely identifies a Event with the OCS API.
0066      * @return the id
0067      */
0068     QString id() const;
0069 
0070     /**
0071      * Sets the name of the Event.
0072      * @param name the new name
0073      */
0074     void setName(const QString &name);
0075 
0076     /**
0077      * Gets the name of the Event.
0078      * @return the name
0079      */
0080     QString name() const;
0081 
0082     /**
0083      * Sets the description of the Event.
0084      * @param description the new description
0085      */
0086     void setDescription(const QString &description);
0087 
0088     /**
0089      * Gets the description of the Event.
0090      * @return the description
0091      */
0092     QString description() const;
0093 
0094     /**
0095      * Sets the id of the user bound to the Event.
0096      * @param user the new user id
0097      */
0098     void setUser(const QString &user);
0099 
0100     /**
0101      * Gets the id of the user bound to the Event.
0102      * @return the user id
0103      */
0104     QString user() const;
0105 
0106     /**
0107      * Sets the start date of the Event.
0108      * @param startDate the start date
0109      */
0110     void setStartDate(const QDate &startDate);
0111 
0112     /**
0113      * Gets the start date of the Event.
0114      * @return the start date
0115      */
0116     QDate startDate() const;
0117 
0118     /**
0119      * Sets the end date of the Event.
0120      * @param endDate the end date
0121      */
0122     void setEndDate(const QDate &endDate);
0123 
0124     /**
0125      * Gets the start date of the Event.
0126      * @return the end date
0127      */
0128     QDate endDate() const;
0129 
0130     /**
0131      * Sets the latitude of the position the Event takes place.
0132      * @param latitude the new latitude
0133      */
0134     void setLatitude(qreal latitude);
0135 
0136     /**
0137      * Gets the latitude of the position the Event takes place.
0138      * @return the latitude
0139      */
0140     qreal latitude() const;
0141 
0142     /**
0143      * Sets the longitude of the position the Event takes place.
0144      * @param longitude the new latitude
0145      */
0146     void setLongitude(qreal longitude);
0147 
0148     /**
0149      * Gets the longitude of the position the Event takes place.
0150      * @return the latitude
0151      */
0152     qreal longitude() const;
0153 
0154     /**
0155      * Sets the homepage of the Event.
0156      * @param homepage the new homepage
0157      */
0158     void setHomepage(const QUrl &homepage);
0159 
0160     /**
0161      * Gets the homepage of the Event.
0162      * @return the homepage
0163      */
0164     QUrl homepage() const;
0165 
0166     /**
0167      * Sets the country where the Event takes place.
0168      * @param country the new country
0169      */
0170     void setCountry(const QString &country);
0171 
0172     /**
0173      * Gets the country where the Event takes place.
0174      * @return the country
0175      */
0176     QString country() const;
0177 
0178     /**
0179      * Sets the city where the Event takes place.
0180      * @param city the new city
0181      */
0182     void setCity(const QString &city);
0183 
0184     /**
0185      * Gets the city where the Event takes place.
0186      * @return the city
0187      */
0188     QString city() const;
0189 
0190     /**
0191      * Add an attribute that is not included in the basis set of attributes exposed by the Event class.
0192      * If the attribute already exists it gets overwritten.
0193      * @param key the key of the attribute
0194      * @param value the value of the attribute
0195      */
0196     void addExtendedAttribute(const QString &key, const QString &value);
0197 
0198     /**
0199      * Get an attribute that is not included in the basis set of attributes exposed by the Event class.
0200      * @param key the key of the attribute
0201      * @return the value of the attribute with the specified key, or an empty string, if the key has not been found
0202      */
0203     QString extendedAttribute(const QString &key) const;
0204 
0205     /**
0206      * Get all attributes that are not included in the basis set of attributes exposed by the Event class.
0207      * @return the attribute mappings
0208      */
0209     QMap<QString, QString> extendedAttributes() const;
0210 
0211     /**
0212      * Checks whether this Event has an id
0213      * @return @c true if an id has been set, @c false otherwise
0214      */
0215     bool isValid() const;
0216 
0217 private:
0218     class Private;
0219     QSharedDataPointer<Private> d;
0220 };
0221 
0222 }
0223 
0224 #endif