Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-downloadmanagerreport.h
1#ifndef QX_DOWNLOADMANAGERREPORT_H
2#define QX_DOWNLOADMANAGERREPORT_H
3
4// Shared Lib Support
5#include "qx/network/qx_network_export.h"
6
7// Qt Includes
8#include <QMetaType>
9
10// Intra-component Includes
11#include "qx/network/qx-downloadopreport.h"
12
13// Extra-component Includes
15
16namespace Qx
17{
18
19//-Forward Declarations-------------------------------------------------------------------------------------------
20class AsyncDownloadManager;
21
22class QX_NETWORK_EXPORT DownloadManagerReport final : public AbstractError<"Qx::DownloadManagerReport", 3>
23{
25
26//-Class Enums----------------------------------------------------------------------------------------------------
27public:
28 enum class Outcome{
29 Success = 0x0,
30 Fail = 0x1,
31 Abort = 0x2
32 };
33
34//-Instance Variables---------------------------------------------------------------------------------------------
35private:
36 bool mNull;
37 Outcome mOutcome;
38 QString mOutcomeString;
39 QString mDetailsHeading;
40 QString mDetailsSpecific;
41 QString mDetailsGeneral;
42 qsizetype mSkipped;
43 qsizetype mAborted;
44 QList<DownloadOpReport> mTaskReports;
45
46//-Constructor-------------------------------------------------------------------------------------------------------
47public:
49
50//-Instance Functions----------------------------------------------------------------------------------------------
51private:
52 quint32 deriveValue() const override;
53 QString derivePrimary() const override;
54 QString deriveSecondary() const override;
55 QString deriveDetails() const override;
56
57public:
58 Outcome outcome() const;
59 QString outcomeString() const;
60 QString specificDetails() const;
61 QString generalDetails() const;
62 QString details() const;
63
64 bool wasSuccessful() const;
65 QList<DownloadOpReport> taskReports() const;
66 bool isNull() const;
67
68 qsizetype skipped() const;
69 qsizetype aborted() const;
70
71//-Inner Classes--------------------------------------------------------------------------------------------------
72private:
73 class Builder;
74};
75
77class DownloadManagerReport::Builder
78{
79//-Class Variables-----------------------------------------------------------------------------------------------
80private:
81 // Success
82 static inline const QString SUCCESS = u"All download tasks completed successfully."_s;
83
84 // Error overall
85 static inline const QString ERR_P_QUEUE_INCOMPL = u"The download(s) failed to complete successfully."_s;
86 static inline const QString ERR_S_OUTCOME_FAIL = u"One or more downloads failed due to the following reasons."_s;
87
88 // Error details
89 static inline const QString ERR_D_SKIP = u"%1 remaining download(s) were skipped due to previous errors aborted."_s;
90 static inline const QString ERR_D_ABORT = u"%1 remaining download(s) were aborted."_s;
91 static inline const QString ERR_D_SPECIFIC = u"Specific:"_s;
92 static inline const QString ERR_D_GENERAL = u"General:"_s;
93 static inline const QString ERR_D_LIST_ITEM = u"[%1] %2"_s;
94
95//-Instance Variables---------------------------------------------------------------------------------------------
96private:
97 DownloadManagerReport mWorkingReport;
98
99//-Constructor---------------------------------------------------------------------------------------------------
100public:
101 Builder();
102
103//-Instance Functions----------------------------------------------------------------------------------------------
104private:
105 void updateOutcome(const DownloadOpReport& dop);
106
107public:
108 void wDownload(DownloadOpReport downloadReport);
109 DownloadManagerReport build();
110};
113}
114
115Q_DECLARE_METATYPE(Qx::DownloadManagerReport);
116#endif // QX_DOWNLOADMANAGERREPORT_H
The AbstractError template class completes the Error interface and acts as the base class from which ...
Definition qx-abstracterror.h:86
The AsyncDownloadManager class is used to queue and process one or more downloads in an asynchronous ...
Definition qx-downloadmanager.h:45
The DownloadManagerReport class details the outcome of processing an AsyncDownloadManager or SyncDown...
Definition qx-downloadmanagerreport.h:23
Outcome
Definition qx-downloadmanagerreport.h:28
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5
The qx-abstracterror.h header file provides access to the base class from which custom error types sh...