KWeatherCore

alertfeedentry.h
1/*
2 * SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#pragma once
7#include "capalertinfo.h"
8#include "caparea.h"
9#include "kweathercore/kweathercore_export.h"
10#include "pendingcap.h"
11#include <QObject>
12#include <memory>
13namespace KWeatherCore
14{
15// code name (FIPS6, UGC...)/code value (002050, AKZ155)
16using AreaCodeVec = std::vector<std::pair<QString, QString>>;
17/**
18 * @short Class represents single CAP
19 *
20 * This class contains the parsed CAP FEED entry
21 *
22 * @author Han Young <hanyoung@protonmail.com>
23 */
24class KWEATHERCORE_EXPORT AlertFeedEntry
25{
26 Q_GADGET
27 Q_PROPERTY(QString title READ title)
28 Q_PROPERTY(QString summary READ summary)
29 Q_PROPERTY(QString area READ area)
30 Q_PROPERTY(QString urgency READ urgency)
31 Q_PROPERTY(QString severity READ severity)
32 Q_PROPERTY(QString certainty READ certainty)
33 Q_PROPERTY(QDateTime date READ date)
34public:
35 /**
36 * default constructor
37 */
39 /**
40 * copy constructor
41 */
42 AlertFeedEntry(const AlertFeedEntry &other);
45 /**
46 * title of this entry
47 */
48 const QString &title() const;
49 /**
50 * summary of this entry
51 */
52 const QString &summary() const;
53 /**
54 * area name, for accurate location
55 * use @AreaCodes if possible
56 */
57 const QString &area() const;
58 /**
59 * urgency
60 * @return localized, "Unknown" by defaut
61 */
62 QString urgency() const;
63 /**
64 * severity
65 * @return localized, "Unknown" by defaut
66 */
67 QString severity() const;
68 /**
69 * certainty
70 * @return localized, "Unknown" by defaut
71 */
72 QString certainty() const;
73 /**
74 * could be date of the alert or the date of this message
75 * refer to CAP for accurate date
76 * see @CAP
77 */
78 const QDateTime &date() const;
79 /**
80 * CAP, request to download CAP file
81 * @return it is the client's responsibility to delete the
82 * PendingCAP afterward to avoid memory leak
83 */
84 PendingCAP *CAP() const;
85 /**
86 * areaCodes
87 * @return pairs of QString, the first one is code type,
88 * ie. {"UGC", "AKZ017 AKZ020 AKZ021 AKZ022 AKZ023"}
89 */
90 const AreaCodeVec &areaCodes() const;
91 /**
92 * area polygon
93 * @return latitude longitude pairs
94 */
95 const CAPPolygon &polygon() const;
96
97 void setTitle(const QString &title);
98 void setSummary(const QString &summary);
99 void setArea(const QString &area);
100 void setUrgency(CAPAlertInfo::Urgency urgency);
101 void setCertainty(CAPAlertInfo::Certainty certainty);
102 void setSeverity(CAPAlertInfo::Severity severity);
103 void setDate(const QDateTime &date);
104 void setUrl(const QUrl &url);
105 void setAreaCodes(const AreaCodeVec &areaCodes);
106 void setAreaCodes(AreaCodeVec &&areaCodes);
107 void setPolygon(CAPPolygon &&polygon);
108 AlertFeedEntry &operator=(const AlertFeedEntry &other);
109 AlertFeedEntry &operator=(AlertFeedEntry &&other);
110
111private:
112 class AlertFeedEntryPrivate;
113 std::unique_ptr<AlertFeedEntryPrivate> d;
114};
115}
Class represents single CAP.
The PendingAlerts class contains the reply to an asynchronous CAP request.
Definition pendingcap.h:25
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.