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