Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkrequestfactory_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QNETWORKREQUESTFACTORY_P_H
5#define QNETWORKREQUESTFACTORY_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the Network Access framework. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtNetwork/qhttpheaders.h>
19#include <QtNetwork/qnetworkrequest.h>
20#if QT_CONFIG(ssl)
21#include <QtNetwork/qsslconfiguration.h>
22#endif
23#include <QtCore/qhash.h>
24#include <QtCore/qshareddata.h>
25#include <QtCore/qurl.h>
26#include <QtCore/qurlquery.h>
27#include <QtCore/qvariant.h>
28
29QT_BEGIN_NAMESPACE
30
31class QNetworkRequestFactoryPrivate : public QSharedData
32{
33public:
34 QNetworkRequestFactoryPrivate();
35 explicit QNetworkRequestFactoryPrivate(const QUrl &baseUrl);
36 QNetworkRequest newRequest(const QUrl &url) const;
37 QUrl requestUrl(const QString *path = nullptr, const QUrlQuery *query = nullptr) const;
38
39#if QT_CONFIG(ssl)
40 QSslConfiguration sslConfig;
41#endif
42 QUrl baseUrl;
43 QHttpHeaders headers;
44 QByteArray bearerToken;
45 QString userName;
46 QString password;
47 QUrlQuery queryParameters;
48 QNetworkRequest::Priority priority = QNetworkRequest::NormalPriority;
49 std::chrono::milliseconds transferTimeout{0};
50 QHash<QNetworkRequest::Attribute, QVariant> attributes;
51};
52
54
55#endif // QNETWORKREQUESTFACTORY_P_H
Convenience class for grouping remote server endpoints that share common network request properties.
Q_NETWORK_EXPORT void setQueryParameters(const QUrlQuery &query)
Sets query parameters that are added to individual requests' query parameters.
Q_NETWORK_EXPORT void clearUserName()
Clears the username set to this factory.
Q_NETWORK_EXPORT void setBaseUrl(const QUrl &url)
Sets the base URL used in individual requests to url.
Q_NETWORK_EXPORT ~QNetworkRequestFactory()
Destroys this QNetworkRequestFactory object.
Q_NETWORK_EXPORT void clearBearerToken()
Clears the bearer token.
Q_NETWORK_EXPORT void setBearerToken(const QByteArray &token)
Sets the bearer token to token.
Q_NETWORK_EXPORT void setAttribute(QNetworkRequest::Attribute attribute, const QVariant &value)
Q_NETWORK_EXPORT void clearQueryParameters()
Clears the query parameters.
Q_NETWORK_EXPORT void clearPassword()
Clears the password set to this factory.
Q_NETWORK_EXPORT void clearCommonHeaders()
Clears current headers.
Q_NETWORK_EXPORT void clearAttributes()
Q_NETWORK_EXPORT void setUserName(const QString &userName)
Sets the username of this factory to userName.
Q_NETWORK_EXPORT void setTransferTimeout(std::chrono::milliseconds timeout)
Sets timeout used for transfers.
Q_NETWORK_EXPORT void setPassword(const QString &password)
Sets the password of this factory to password.
Q_NETWORK_EXPORT void setPriority(QNetworkRequest::Priority priority)
Q_NETWORK_EXPORT void clearAttribute(QNetworkRequest::Attribute attribute)
Q_NETWORK_EXPORT void setCommonHeaders(const QHttpHeaders &headers)
Sets headers that are common to all requests.
QNetworkRequestFactory(QNetworkRequestFactory &&other) noexcept=default
Move-constructs the factory from other.
Combined button and popup list for selecting options.
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")