KWeatherCore

feedparser.h
1 /*
2  * SPDX-FileCopyrightText: 2021 Han Young <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #pragma once
7 #include "alertfeedentry.h"
8 #include "alertinfo.h"
9 #include <QJsonDocument>
10 #include <QXmlStreamReader>
11 #include <memory>
12 namespace KWeatherCore
13 {
14 class FeedParser : public QObject
15 {
16  Q_OBJECT
17 public:
18  FeedParser(const QJsonDocument &configFile, QObject *parent = nullptr);
19  void setConfig(const QJsonDocument &configFile);
20  std::unique_ptr<std::vector<std::unique_ptr<AlertFeedEntry>>> parse(const QByteArray &data) const;
21 
22 private:
23  std::unique_ptr<AlertFeedEntry> parseOneEntry(QXmlStreamReader &reader) const;
24  QUrl parseCapElement(QXmlStreamReader &reader) const;
25  void parsePolygonElement(QXmlStreamReader &reader, AlertFeedEntry &entry) const;
26  QUrl m_url;
27  QString m_entryMarker;
28  QString m_titleMarker;
29  bool m_hasCap;
30  QString m_capLinkElementMarker;
31  QString m_capValueType; // ie. "attribute"
32  QString m_capValueMarker; // ie. "href"
33  QString m_summaryMarker;
34  bool m_hasArea;
35  QString m_areaNameMarker;
36  QString m_polygonMarker;
37  QString m_FIPS6Marker;
38  QString m_UGCMarker;
39  QString m_urgencyMarker;
40  QString m_severityMarker;
41  QString m_certaintyMarker;
42  bool m_hasDate;
43  QString m_dateMarker;
44  QString m_dateFormat;
45 };
46 }
Q_OBJECTQ_OBJECT
KHEALTHCERTIFICATE_EXPORT QVariant parse(const QByteArray &data)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Oct 21 2021 23:05:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.