CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FxNANetworkReply.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2023 by Graebert GmbH.
3//
4// Permission to use, copy, modify, and distribute this software in
5// object code form for any purpose and without fee is hereby granted,
6// provided that the above copyright notice appears in all copies and
7// that both that copyright notice and the limited warranty and
8// restricted rights notice below appear in all supporting
9// documentation.
10//
11// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15// UNINTERRUPTED OR ERROR FREE.
16
17#pragma once
18
19#include "../FxCommonFramework.h"
20#include "../UI/FxUIObject.h"
21#include "../UI/FxUISignal.h"
22#include "FxNANetworkRequest.h"
23
24#include <QtCore/QByteArray>
25#include <QtCore/QList>
26#include <QtCore/QPair>
27#include <QtCore/QSharedPointer>
28#include <QtCore/QString>
29#include <QtCore/QVariant>
30
31#include <cstddef>
32
33using CFxNAByteArray = QByteArray;
34template< typename T >
35using CFxNAList = QList< T >;
36template< typename T1, typename T2 >
37using CFxNAPair = QPair< T1, T2 >;
38using CFxNAString = QString;
39using CFxNAVariant = QVariant;
40using CFxNAUrl = QUrl;
41
46{
47public:
52 {
53 NoError = 0,
54
55 // network layer errors [relating to the destination server] (1-99):
56 ConnectionRefusedError = 1,
67 UnknownNetworkError = 99,
68
69 // proxy errors (101-199):
70 ProxyConnectionRefusedError = 101,
75 UnknownProxyError = 199,
76
77 // content errors (201-299):
78 ContentAccessDenied = 201,
85 UnknownContentError = 299,
86
87 // protocol errors
88 ProtocolUnknownError = 301,
90 ProtocolFailure = 399,
91
92 // Server side errors (401-499)
93 InternalServerError = 401,
96 UnknownServerError = 499
97 };
98
105
107 explicit CFxNANetworkReply( FxNativeHandle nativeReply );
108
110 CFxNANetworkReply( std::nullptr_t ) = delete;
111
114
120 void setRequest( const CFxNANetworkRequest& request );
121
128
134 bool isFinished() const;
135
141 bool isRunning() const;
142
149
156
164 long long bytesAvailable() const;
165
172
178 long long pos() const;
179
187 bool seek( long long pos );
188
197
206
214 bool hasRawHeader( const CFxNAByteArray& headerName ) const;
215
223 CFxNAByteArray rawHeader( const CFxNAByteArray& headerName ) const;
224
233
239 CFxNAUrl url() const;
240
243
244 // Slots
245
251 void abort();
252
253 // Signals
254
260 CFxUISignal<void( long long bytesReceived, long long bytesTotal )>& downloadProgress();
261
269 CFxUISignal<void( long long bytesSent, long long bytesTotal )>& uploadProgress();
270
277
284
291
292 //...
293};
#define COMMONUI_API
QByteArray CFxNAByteArray
QString CFxNAString
QByteArray CFxNAByteArray
QList< T > CFxNAList
QUrl CFxNAUrl
QVariant CFxNAVariant
QPair< T1, T2 > CFxNAPair
QObject * FxNativeHandle
Definition: FxUIObject.h:92
const CFxNANetworkRequest & request() const
NetworkError error() const
CFxNAVariant attribute(CFxNANetworkRequest::Attribute code) const
void setRequest(const CFxNANetworkRequest &request)
bool seek(long long pos)
CFxNANetworkReply()=delete
CFxNANetworkReply(FxNativeHandle nativeReply)
long long bytesAvailable() const
long long pos() const
CFxNANetworkReply(std::nullptr_t)=delete
CFxNAList< CFxNAByteArray > rawHeaderList() const
CFxUISignal< void(void)> & encrypted()
CFxUISignal< void(NetworkError)> & error()
CFxUISignal< void(long long bytesSent, long long bytesTotal)> & uploadProgress()
CFxUISignal< void(long long bytesReceived, long long bytesTotal)> & downloadProgress()
const CFxNAList< RawHeaderPair > & rawHeaderPairs() const
CFxNAByteArray rawHeader(const CFxNAByteArray &headerName) const
CFxNAVariant header(CFxNANetworkRequest::KnownHeaders header) const
bool hasRawHeader(const CFxNAByteArray &headerName) const
CFxNAPair< CFxNAByteArray, CFxNAByteArray > RawHeaderPair
CFxNAString errorString() const
@ BackgroundRequestNotAllowedError
the background request is not currently allowed due to platform policy.
@ TemporaryNetworkFailureError
the connection was broken due to disconnection from the network, however the system has initiated roa...
@ OperationNotImplementedError
the server does not support the functionality required to fulfill the request.
@ ProxyAuthenticationRequiredError
the proxy requires authentication in order to honour the request but did not accept any credentials o...
@ ContentReSendError
the request needed to be sent again, but this failed for example because the upload data could not be...
@ InsecureRedirectError
while following redirects, the network access API detected a redirect from a encrypted protocol (http...
@ NetworkSessionFailedError
the connection was broken due to disconnection from the network or failure to start the network.
@ ProxyTimeoutError
the connection to the proxy timed out or the proxy did not reply in time to the request sent
@ ContentOperationNotPermittedError
the operation requested on the remote content is not permitted
@ RemoteHostClosedError
the remote server closed the connection prematurely, before the entire reply was received and process...
@ ContentConflictError
the request could not be completed due to a conflict with the current state of the resource.
@ HostNotFoundError
the remote host name was not found (invalid hostname)
@ ProxyConnectionClosedError
the proxy server closed the connection prematurely, before the entire reply was received and processe...
@ ServiceUnavailableError
the server is unable to handle the request at this time.
@ SslHandshakeFailedError
the SSL/TLS handshake failed and the encrypted channel could not be established. The sslErrors() sign...
@ ContentGoneError
the requested resource is no longer available at the server.
@ ProtocolInvalidOperationError
the requested operation is invalid for this protocol
@ ContentNotFoundError
the remote content was not found at the server (similar to HTTP error 404)
@ AuthenticationRequiredError
the remote server requires authentication to serve the content but the credentials provided were not ...
@ OperationCanceledError
the operation was canceled via calls to abort() or close() before it was finished.
@ ProxyNotFoundError
the proxy host name was not found (invalid proxy hostname)
@ TooManyRedirectsError
while following redirects, the maximum limit was reached.
@ TimeoutError
the connection to the remote server timed out
bool isRunning() const
bool isFinished() const
CFxNAUrl url() const
CFxNAByteArray readAll()
CFxUISignal< void(void)> & finished()
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)