KWeatherCore

capalertmessage.cpp
1/*
2 * SPDX-FileCopyrightText: 2021 Anjani Kumar <anjanik012@gmail.com>
3 * SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6#include "capalertmessage.h"
7#include "capalertinfo.h"
8#include "capreference.h"
9
10namespace KWeatherCore
11{
12class CAPAlertMessagePrivate : public QSharedData
13{
14public:
15 QString identifier;
16 QString sender;
17 QDateTime sentTime;
18 CAPAlertMessage::Status status = CAPAlertMessage::Status::UnknownStatus;
19 CAPAlertMessage::MessageType msgType = CAPAlertMessage::MessageType::UnknownMessageType;
20 CAPAlertMessage::Scope scope = CAPAlertMessage::Scope::UnknownScope;
21 QString note;
22 std::vector<CAPAlertInfo> infoVec;
23 std::vector<CAPReference> references;
24};
25
27 : d(new CAPAlertMessagePrivate)
28{
29}
31CAPAlertMessage::CAPAlertMessage(CAPAlertMessage &&other) noexcept = default;
32CAPAlertMessage::~CAPAlertMessage() = default;
33CAPAlertMessage &CAPAlertMessage::operator=(const CAPAlertMessage &other) = default;
34CAPAlertMessage &CAPAlertMessage::operator=(CAPAlertMessage &&other) noexcept = default;
35
36QString CAPAlertMessage::identifier() const
37{
38 return d->identifier;
39}
40QString CAPAlertMessage::sender() const
41{
42 return d->sender;
43}
44QDateTime CAPAlertMessage::sentTime() const
45{
46 return d->sentTime;
47}
48CAPAlertMessage::Status CAPAlertMessage::status() const
49{
50 return d->status;
51}
52CAPAlertMessage::MessageType CAPAlertMessage::messageType() const
53{
54 return d->msgType;
55}
56CAPAlertMessage::Scope CAPAlertMessage::scope() const
57{
58 return d->scope;
59}
60QString CAPAlertMessage::note() const
61{
62 return d->note;
63}
64const std::vector<CAPAlertInfo> &CAPAlertMessage::alertInfos() const
65{
66 return d->infoVec;
67}
68const std::vector<CAPReference> &CAPAlertMessage::references() const
69{
70 return d->references;
71}
73{
74 return CAPReference(sender(), identifier(), sentTime());
75}
76void CAPAlertMessage::setIdentifier(const QString &identifier)
77{
78 d->identifier = identifier;
79}
80void CAPAlertMessage::setSender(const QString &sender)
81{
82 d->sender = sender;
83}
84void CAPAlertMessage::setSentTime(const QDateTime &dateTime)
85{
86 d->sentTime = dateTime;
87}
88void CAPAlertMessage::setStatus(Status status)
89{
90 d->status = status;
91}
92void CAPAlertMessage::setMessageType(MessageType msgType)
93{
94 d->msgType = msgType;
95}
96void CAPAlertMessage::setScope(Scope scope)
97{
98 d->scope = scope;
99}
100void CAPAlertMessage::setNote(const QString &note)
101{
102 d->note = note;
103}
104void CAPAlertMessage::addInfo(CAPAlertInfo &&alertInfo)
105{
106 d->infoVec.emplace_back(alertInfo);
107}
108void CAPAlertMessage::setReferences(std::vector<CAPReference> &&references)
109{
110 d->references = std::move(references);
111}
112}
113
114#include "moc_capalertmessage.cpp"
Represents a single CAP Alert Message.
CAPReference ownReference() const
Reference of this CAP alert message.
Status
The code denoting the appropriate handling of the alert message.
const std::vector< CAPAlertInfo > & alertInfos() const
The alert info elements of this alert message.
CAPAlertMessage()
Default constructor, Status, MsgType, Scope are set to Unknown.
const std::vector< CAPReference > & references() const
References to previous CAP alert messages.
A reference to a previous CAP alert message.
Q_SCRIPTABLE CaptureState status()
NETWORKMANAGERQT_EXPORT NetworkManager::Status status()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:55:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.