Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
qx-downloadopreport.h
1#ifndef QX_DOWNLOADOPREPORT_H
2#define QX_DOWNLOADOPREPORT_H
3
4// Shared Lib Support
5#include "qx/network/qx_network_export.h"
6
7// Intra-component Includes
8#include "qx/network/qx-downloadtask.h"
9
10// Extra-component Includes
12
13namespace Qx
14{
15
16class QX_NETWORK_EXPORT DownloadOpReport final : public AbstractError<"Qx::DownloadOpReport", 4>
17{
18//-Class Enums------------------------------------------------------------------------------------------------------
19public:
20 enum Result{
21 Completed = 0,
22 Skipped = 1,
23 Aborted = 2,
24 Failed = 3,
25 };
26
27//-Class Members----------------------------------------------------------------------------------------------------
28private:
29 static inline const QString COMPLETE = u"The download [%1] -> [%2] did completed succesfully"_s;
30 static inline const QString INCOMPLETE = u"The download [%1] -> [%2] did not complete"_s;
31 static inline const QString FAILED = u"Error: %1"_s;
32 static inline const QString ABORTED = u"Task was aborted."_s;
33 static inline const QString SKIPPED = u"Task was skipped due to previous errors."_s;
34
35//-Instance Members---------------------------------------------------------------------------------------------------
36private:
37 Result mResult;
38 QString mResultString;
39 DownloadTask mTask;
40
41//-Constructor-------------------------------------------------------------------------------------------------------
42private:
43 DownloadOpReport(Result result, const QString& resultStr, const DownloadTask& task);
44
45//-Class Functions------------------------------------------------------------------------------------------------
46public:
47 static DownloadOpReport completedDownload(const DownloadTask& task);
48 static DownloadOpReport failedDownload(const DownloadTask& task, QString error);
49 static DownloadOpReport skippedDownload(const DownloadTask& task);
50 static DownloadOpReport abortedDownload(const DownloadTask& task);
51
52//-Instance Functions----------------------------------------------------------------------------------------------
53private:
54 quint32 deriveValue() const override;
55 Severity deriveSeverity() const override;
56 QString derivePrimary() const override;
57 QString deriveSecondary() const override;
58
59public:
60 Result result() const;
61 QString resultString() const;
62 DownloadTask task() const;
63 bool wasSuccessful() const;
64};
65
66}
67
68#endif // QX_DOWNLOADOPREPORT_H
The AbstractError template class completes the Error interface and acts as the base class from which ...
Definition qx-abstracterror.h:86
The DownloadOpReport class details the result of a single file download.
Definition qx-downloadopreport.h:17
Result
Definition qx-downloadopreport.h:20
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5
Severity
Definition qx-global.h:11
The qx-abstracterror.h header file provides access to the base class from which custom error types sh...
The DownloadTask struct contains the information necessary to download a file from a URL.
Definition qx-downloadtask.h:14