CFx SDK Documentation  2022 SP0
FxNANetworkRequest.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2021 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 
22 #include <QtCore/QByteArray>
23 #include <QtCore/QList>
24 #include <QtCore/QUrl>
25 #include <QtCore/QVariant>
26 
27 using CFxNAByteArray = QByteArray;
28 template< typename T >
29 using CFxNAList = QList< T >;
30 using CFxNAUrl = QUrl;
31 using CFxNAVariant = QVariant;
32 
33 class CFxNANetworkRequestImpl;
34 
35 #if defined( Q_OS_IOS )
36  typedef void* FxNetworkRequestHandle;
37 #elif defined( Q_OS_ANDROID )
38  // TODO implementation
39  typedef CFxJavaHandle* FxNetworkRequestHandle;
40 #else
41  #if defined(XENON)
42  // TODO implementation
43  typedef void* FxNetworkRequestHandle;
44  #else
45  #include <QtNetwork/QNetworkRequest>
46  typedef QNetworkRequest* FxNetworkRequestHandle;
47  #endif
48 #endif
49 
54 {
55 public:
56 
61  {
70  ServerHeader
71  };
72 
76  enum Attribute
77  {
104 
105  User = 1000,
106  UserMax = 32767
107  };
108 
114  explicit CFxNANetworkRequest( const CFxNAUrl& url = CFxNAUrl() );
115 
122 
129 
132 
135 
146 
155 
165  void setRawHeader( const CFxNAByteArray& headerName, const CFxNAByteArray& headerValue );
166 
174  CFxNAVariant rawHeader( const CFxNAByteArray& headerName ) const;
175 
184 
190  void setUrl( const CFxNAUrl& url );
191 
197  CFxNAUrl url() const;
198 
206  void setRequestTimeout( int timeoutMs );
207 
213  int requestTimeout() const;
214 
215 private:
216  CFxNANetworkRequestImpl *m_pImpl;
217  FxNetworkRequestHandle m_pHandle;
218 
219  //...
220 };
#define COMMONUI_API
QByteArray CFxNAByteArray
QList< T > CFxNAList
QVariant CFxNAVariant
QUrl CFxNAUrl
QNetworkRequest * FxNetworkRequestHandle
CFxNAUrl url() const
void setHeader(CFxNANetworkRequest::KnownHeaders header, const CFxNAVariant &value)
CFxNANetworkRequest & operator=(const CFxNANetworkRequest &other)
void setUrl(const CFxNAUrl &url)
CFxNANetworkRequest(const CFxNANetworkRequest &other)
@ CookieHeader
Corresponds to the HTTP Cookie header and contains a CFxList CFxNetworkCookie representing the cookie...
@ ContentTypeHeader
Corresponds to the HTTP Content-Type header and contains a string containing the media (MIME) type an...
@ UserAgentHeader
The User-Agent header sent by HTTP clients.
@ LocationHeader
Corresponds to the HTTP Location header and contains a URL representing the actual location of the da...
@ SetCookieHeader
Corresponds to the HTTP Set-Cookie header and contains a CFxList CFxNetworkCookie representing the co...
@ ContentDispositionHeader
Corresponds to the HTTP Content-Disposition header and contains a string containing the disposition t...
@ LastModifiedHeader
Corresponds to the HTTP Last-Modified header and contains a CFxDateTime representing the last modific...
@ ContentLengthHeader
Corresponds to the HTTP Content-Length header and contains the length in bytes of the data transmitte...
CFxNAList< CFxNAByteArray > rawHeaderList() const
void setRawHeader(const CFxNAByteArray &headerName, const CFxNAByteArray &headerValue)
@ SpdyWasUsedAttribute
Replies only, type: CFxMetaType::Bool Indicates whether SPDY was used for receiving this reply.
@ CustomVerbAttribute
Requests only, type: CFxMetaType::QByteArray Holds the value for the custom HTTP verb to send (destin...
@ HTTP2WasUsedAttribute
Replies only, type: CFxMetaType::Bool (default: false) Indicates whether HTTP/2 was used for receivin...
@ DoNotBufferUploadDataAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
@ ConnectionEncryptedAttribute
Replies only, type: CFxMetaType::Bool (default: false) Indicates whether the data was obtained throug...
@ RedirectionTargetAttribute
Replies only, type: CFxMetaType::CFxUrl (no default) If present, it indicates that the server is redi...
@ CookieLoadControlAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to ...
@ HttpStatusCodeAttribute
Replies only, type: CFxMetaType::Int (no default) Indicates the HTTP status code received from the HT...
@ OriginalContentLengthAttribute
Replies only, type CFxMetaType::Int Holds the original content-length attribute before being invalida...
@ FollowRedirectsAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the Network Access API shou...
@ CookieSaveControlAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to ...
@ HTTP2AllowedAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
@ SourceIsFromCacheAttribute
Replies only, type: CFxMetaType::Bool (default: false) Indicates whether the data was obtained from c...
@ HttpReasonPhraseAttribute
Replies only, type: CFxMetaType::QByteArray (no default) Indicates the HTTP reason phrase as received...
@ EmitAllUploadProgressSignalsAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether all upload signals should b...
@ BackgroundRequestAttribute
Type: CFxMetaType::Bool (default: false) Indicates that this is a background transfer,...
@ HttpPipeliningAllowedAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
@ SpdyAllowedAttribute
Requests only, type: CFxMetaType::Bool (default: false) Indicates whether the CFxNANetworkAccessManag...
@ HttpPipeliningWasUsedAttribute
Replies only, type: CFxMetaType::Bool Indicates whether the HTTP pipelining was used for receiving th...
@ CacheSaveControlAttribute
Requests only, type: CFxMetaType::Bool (default: true) Controls if the data obtained should be saved ...
@ CacheLoadControlAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::PreferNetwork) Controls how the ...
@ RedirectPolicyAttribute
Requests only, type: CFxMetaType::Int, should be one of the CFxNANetworkRequest::RedirectPolicy value...
@ AuthenticationReuseAttribute
Requests only, type: CFxMetaType::Int (default: CFxNANetworkRequest::Automatic) Indicates whether to ...
void setRequestTimeout(int timeoutMs)
CFxNAVariant header(CFxNANetworkRequest::KnownHeaders header) const
void setHandle(FxNetworkRequestHandle handle)
FxNetworkRequestHandle getHandle() const
int requestTimeout() const
CFxNANetworkRequest(const CFxNAUrl &url=CFxNAUrl())
CFxNAVariant rawHeader(const CFxNAByteArray &headerName) const
GLsizei const GLfloat * value
Definition: gles2_ext.h:302