Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
downloader.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 
6 #include <QByteArray>
7 #include <QNetworkReply>
8 #include <QObject>
9 
10 namespace geometrize
11 {
12 
13 namespace network
14 {
15 
19 class Downloader : public QObject
20 {
21  Q_OBJECT
22 public:
28  explicit Downloader(const QUrl& url, const std::function<void(Downloader*, QNetworkReply::NetworkError)>& onDownloaded);
29  virtual ~Downloader();
30  Downloader& operator=(const Downloader&) = delete;
31  Downloader(const Downloader&) = delete;
32 
37  QByteArray getDownloadedData() const;
38 
43  QUrl getUrl() const;
44 
45 signals:
51  void signal_downloaded(Downloader* downloader, QNetworkReply::NetworkError error);
52 
53 private:
55  std::unique_ptr<DownloaderImpl> d;
56 };
57 
58 }
59 
60 }
The Downloader class is a helper class for downloading files over the network.
Definition: downloader.h:19
QByteArray getDownloadedData() const
getDownloadedData Gets the data the Downloader has downloaded.
Definition: downloader.cpp:59
Downloader & operator=(const Downloader &)=delete
QUrl getUrl() const
getUrl Gets the URL the Downloader was made to download.
Definition: downloader.cpp:64
Downloader(const QUrl &url, const std::function< void(Downloader *, QNetworkReply::NetworkError)> &onDownloaded)
Downloader Creates a new Downloader.
Definition: downloader.cpp:51
virtual ~Downloader()
Definition: downloader.cpp:55
void signal_downloaded(Downloader *downloader, QNetworkReply::NetworkError error)
signal_downloaded Dispatched after a download completes.
std::unique_ptr< DownloaderImpl > d
Definition: downloader.h:54