CFx SDK Documentation  2022 SP0
FxNetworkAccessManager.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 "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 
203  virtual void setUseSystemProxyConfiguration( bool enable ) = 0;
207  virtual bool usesSystemProxyConfiguration() = 0;
208 
209  virtual QMetaObject::Connection connectToProxyUpdated( std::function<void( QNetworkProxy )> slot ) = 0;
210 };
211 
212 #include "FxPragmaPop.h"
#define DDKERNEL_API
Definition: DDKERNEL.h:32
true
Definition: DimVarDefs.h:2046
false
Definition: DimVarDefs.h:165
long long qint64
Definition: FxQtCore.h:64
virtual QNetworkReply * get(const AccessData &data)=0
virtual ~CFxNetworkAccessManager()
virtual bool findProxyServer()=0
virtual bool usesSystemProxyConfiguration()=0
virtual QNetworkProxy proxy()=0
virtual int showDialog()=0
virtual QNetworkReply * post(const AccessData &data)=0
std::vector< Parameter > ParametersList
virtual void setProxy(const QNetworkProxy &proxy)=0
virtual void setUseSystemProxyConfiguration(bool enable)=0
virtual QMetaObject::Connection connectToProxyUpdated(std::function< void(QNetworkProxy)> slot)=0
virtual ~CFxNetworkReply()
virtual void finishedRequest(QNetworkReply *)=0
virtual void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)=0
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
AccessData(CFxNetworkReply *reply, const QNetworkRequest &req, bool blocking=false, bool bIgnoreProxyAndAuthentication=false, bool bNotDefaultType=false)
Parameter(const CFxString &key, const QByteArray &data)