Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Classes | Signals | Public Member Functions | Private Attributes | List of all members
geometrize::network::Downloader Class Reference

The Downloader class is a helper class for downloading files over the network. More...

#include <downloader.h>

Inheritance diagram for geometrize::network::Downloader:
Inheritance graph
[legend]
Collaboration diagram for geometrize::network::Downloader:
Collaboration graph
[legend]

Classes

class  DownloaderImpl
 

Signals

void signal_downloaded (Downloader *downloader, QNetworkReply::NetworkError error)
 signal_downloaded Dispatched after a download completes. More...
 

Public Member Functions

 Downloader (const QUrl &url, const std::function< void(Downloader *, QNetworkReply::NetworkError)> &onDownloaded)
 Downloader Creates a new Downloader. More...
 
virtual ~Downloader ()
 
Downloaderoperator= (const Downloader &)=delete
 
 Downloader (const Downloader &)=delete
 
QByteArray getDownloadedData () const
 getDownloadedData Gets the data the Downloader has downloaded. More...
 
QUrl getUrl () const
 getUrl Gets the URL the Downloader was made to download. More...
 

Private Attributes

std::unique_ptr< DownloaderImpld
 

Detailed Description

The Downloader class is a helper class for downloading files over the network.

Constructor & Destructor Documentation

geometrize::network::Downloader::Downloader ( const QUrl &  url,
const std::function< void(Downloader *, QNetworkReply::NetworkError)> &  onDownloaded 
)
explicit

Downloader Creates a new Downloader.

Parameters
urlThe URL to download.
onDownloadedThe callback triggered when the download completes.
51  : QObject(nullptr), d{std::make_unique<Downloader::DownloaderImpl>(this, url, onDownloaded)}
52 {
53 }
std::unique_ptr< DownloaderImpl > d
Definition: downloader.h:54
geometrize::network::Downloader::~Downloader ( )
virtual
56 {
57 }
geometrize::network::Downloader::Downloader ( const Downloader )
delete

Member Function Documentation

QByteArray geometrize::network::Downloader::getDownloadedData ( ) const

getDownloadedData Gets the data the Downloader has downloaded.

Returns
The downloaded data.
60 {
61  return d->getDownloadedData();
62 }
std::unique_ptr< DownloaderImpl > d
Definition: downloader.h:54
QUrl geometrize::network::Downloader::getUrl ( ) const

getUrl Gets the URL the Downloader was made to download.

Returns
The downloaded data.
65 {
66  return d->getUrl();
67 }
std::unique_ptr< DownloaderImpl > d
Definition: downloader.h:54
Downloader& geometrize::network::Downloader::operator= ( const Downloader )
delete
void geometrize::network::Downloader::signal_downloaded ( Downloader downloader,
QNetworkReply::NetworkError  error 
)
signal

signal_downloaded Dispatched after a download completes.

Parameters
downloaderA reference to the downloader object. Remember to delete the downloader if necessary.
errorThe network error (if any).

Member Data Documentation

std::unique_ptr<DownloaderImpl> geometrize::network::Downloader::d
private

The documentation for this class was generated from the following files: