Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qnetworkrequestfactory.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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QNETWORKREQUESTFACTORY_H
6
#
define
QNETWORKREQUESTFACTORY_H
7
8
#
include
<
QtNetwork
/
qnetworkrequest
.
h
>
9
#
include
<
QtNetwork
/
qhttpheaders
.
h
>
10
11
#
include
<
QtCore
/
qcompare
.
h
>
12
#
include
<
QtCore
/
qshareddata
.
h
>
13
#
include
<
QtCore
/
qurlquery
.
h
>
14
#
include
<
QtCore
/
qurl
.
h
>
15
#
include
<
QtCore
/
qvariant
.
h
>
16
17
#
include
<
chrono
>
18
19
QT_BEGIN_NAMESPACE
20
21
class
QDebug;
22
#
if
QT_CONFIG
(
ssl
)
23
class
QSslConfiguration;
24
#
endif
25
26
class
QNetworkRequestFactoryPrivate;
27
QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QNetworkRequestFactoryPrivate, Q_NETWORK_EXPORT)
28
29
class
QNetworkRequestFactory
30
{
31
public
:
32
Q_NETWORK_EXPORT
QNetworkRequestFactory
();
33
Q_NETWORK_EXPORT
explicit
QNetworkRequestFactory
(
const
QUrl
&
baseUrl
);
34
Q_NETWORK_EXPORT
~
QNetworkRequestFactory
();
35
36
Q_NETWORK_EXPORT
QNetworkRequestFactory
(
const
QNetworkRequestFactory
&
other
);
37
QNetworkRequestFactory
(
QNetworkRequestFactory
&&other)
noexcept
=
default
;
38
Q_NETWORK_EXPORT
QNetworkRequestFactory
&
operator
=(
const
QNetworkRequestFactory
&
other
);
39
40
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP
(
QNetworkRequestFactory
)
41
void
swap
(
QNetworkRequestFactory
&other)
noexcept
{ d.swap(other.d); }
42
43
Q_NETWORK_EXPORT QUrl
baseUrl
()
const
;
44
Q_NETWORK_EXPORT
void
setBaseUrl
(
const
QUrl &url);
45
46
#
if
QT_CONFIG
(
ssl
)
47
Q_NETWORK_EXPORT
QSslConfiguration
sslConfiguration
()
const
;
48
Q_NETWORK_EXPORT
void
setSslConfiguration
(
const
QSslConfiguration
&
configuration
);
49
#
endif
50
51
Q_NETWORK_EXPORT QNetworkRequest
createRequest
()
const
;
52
Q_NETWORK_EXPORT
QNetworkRequest
createRequest
(
const
QUrlQuery
&
query
)
const
;
53
Q_NETWORK_EXPORT
QNetworkRequest
createRequest
(
const
QString
&
path
)
const
;
54
Q_NETWORK_EXPORT
QNetworkRequest
createRequest
(
const
QString
&
path
,
const
QUrlQuery
&
query
)
const
;
55
56
Q_NETWORK_EXPORT
void
setCommonHeaders
(
const
QHttpHeaders &headers);
57
Q_NETWORK_EXPORT QHttpHeaders
commonHeaders
()
const
;
58
Q_NETWORK_EXPORT
void
clearCommonHeaders
();
59
60
Q_NETWORK_EXPORT QByteArray
bearerToken
()
const
;
61
Q_NETWORK_EXPORT
void
setBearerToken
(
const
QByteArray &token);
62
Q_NETWORK_EXPORT
void
clearBearerToken
();
63
64
Q_NETWORK_EXPORT QString
userName
()
const
;
65
Q_NETWORK_EXPORT
void
setUserName
(
const
QString &userName);
66
Q_NETWORK_EXPORT
void
clearUserName
();
67
68
Q_NETWORK_EXPORT
QString
password
()
const
;
69
Q_NETWORK_EXPORT
void
setPassword
(
const
QString &password);
70
Q_NETWORK_EXPORT
void
clearPassword
();
71
72
Q_NETWORK_EXPORT
void
setTransferTimeout
(
std
::chrono::milliseconds timeout);
73
Q_NETWORK_EXPORT std::chrono::milliseconds
transferTimeout
()
const
;
74
75
Q_NETWORK_EXPORT QUrlQuery
queryParameters
()
const
;
76
Q_NETWORK_EXPORT
void
setQueryParameters
(
const
QUrlQuery &query);
77
Q_NETWORK_EXPORT
void
clearQueryParameters
();
78
79
Q_NETWORK_EXPORT
void
setPriority
(QNetworkRequest::Priority priority);
80
Q_NETWORK_EXPORT
QNetworkRequest
::
Priority
priority
()
const
;
81
82
Q_NETWORK_EXPORT QVariant
attribute
(
QNetworkRequest
::
Attribute
attribute
)
const
;
83
Q_NETWORK_EXPORT
QVariant
attribute
(
QNetworkRequest
::
Attribute
attribute
,
84
const
QVariant
&
defaultValue
)
const
;
85
Q_NETWORK_EXPORT
void
setAttribute
(QNetworkRequest::Attribute attribute,
const
QVariant &value);
86
Q_NETWORK_EXPORT
void
clearAttribute
(QNetworkRequest::Attribute attribute);
87
Q_NETWORK_EXPORT
void
clearAttributes
();
88
89
private
:
90
#
ifndef
QT_NO_DEBUG_STREAM
91
friend
Q_NETWORK_EXPORT
QDebug
operator
<<(
QDebug
debug
,
const
QNetworkRequestFactory
&
reply
);
92
#
endif
93
94
QExplicitlySharedDataPointer<QNetworkRequestFactoryPrivate> d;
95
};
96
97
Q_DECLARE_SHARED(QNetworkRequestFactory)
98
99
QT_END_NAMESPACE
100
101
#
endif
// QNETWORKREQUESTFACTORY_H
QNetworkRequestFactory
Convenience class for grouping remote server endpoints that share common network request properties.
Definition
qnetworkrequestfactory.h:30
QNetworkRequestFactory::setQueryParameters
Q_NETWORK_EXPORT void setQueryParameters(const QUrlQuery &query)
Sets query parameters that are added to individual requests' query parameters.
Definition
qnetworkrequestfactory.cpp:452
QNetworkRequestFactory::clearUserName
Q_NETWORK_EXPORT void clearUserName()
Clears the username set to this factory.
Definition
qnetworkrequestfactory.cpp:354
QNetworkRequestFactory::setBaseUrl
Q_NETWORK_EXPORT void setBaseUrl(const QUrl &url)
Sets the base URL used in individual requests to url.
Definition
qnetworkrequestfactory.cpp:141
QNetworkRequestFactory::~QNetworkRequestFactory
Q_NETWORK_EXPORT ~QNetworkRequestFactory()
Destroys this QNetworkRequestFactory object.
QNetworkRequestFactory::clearBearerToken
Q_NETWORK_EXPORT void clearBearerToken()
Clears the bearer token.
Definition
qnetworkrequestfactory.cpp:314
QNetworkRequestFactory::setBearerToken
Q_NETWORK_EXPORT void setBearerToken(const QByteArray &token)
Sets the bearer token to token.
Definition
qnetworkrequestfactory.cpp:300
QNetworkRequestFactory::setAttribute
Q_NETWORK_EXPORT void setAttribute(QNetworkRequest::Attribute attribute, const QVariant &value)
Definition
qnetworkrequestfactory.cpp:517
QNetworkRequestFactory::clearQueryParameters
Q_NETWORK_EXPORT void clearQueryParameters()
Clears the query parameters.
Definition
qnetworkrequestfactory.cpp:466
QNetworkRequestFactory::clearPassword
Q_NETWORK_EXPORT void clearPassword()
Clears the password set to this factory.
Definition
qnetworkrequestfactory.cpp:395
QNetworkRequestFactory::clearCommonHeaders
Q_NETWORK_EXPORT void clearCommonHeaders()
Clears current headers.
Definition
qnetworkrequestfactory.cpp:263
QNetworkRequestFactory::clearAttributes
Q_NETWORK_EXPORT void clearAttributes()
Definition
qnetworkrequestfactory.cpp:588
QNetworkRequestFactory::swap
void swap(QNetworkRequestFactory &other) noexcept
\memberswap{factory}
Definition
qnetworkrequestfactory.h:41
QNetworkRequestFactory::setUserName
Q_NETWORK_EXPORT void setUserName(const QString &userName)
Sets the username of this factory to userName.
Definition
qnetworkrequestfactory.cpp:343
QNetworkRequestFactory::setTransferTimeout
Q_NETWORK_EXPORT void setTransferTimeout(std::chrono::milliseconds timeout)
Sets timeout used for transfers.
Definition
qnetworkrequestfactory.cpp:409
QNetworkRequestFactory::setPassword
Q_NETWORK_EXPORT void setPassword(const QString &password)
Sets the password of this factory to password.
Definition
qnetworkrequestfactory.cpp:382
QNetworkRequestFactory::setPriority
Q_NETWORK_EXPORT void setPriority(QNetworkRequest::Priority priority)
Definition
qnetworkrequestfactory.cpp:485
QNetworkRequestFactory::clearAttribute
Q_NETWORK_EXPORT void clearAttribute(QNetworkRequest::Attribute attribute)
Definition
qnetworkrequestfactory.cpp:573
QNetworkRequestFactory::setCommonHeaders
Q_NETWORK_EXPORT void setCommonHeaders(const QHttpHeaders &headers)
Sets headers that are common to all requests.
Definition
qnetworkrequestfactory.cpp:242
QNetworkRequestFactory::QNetworkRequestFactory
QNetworkRequestFactory(QNetworkRequestFactory &&other) noexcept=default
Move-constructs the factory from other.
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
Q_STATIC_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
qtbase
src
network
access
qnetworkrequestfactory.h
Generated on
for Qt by
1.18.0