File indexing completed on 2024-05-12 12:43:28
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Anjani Kumar <anjanik012@gmail.com> 0003 * SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #include "capalertmessage.h" 0007 #include "capalertinfo.h" 0008 #include "capreference.h" 0009 0010 namespace KWeatherCore 0011 { 0012 class CAPAlertMessagePrivate : public QSharedData 0013 { 0014 public: 0015 QString identifier; 0016 QString sender; 0017 QDateTime sentTime; 0018 CAPAlertMessage::Status status = CAPAlertMessage::Status::UnknownStatus; 0019 CAPAlertMessage::MessageType msgType = CAPAlertMessage::MessageType::UnknownMessageType; 0020 CAPAlertMessage::Scope scope = CAPAlertMessage::Scope::UnknownScope; 0021 QString note; 0022 std::vector<CAPAlertInfo> infoVec; 0023 std::vector<CAPReference> references; 0024 }; 0025 0026 CAPAlertMessage::CAPAlertMessage() 0027 : d(new CAPAlertMessagePrivate) 0028 { 0029 } 0030 CAPAlertMessage::CAPAlertMessage(const CAPAlertMessage &other) = default; 0031 CAPAlertMessage::CAPAlertMessage(CAPAlertMessage &&other) = default; 0032 CAPAlertMessage::~CAPAlertMessage() = default; 0033 CAPAlertMessage &CAPAlertMessage::operator=(const CAPAlertMessage &other) = default; 0034 CAPAlertMessage &CAPAlertMessage::operator=(CAPAlertMessage &&other) = default; 0035 0036 QString CAPAlertMessage::identifier() const 0037 { 0038 return d->identifier; 0039 } 0040 QString CAPAlertMessage::sender() const 0041 { 0042 return d->sender; 0043 } 0044 QDateTime CAPAlertMessage::sentTime() const 0045 { 0046 return d->sentTime; 0047 } 0048 CAPAlertMessage::Status CAPAlertMessage::status() const 0049 { 0050 return d->status; 0051 } 0052 CAPAlertMessage::MessageType CAPAlertMessage::messageType() const 0053 { 0054 return d->msgType; 0055 } 0056 CAPAlertMessage::Scope CAPAlertMessage::scope() const 0057 { 0058 return d->scope; 0059 } 0060 QString CAPAlertMessage::note() const 0061 { 0062 return d->note; 0063 } 0064 const std::vector<CAPAlertInfo> &CAPAlertMessage::alertInfos() const 0065 { 0066 return d->infoVec; 0067 } 0068 const std::vector<CAPReference> &CAPAlertMessage::references() const 0069 { 0070 return d->references; 0071 } 0072 CAPReference CAPAlertMessage::ownReference() const 0073 { 0074 return CAPReference(sender(), identifier(), sentTime()); 0075 } 0076 void CAPAlertMessage::setIdentifier(const QString &identifier) 0077 { 0078 d->identifier = identifier; 0079 } 0080 void CAPAlertMessage::setSender(const QString &sender) 0081 { 0082 d->sender = sender; 0083 } 0084 void CAPAlertMessage::setSentTime(const QDateTime &dateTime) 0085 { 0086 d->sentTime = dateTime; 0087 } 0088 void CAPAlertMessage::setStatus(Status status) 0089 { 0090 d->status = status; 0091 } 0092 void CAPAlertMessage::setMessageType(MessageType msgType) 0093 { 0094 d->msgType = msgType; 0095 } 0096 void CAPAlertMessage::setScope(Scope scope) 0097 { 0098 d->scope = scope; 0099 } 0100 void CAPAlertMessage::setNote(const QString ¬e) 0101 { 0102 d->note = note; 0103 } 0104 void CAPAlertMessage::addInfo(CAPAlertInfo &&alertInfo) 0105 { 0106 d->infoVec.emplace_back(alertInfo); 0107 } 0108 void CAPAlertMessage::setReferences(std::vector<CAPReference> &&references) 0109 { 0110 d->references = std::move(references); 0111 } 0112 } 0113 0114 #include "moc_capalertmessage.cpp"