CFx SDK Documentation  2020SP3
FxNetworkAccessManager.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2020 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 "DDKERNEL.h"
20 #include "FxString.h"
21 
22 #include <QtCore/QObject>
23 #include <QtNetwork/QNetworkRequest>
24 
25 #include "FxPragmaPush.h"
26 
27 class QNetworkReply;
28 class QNetworkProxy;
29 
35 {
36 public:
38  virtual ~CFxNetworkReply();
39 
43  virtual void finishedRequest( QNetworkReply* ) = 0;
44 
48  virtual void downloadProgress( qint64 bytesReceived, qint64 bytesTotal ) = 0;
49 
50 };
51 
57 class DDKERNEL_API CFxNetworkAccessManager : public QObject
58 {
59  Q_OBJECT
60 
61 public:
62  struct Parameter
63  {
65  {}
66 
67  Parameter(const CFxString &key, const QByteArray& data) : sKey(key), sData(data)
68  {}
69 
71  QByteArray sData;
72  };
73 
74  typedef std::vector< Parameter > ParametersList;
75 
79  struct AccessData
80  {
82  : replyInterface(0)
83  , bBlocking(false)
84  , bIgnoreTimeout(false)
85  , bGet(false)
86  , bIgnoreProxyAndAuthentication(false)
87  , bNotDefaultContentType( false )
88  , bRetry(true)
89  {}
90 
92  CFxNetworkReply* reply,
93  const QNetworkRequest& req,
94  bool blocking = false,
95  bool bIgnoreProxyAndAuthentication = false,
96  bool bNotDefaultType = false )
97  : replyInterface(reply)
98  , request(req)
99  , bBlocking(blocking)
100  , bIgnoreTimeout(false)
101  , bGet(false)
102  , bIgnoreProxyAndAuthentication( bIgnoreProxyAndAuthentication )
103  , bNotDefaultContentType( bNotDefaultType )
104  , bRetry(true)
105  {}
106 
111 
115  QNetworkRequest request;
116 
121 
125  bool bBlocking;
126 
131 
135  bool bGet;
136 
141 
146 
151  bool bRetry;
152 
157  };
158 
161 
165  virtual QNetworkReply* post( const AccessData& data ) = 0;
166 
170  virtual QNetworkReply* get( const AccessData& data ) = 0;
171 
175  virtual QNetworkProxy proxy() = 0;
176 
180  virtual void setProxy(const QNetworkProxy& proxy) = 0;
181 
187  virtual bool findProxyServer() = 0;
188 
196  virtual int showDialog() = 0;
197 };
198 
200 {
201 public:
207  virtual void setUseSystemProxyConfiguration( bool enable ) = 0;
211  virtual bool usesSystemProxyConfiguration() = 0;
212 
213  virtual QMetaObject::Connection connectToProxyUpdated( std::function<void( QNetworkProxy )> slot ) = 0;
214 };
215 
216 #include "FxPragmaPop.h"
CFxNetworkAccessManager2::setUseSystemProxyConfiguration
virtual void setUseSystemProxyConfiguration(bool enable)=0
FxPragmaPop.h
CFxNetworkAccessManager::CFxNetworkAccessManager
CFxNetworkAccessManager()
CFxNetworkReply::finishedRequest
virtual void finishedRequest(QNetworkReply *)=0
CFxNetworkAccessManager
Definition: FxNetworkAccessManager.h:58
CFxNetworkAccessManager::AccessData::bNotDefaultContentType
bool bNotDefaultContentType
Definition: FxNetworkAccessManager.h:145
CFxNetworkAccessManager2::usesSystemProxyConfiguration
virtual bool usesSystemProxyConfiguration()=0
CFxNetworkAccessManager::AccessData::bGet
bool bGet
Definition: FxNetworkAccessManager.h:135
false
false
Definition: DimVarDefs.h:165
CFxNetworkAccessManager::AccessData::bBlocking
bool bBlocking
Definition: FxNetworkAccessManager.h:125
CFxNetworkReply
Definition: FxNetworkAccessManager.h:35
CFxNetworkAccessManager::post
virtual QNetworkReply * post(const AccessData &data)=0
CFxNetworkAccessManager::setProxy
virtual void setProxy(const QNetworkProxy &proxy)=0
CFxNetworkAccessManager::AccessData::AccessData
AccessData(CFxNetworkReply *reply, const QNetworkRequest &req, bool blocking=false, bool bIgnoreProxyAndAuthentication=false, bool bNotDefaultType=false)
Definition: FxNetworkAccessManager.h:91
DDKERNEL.h
CFxNetworkAccessManager::showDialog
virtual int showDialog()=0
FxString.h
qint64
long long qint64
Definition: FxQtCore.h:64
CFxNetworkAccessManager::AccessData::replyInterface
CFxNetworkReply * replyInterface
Definition: FxNetworkAccessManager.h:110
data
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
CFxNetworkAccessManager::Parameter
Definition: FxNetworkAccessManager.h:63
CFxNetworkAccessManager::Parameter::sKey
CFxString sKey
Definition: FxNetworkAccessManager.h:70
CFxNetworkAccessManager::AccessData::bIgnoreTimeout
bool bIgnoreTimeout
Definition: FxNetworkAccessManager.h:130
CFxNetworkAccessManager::ParametersList
std::vector< Parameter > ParametersList
Definition: FxNetworkAccessManager.h:74
CFxString
Definition: FxString.h:48
CFxNetworkReply::CFxNetworkReply
CFxNetworkReply()
CFxNetworkAccessManager::AccessData
Definition: FxNetworkAccessManager.h:80
CFxNetworkAccessManager::findProxyServer
virtual bool findProxyServer()=0
true
true
Definition: DimVarDefs.h:2046
CFxNetworkAccessManager::Parameter::sData
QByteArray sData
Definition: FxNetworkAccessManager.h:71
CFxNetworkAccessManager::AccessData::bIgnoreProxyAndAuthentication
bool bIgnoreProxyAndAuthentication
Definition: FxNetworkAccessManager.h:140
CFxNetworkAccessManager::AccessData::AccessData
AccessData()
Definition: FxNetworkAccessManager.h:81
CFxNetworkAccessManager::AccessData::request
QNetworkRequest request
Definition: FxNetworkAccessManager.h:115
CFxNetworkAccessManager::Parameter::Parameter
Parameter()
Definition: FxNetworkAccessManager.h:64
DDKERNEL_API
#define DDKERNEL_API
Definition: DDKERNEL.h:32
CFxNetworkAccessManager::get
virtual QNetworkReply * get(const AccessData &data)=0
CFxNetworkReply::~CFxNetworkReply
virtual ~CFxNetworkReply()
CFxNetworkAccessManager::AccessData::lParameters
ParametersList lParameters
Definition: FxNetworkAccessManager.h:120
CFxNetworkAccessManager2::connectToProxyUpdated
virtual QMetaObject::Connection connectToProxyUpdated(std::function< void(QNetworkProxy)> slot)=0
CFxNetworkAccessManager::proxy
virtual QNetworkProxy proxy()=0
CFxNetworkAccessManager::Parameter::Parameter
Parameter(const CFxString &key, const QByteArray &data)
Definition: FxNetworkAccessManager.h:67
CFxNetworkAccessManager::AccessData::bRetry
bool bRetry
Definition: FxNetworkAccessManager.h:151
CFxNetworkAccessManager::AccessData::qOverrideParameters
QByteArray qOverrideParameters
Definition: FxNetworkAccessManager.h:156
FxPragmaPush.h
CFxNetworkAccessManager::~CFxNetworkAccessManager
virtual ~CFxNetworkAccessManager()
CFxNetworkReply::downloadProgress
virtual void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)=0
CFxNetworkAccessManager2
Definition: FxNetworkAccessManager.h:200