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
qplacereply.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 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 "qplacereply.h"
7
8QT_USE_NAMESPACE
9
10/*!
11 \class QPlaceReply
12 \inmodule QtLocation
13 \ingroup QtLocation-places
14 \ingroup QtLocation-places-replies
15 \since 5.6
16
17 \brief The QPlaceReply class manages an operation started by an instance of QPlaceManager and
18 serves as a base class for more specialized replies.
19
20 The QPlaceReply and each of its specialized subclasses manage the
21 state and results of their corresponding operations. The QPlaceReply itself is used
22 for operations that have no results, that is, it only necessary to know if the operation
23 succeeded or failed.
24
25 The finished() signal can be used to monitor the progress of an operation.
26 Once an operation is complete, the error() and errorString() methods provide information
27 on whether the operation completed successfully. If successful, the reply
28 will contain the results for that operation, that is, each subclass will have appropriate
29 functions to retrieve the results of an operation.
30
31 \sa QPlaceManager
32*/
33
34/*!
35 \enum QPlaceReply::Error
36
37 Describes an error which occurred during an operation.
38 \value NoError
39 No error has occurred
40 \value PlaceDoesNotExistError
41 A specified place could not be found
42 \value CategoryDoesNotExistError
43 A specified category could not be found
44 \value CommunicationError
45 An error occurred communicating with the service provider.
46 \value ParseError
47 The response from the service provider or an import file was in an unrecognizable format
48 \value PermissionsError
49 The operation failed because of insufficient permissions.
50 \value UnsupportedError
51 The operation was not supported by the service provider.
52 \value BadArgumentError.
53 A parameter that was provided was invalid.
54 \value CancelError
55 The operation was canceled.
56 \value UnknownError
57 An error occurred which does not fit into any of the other categories.
58*/
59
60/*!
61 \enum QPlaceReply::Type
62
63 Describes the reply's type.
64 \value Reply
65 This is a generic reply.
66 \value DetailsReply
67 This is a reply for the retrieval of place details
68 \value SearchReply
69 This is a reply for the place search operation.
70 \value SearchSuggestionReply
71 This is a reply for a search suggestion operation.
72 \value ContentReply
73 This is a reply for content associated with a place.
74 \value IdReply
75 This is a reply that returns an identifier of a place or category.
76 Typically used for place or category save and remove operations.
77 \value MatchReply
78 This is a reply that returns places that match
79 those from another provider.
80*/
81
82/*!
83 Constructs a reply object with a given \a parent.
84*/
85QPlaceReply::QPlaceReply(QObject *parent)
86 : QObject(parent),d_ptr(new QPlaceReplyPrivate)
87{
88}
89
90/*!
91 \internal
92*/
93QPlaceReply::QPlaceReply(QPlaceReplyPrivate *dd, QObject *parent)
94 : QObject(parent),d_ptr(dd)
95{
96}
97
98/*!
99 Destroys the reply object.
100*/
101QPlaceReply::~QPlaceReply()
102{
103 if (!isFinished()) {
104 abort();
105 }
106 delete d_ptr;
107}
108
109/*!
110 Return true if the reply has completed.
111*/
112bool QPlaceReply::isFinished() const
113{
114 return d_ptr->isFinished;
115}
116
117/*!
118 Returns the type of the reply.
119*/
120QPlaceReply::Type QPlaceReply::type() const
121{
122 return QPlaceReply::Reply;
123}
124
125/*!
126 Sets the status of whether the reply is \a finished
127 or not. This function does not cause the finished() signal
128 to be emitted.
129*/
130void QPlaceReply::setFinished(bool finished)
131{
132 d_ptr->isFinished = finished;
133}
134
135/*!
136 Sets the \a error and \a errorString of the reply.
137 This function does not cause the
138 QPlaceReply::errorOccurred(QPlaceReply::Error, const QString &errorString)
139 signal to be emitted.
140*/
141void QPlaceReply::setError(QPlaceReply::Error error, const QString &errorString)
142{
143 d_ptr->error = error;
144 d_ptr->errorString = errorString;
145}
146
147/*!
148 Returns the error string of the reply. The error string is intended to be
149 used by developers only and is not fit to be displayed to an end user.
150
151 If no error has occurred, the string is empty.
152*/
153QString QPlaceReply::errorString() const
154{
155 return d_ptr->errorString;
156}
157
158/*!
159 Returns the error code.
160*/
161QPlaceReply::Error QPlaceReply::error() const
162{
163 return d_ptr->error;
164}
165
166/*!
167 \fn void QPlaceReply::aborted()
168 \since 5.9
169
170 This signal is emitted when the operation has been cancelled.
171
172 \sa abort()
173*/
174
175/*!
176 Cancels the operation immediately.
177
178 \sa aborted()
179*/
180void QPlaceReply::abort()
181{
182 emit aborted();
183}
184
185/*!
186 \fn void QPlaceReply::finished()
187
188 This signal is emitted when this reply has finished processing.
189
190 If error() equals QPlaceReply::NoError then the processing
191 finished successfully.
192
193 This signal and QPlaceManager::finished() will be
194 emitted at the same time.
195
196 \note Do not delete this reply object in the slot connected to this
197 signal. Use deleteLater() instead.
198*/
199
200/*!
201 \fn void QPlaceReply::contentUpdated()
202
203 This signal is emitted when this reply has updated content available.
204 Depending on the plugin, this signal may never be emitted or emitted
205 multiple times before \l QPlaceReply::finished() is emitted, as some
206 backends are able to return the requested content asynchronously and
207 incrementally.
208
209 \note Do not delete or deleteLater this reply object in the slot
210 connected to this signal. Do it only upon \l QPlaceReply::finished.
211*/
212
213/*!
214 \fn void QPlaceReply::errorOccurred(QPlaceReply::Error error, const QString &errorString)
215
216 This signal is emitted when an error has been detected in the processing of
217 this reply. The finished() signal will probably follow.
218
219 The error will be described by the error code \a error. If \a errorString is
220 not empty it will contain a textual description of the error meant for
221 developers and not end users.
222
223 This signal and QPlaceManager::errorOccurred() will be emitted at the same time.
224
225 \note Do not delete this reply object in the slot connected to this
226 signal. Use deleteLater() instead.
227*/