KD SOAP API Documentation: KDSoapClientThread_p.h Source File

| KD SOAP API Documentation 2.2

Loading...
Searching...
No Matches
KDSoapClientThread_p.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Soap project.
4**
5** SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
11#ifndef KDSOAPCLIENTTHREAD_P_H
12#define KDSOAPCLIENTTHREAD_P_H
13
14#include "KDSoapAuthentication.h"
15#include "KDSoapMessage.h"
16#include <QtCore/QMutex>
17#include <QtCore/QQueue>
18#include <QtCore/QSemaphore>
19#include <QtCore/QThread>
20#include <QtCore/QWaitCondition>
21#include <QtNetwork/QNetworkAccessManager>
22
23class KDSoapPendingCallWatcher;
24class KDSoapClientInterface;
25QT_BEGIN_NAMESPACE
26class QEventLoop;
27 QT_END_NAMESPACE
28
29 class KDSoapThreadTaskData
30{
31public:
32 KDSoapThreadTaskData(KDSoapClientInterface *iface, const QString &method, const KDSoapMessage &message, const QString &action,
33 const KDSoapHeaders &headers)
34 : m_iface(iface)
35 , m_method(method)
36 , m_message(message)
37 , m_action(action)
38 , m_headers(headers)
39 {
40 }
41
42 void waitForCompletion()
43 {
44 m_semaphore.acquire();
45 }
46 KDSoapMessage response() const
47 {
48 return m_response;
49 }
50 KDSoapHeaders responseHeaders() const
51 {
52 return m_responseHeaders;
53 }
54
55 KDSoapClientInterface *m_iface; // used by KDSoapThreadTask::process()
56 KDSoapAuthentication m_authentication;
57 QString m_method;
58 KDSoapMessage m_message;
59 QString m_action;
60 QSemaphore m_semaphore;
61 KDSoapMessage m_response;
62 KDSoapHeaders m_responseHeaders;
63 KDSoapHeaders m_headers;
64};
65
66// clazy:excludeall=ctor-missing-parent-argument
67 class KDSoapThreadTask : public QObject
68{
69 Q_OBJECT
70public:
71 explicit KDSoapThreadTask(KDSoapThreadTaskData *data) // clazy:exclude=ctor-missing-parent-argument
72 : m_data(data)
73 {
74 }
75
76 void process(QNetworkAccessManager &accessManager);
77 void slotAuthenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator);
78
79 signals:
80 void taskDone();
81
82private Q_SLOTS:
83 void slotFinished(KDSoapPendingCallWatcher *watcher);
84
85private:
86 KDSoapThreadTaskData *m_data;
87};
88
89 class KDSoapClientThread : public QThread
90{
91 Q_OBJECT
92public:
93 explicit KDSoapClientThread(QObject *parent = nullptr);
94
95 void enqueue(KDSoapThreadTaskData *taskData);
96
97 void stop();
98
99protected:
100 virtual void run() override;
101
102private:
103 QMutex m_mutex;
104 QQueue<KDSoapThreadTaskData *> m_queue;
105 QWaitCondition m_queueNotEmpty;
106 bool m_stopThread;
107};
108
109#endif // KDSOAPCLIENTTHREAD_P_H
KDSoapAuthentication.h
KDSoapMessage.h
KDSoapAuthentication
Definition KDSoapAuthentication.h:31
KDSoapClientInterface
Definition KDSoapClientInterface.h:51
KDSoapClientThread
Definition KDSoapClientThread_p.h:90
KDSoapClientThread::stop
void stop()
Definition KDSoapClientThread.cpp:113
KDSoapClientThread::run
virtual void run() override
Definition KDSoapClientThread.cpp:42
KDSoapClientThread::enqueue
void enqueue(KDSoapThreadTaskData *taskData)
Definition KDSoapClientThread.cpp:31
KDSoapHeaders
Definition KDSoapMessage.h:185
KDSoapMessage
Definition KDSoapMessage.h:29
KDSoapPendingCallWatcher
Definition KDSoapPendingCallWatcher.h:36
KDSoapThreadTaskData
Definition KDSoapClientThread_p.h:30
KDSoapThreadTaskData::m_authentication
KDSoapAuthentication m_authentication
Definition KDSoapClientThread_p.h:56
KDSoapThreadTaskData::waitForCompletion
void waitForCompletion()
Definition KDSoapClientThread_p.h:42
KDSoapThreadTaskData::m_headers
KDSoapHeaders m_headers
Definition KDSoapClientThread_p.h:63
KDSoapThreadTaskData::KDSoapThreadTaskData
KDSoapThreadTaskData(KDSoapClientInterface *iface, const QString &method, const KDSoapMessage &message, const QString &action, const KDSoapHeaders &headers)
Definition KDSoapClientThread_p.h:32
KDSoapThreadTaskData::m_message
KDSoapMessage m_message
Definition KDSoapClientThread_p.h:58
KDSoapThreadTaskData::m_response
KDSoapMessage m_response
Definition KDSoapClientThread_p.h:61
KDSoapThreadTaskData::m_responseHeaders
KDSoapHeaders m_responseHeaders
Definition KDSoapClientThread_p.h:62
KDSoapThreadTaskData::response
KDSoapMessage response() const
Definition KDSoapClientThread_p.h:46
KDSoapThreadTaskData::m_method
QString m_method
Definition KDSoapClientThread_p.h:57
KDSoapThreadTaskData::m_semaphore
QSemaphore m_semaphore
Definition KDSoapClientThread_p.h:60
KDSoapThreadTaskData::m_iface
KDSoapClientInterface * m_iface
Definition KDSoapClientThread_p.h:55
KDSoapThreadTaskData::responseHeaders
KDSoapHeaders responseHeaders() const
Definition KDSoapClientThread_p.h:50
KDSoapThreadTaskData::m_action
QString m_action
Definition KDSoapClientThread_p.h:59
KDSoapThreadTask
Definition KDSoapClientThread_p.h:68
KDSoapThreadTask::taskDone
void taskDone()
KDSoapThreadTask::KDSoapThreadTask
KDSoapThreadTask(KDSoapThreadTaskData *data)
Definition KDSoapClientThread_p.h:71
KDSoapThreadTask::slotAuthenticationRequired
void slotAuthenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator)
Definition KDSoapClientThread.cpp:120
KDSoapThreadTask::process
void process(QNetworkAccessManager &accessManager)
Definition KDSoapClientThread.cpp:71
QAuthenticator
QEventLoop
QMutex
QNetworkAccessManager
QNetworkReply
QObject
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::Q_SLOTS
Q_SLOTSQ_SLOTS
QObject::parent
QObject * parent() const const
QObject::qobject_cast
T qobject_cast(QObject *object)
QQueue
QSemaphore
QSemaphore::acquire
void acquire(int n)
QString
QThread
QWaitCondition

© 2010-2024 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-soap/
Generated on Sun Jan 7 2024 11:47:36 for KD SOAP API Documentation by doxygen 1.9.8