swift
vatsimserverfilereader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2023 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_CORE_VATSIM_VATSIMSERVERFILEREADER_H
7 #define SWIFT_CORE_VATSIM_VATSIMSERVERFILEREADER_H
8 
9 #include <QObject>
10 #include <QString>
11 
12 #include "core/data/vatsimsetup.h"
13 #include "core/swiftcoreexport.h"
14 #include "core/threadedreader.h"
17 #include "misc/datacache.h"
21 
22 class QNetworkReply;
23 
24 namespace swift::core::vatsim
25 {
29  {
30  Q_OBJECT
31 
32  public:
34  explicit CVatsimServerFileReader(QObject *owner);
35 
38  swift::misc::network::CServerList getFsdServers() const;
39 
41  void readInBackgroundThread();
42 
43  signals:
45  void dataFileRead(int bytes);
46 
48  void dataRead(swift::misc::network::CEntityFlags::Entity entity,
49  swift::misc::network::CEntityFlags::ReadState state, int number, const QUrl &url);
50 
51  protected:
54  virtual void doWorkImpl() override;
56 
57  private:
59 
61  void parseVatsimFile(QNetworkReply *nwReply);
62 
63  swift::misc::network::CServer parseServer(const QJsonObject &) const;
64 
66  void read();
67  };
68 } // namespace swift::core::vatsim
69 
70 #endif // SWIFT_CORE_VATSIM_VATSIMSERVERFILEREADER_H
Support for threaded based reading and parsing tasks such as data files via http, or file system and ...
void dataRead(swift::misc::network::CEntityFlags::Entity entity, swift::misc::network::CEntityFlags::ReadState state, int number, const QUrl &url)
Data have been read.
void dataFileRead(int bytes)
Data have been read.
Value object encapsulating information of a server.
Definition: server.h:28
Value object encapsulating a list of servers.
Definition: serverlist.h:23
#define SWIFT_CORE_EXPORT
Export a class or function from the library.