KWeatherCore

capalertinfo.cpp
1/*
2 * SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com>
3 * SPDX-FileCopyrightText: 2021 Anjani Kumar <anjanik012@gmail.com>
4 * SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7#include "capalertinfo.h"
8#include "caparea.h"
9
10namespace KWeatherCore
11{
12class CAPAlertInfoPrivate : public QSharedData
13{
14public:
15 QString headline;
16 QString description;
17 QString event;
18 QString sender;
19 QString language = QStringLiteral("en-US"); // default value according to CAP specification
20 QDateTime effectiveTime;
21 QDateTime onsetTime;
22 QDateTime expireTime;
23 CAPAlertInfo::Categories categories = CAPAlertInfo::Category::Unknown;
24 QString instruction;
25 CAPAlertInfo::Urgency urgency = CAPAlertInfo::Urgency::UnknownUrgency;
26 CAPAlertInfo::Severity severity = CAPAlertInfo::Severity::UnknownSeverity;
27 CAPAlertInfo::Certainty certainty = CAPAlertInfo::Certainty::UnknownCertainty;
28 CAPAlertInfo::ResponseTypes responseTypes = CAPAlertInfo::ResponseType::UnknownResponseType;
29 QString contact;
30 QString web;
31 std::vector<CAPNamedValue> parameters;
32 std::vector<CAPArea> areas;
33 std::vector<CAPNamedValue> eventCodes;
34};
35
36CAPAlertInfo::CAPAlertInfo()
37 : d(new CAPAlertInfoPrivate)
38{
39}
40CAPAlertInfo::CAPAlertInfo(const CAPAlertInfo &other) = default;
41CAPAlertInfo::CAPAlertInfo(CAPAlertInfo &&other) = default;
42CAPAlertInfo::~CAPAlertInfo() = default;
43CAPAlertInfo &CAPAlertInfo::operator=(const CAPAlertInfo &other) = default;
44CAPAlertInfo &CAPAlertInfo::operator=(CAPAlertInfo &&other) = default;
45
46QString CAPAlertInfo::event() const
47{
48 return d->event;
49}
50QDateTime CAPAlertInfo::effectiveTime() const
51{
52 return d->effectiveTime;
53}
54QDateTime CAPAlertInfo::onsetTime() const
55{
56 return d->onsetTime;
57}
58QDateTime CAPAlertInfo::expireTime() const
59{
60 return d->expireTime;
61}
62CAPAlertInfo::Categories CAPAlertInfo::categories() const
63{
64 return d->categories;
65}
66QString CAPAlertInfo::headline() const
67{
68 return d->headline;
69}
70QString CAPAlertInfo::description() const
71{
72 return d->description;
73}
74QString CAPAlertInfo::instruction() const
75{
76 return d->instruction;
77}
78QString CAPAlertInfo::sender() const
79{
80 return d->sender;
81}
82QString CAPAlertInfo::language() const
83{
84 return d->language;
85}
86CAPAlertInfo::Urgency CAPAlertInfo::urgency() const
87{
88 return d->urgency;
89}
90CAPAlertInfo::Severity CAPAlertInfo::severity() const
91{
92 return d->severity;
93}
94CAPAlertInfo::Certainty CAPAlertInfo::certainty() const
95{
96 return d->certainty;
97}
98CAPAlertInfo::ResponseTypes CAPAlertInfo::responseTypes() const
99{
100 return d->responseTypes;
101}
102QString CAPAlertInfo::contact() const
103{
104 return d->contact;
105}
106QString CAPAlertInfo::web() const
107{
108 return d->web;
109}
110const std::vector<CAPNamedValue> &CAPAlertInfo::parameters() const
111{
112 return d->parameters;
113}
114const std::vector<CAPArea> &CAPAlertInfo::areas() const
115{
116 return d->areas;
117}
118const std::vector<CAPNamedValue> &CAPAlertInfo::eventCodes() const
119{
120 return d->eventCodes;
121}
122
123void CAPAlertInfo::setHeadline(const QString &headline)
124{
125 d->headline = headline;
126}
127void CAPAlertInfo::setDescription(const QString &description)
128{
129 d->description = description;
130}
131void CAPAlertInfo::setInstruction(const QString &instruction)
132{
133 d->instruction = instruction;
134}
135void CAPAlertInfo::setSender(const QString &sender)
136{
137 d->sender = sender;
138}
139void CAPAlertInfo::setLanguage(const QString &language)
140{
141 d->language = language;
142}
143void CAPAlertInfo::addCategory(Category category)
144{
145 d->categories |= category;
146}
147void CAPAlertInfo::setEvent(const QString &event)
148{
149 d->event = event;
150}
151
152void CAPAlertInfo::setEffectiveTime(const QDateTime &time)
153{
154 d->effectiveTime = time;
155}
156void CAPAlertInfo::setOnsetTime(const QDateTime &time)
157{
158 d->onsetTime = time;
159}
160void CAPAlertInfo::setExpireTime(const QDateTime &time)
161{
162 d->expireTime = time;
163}
164void CAPAlertInfo::setUrgency(Urgency urgency)
165{
166 d->urgency = urgency;
167}
168void CAPAlertInfo::setSeverity(Severity severity)
169{
170 d->severity = severity;
171}
172void CAPAlertInfo::setCertainty(Certainty certainty)
173{
174 d->certainty = certainty;
175}
176void CAPAlertInfo::addResponseType(ResponseType responseType)
177{
178 d->responseTypes |= responseType;
179}
180void CAPAlertInfo::setContact(const QString &contact)
181{
182 d->contact = contact;
183}
184void CAPAlertInfo::setWeb(const QString &web)
185{
186 d->web = web;
187}
188void CAPAlertInfo::addParameter(CAPNamedValue &&param)
189{
190 d->parameters.push_back(std::move(param));
191}
192
193void CAPAlertInfo::addArea(CAPArea &&area)
194{
195 d->areas.push_back(std::move(area));
196}
197
198void CAPAlertInfo::addEventCode(CAPNamedValue &&code)
199{
200 d->eventCodes.push_back(std::move(code));
201}
202}
203
204#include "moc_capalertinfo.cpp"
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
Category category(StandardShortcut id)
void push_back(QChar ch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.