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
qplacecontentrequest.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 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
#
include
"qplacecontentrequest_p.h"
6
#
include
"qplacecontentrequest.h"
7
#
include
"qgeocoordinate.h"
8
9
QT_BEGIN_NAMESPACE
10
11
QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceContentRequestPrivate)
12
13
bool
QPlaceContentRequestPrivate::operator==(
const
QPlaceContentRequestPrivate &other)
const
14
{
15
return
contentType == other.contentType
16
&& limit == other.limit;
17
}
18
19
void
QPlaceContentRequestPrivate::clear()
20
{
21
contentType = QPlaceContent::NoType;
22
limit = -1;
23
}
24
25
/*!
26
\class QPlaceContentRequest
27
\inmodule QtLocation
28
\ingroup QtLocation-places
29
\ingroup QtLocation-places-requests
30
\since 5.6
31
32
\brief The QPlaceContentRequest class represents the parameters of a content request.
33
34
The QPlaceContentRequest class is used in conjunction with a QPlaceManager to
35
retrieve rich content like images and reviews in a paginated fashion.
36
The following code would request a set of 5 images from the 10th index:
37
38
\snippet places/requesthandler.h Content request
39
\dots
40
\dots
41
\snippet places/requesthandler.h Content handler
42
43
\sa QPlaceContentReply
44
*/
45
46
/*!
47
Constructs a new request object.
48
*/
49
QPlaceContentRequest::QPlaceContentRequest()
50
: d_ptr(
new
QPlaceContentRequestPrivate())
51
{
52
}
53
54
/*!
55
Constructs a copy of \a other.
56
*/
57
QPlaceContentRequest::QPlaceContentRequest(
const
QPlaceContentRequest &other)
noexcept
=
default
;
58
59
/*!
60
Destroys the request object
61
*/
62
QPlaceContentRequest::~QPlaceContentRequest() =
default
;
63
64
/*!
65
Assigns \a other to this content request and returns a reference
66
to this content request.
67
*/
68
QPlaceContentRequest &QPlaceContentRequest::operator=(
const
QPlaceContentRequest & other)
noexcept
69
{
70
if
(
this
== &other)
71
return
*
this
;
72
73
d_ptr = other.d_ptr;
74
return
*
this
;
75
}
76
77
/*!
78
\fn bool QPlaceContentRequest::operator==(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs) noexcept
79
Returns true if \a lhs is equal to \a rhs, otherwise returns false.
80
*/
81
82
/*!
83
\fn bool QPlaceContentRequest::operator!=(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs) noexcept
84
Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
85
*/
86
87
bool
QPlaceContentRequest::isEqual(
const
QPlaceContentRequest &other)
const
noexcept
88
{
89
Q_D(
const
QPlaceContentRequest);
90
return
*d == *other.d_func();
91
}
92
93
/*!
94
Returns the type of content to be requested, for example reviews or images
95
*/
96
QPlaceContent::Type QPlaceContentRequest::contentType()
const
97
{
98
Q_D(
const
QPlaceContentRequest);
99
return
d->contentType;
100
}
101
102
/*!
103
Sets the \a type of content to be requested.
104
*/
105
void
QPlaceContentRequest::setContentType(QPlaceContent::Type type)
106
{
107
Q_D(QPlaceContentRequest);
108
d->contentType = type;
109
}
110
111
/*!
112
Returns the identifier of the place content is to be fetched for.
113
*/
114
QString QPlaceContentRequest::placeId()
const
115
{
116
Q_D(
const
QPlaceContentRequest);
117
return
d->placeId;
118
}
119
120
/*!
121
Sets the identifier of the place to fetch content for to \a identifier.
122
*/
123
void
QPlaceContentRequest::setPlaceId(
const
QString &identifier)
124
{
125
Q_D(QPlaceContentRequest);
126
d->placeId = identifier;
127
}
128
129
/*!
130
Returns backend specific additional content context associated with this place content request.
131
*/
132
QVariant QPlaceContentRequest::contentContext()
const
133
{
134
Q_D(
const
QPlaceContentRequest);
135
return
d->contentContext;
136
}
137
138
/*!
139
Sets the content context to \a context.
140
141
\note This method is intended to be used by geo service plugins when returning place content
142
results.
143
144
The content context is used by backends to store additional content context related to the
145
content request. Other relevant fields should also be filled in. For example, if the content
146
request is for image content the content type should also be set with \l setContentType(). The
147
content context allows additional context to be kept which is not directly accessible via the
148
Qt Location API.
149
150
The content context can be of any type storable in a QVariant. The value of the content context
151
is not intended to be used directly by applications.
152
*/
153
void
QPlaceContentRequest::setContentContext(
const
QVariant &context)
154
{
155
Q_D(QPlaceContentRequest);
156
d->contentContext = context;
157
}
158
159
/*!
160
Returns the maximum number of content items to retrieve.
161
162
A negative value for limit means that it is undefined. It is left up to the backend
163
provider to choose an appropriate number of items to return.
164
165
The default limit is -1.
166
*/
167
int
QPlaceContentRequest::limit()
const
168
{
169
Q_D(
const
QPlaceContentRequest);
170
return
d->limit;
171
}
172
173
/*!
174
Set the maximum number of content items to retrieve to
175
\a limit.
176
*/
177
void
QPlaceContentRequest::setLimit(
int
limit)
178
{
179
Q_D(QPlaceContentRequest);
180
d->limit = limit;
181
}
182
183
/*!
184
Clears the content request.
185
*/
186
void
QPlaceContentRequest::clear()
187
{
188
Q_D(QPlaceContentRequest);
189
d->clear();
190
}
191
192
inline
QPlaceContentRequestPrivate *QPlaceContentRequest::d_func()
193
{
194
return
static_cast
<QPlaceContentRequestPrivate *>(d_ptr.data());
195
}
196
197
inline
const
QPlaceContentRequestPrivate *QPlaceContentRequest::d_func()
const
198
{
199
return
static_cast
<
const
QPlaceContentRequestPrivate *>(d_ptr.constData());
200
}
201
202
QT_END_NAMESPACE
qtlocation
src
location
places
qplacecontentrequest.cpp
Generated on
for Qt by
1.18.0