1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtLocation module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL3$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or later as published by the Free
28 ** Software Foundation and appearing in the file LICENSE.GPL included in
29 ** the packaging of this file. Please review the following information to
30 ** ensure the GNU General Public License version 2.0 requirements will be
31 ** met: http://www.gnu.org/licenses/gpl-2.0.html.
32 **
33 ** $QT_END_LICENSE$
34 **
35 ****************************************************************************/
36 
37 #include "qplacematchreply.h"
38 #include "qplacereply_p.h"
39 
40 
41 QT_BEGIN_NAMESPACE
42 class QPlaceMatchReplyPrivate : public QPlaceReplyPrivate
43 {
44 public:
QPlaceMatchReplyPrivate()45     QPlaceMatchReplyPrivate(){}
46     QList<QPlace> places;
47     QPlaceMatchRequest request;
48 };
49 
50 QT_END_NAMESPACE
51 
52 QT_USE_NAMESPACE
53 
54 /*!
55     \class QPlaceMatchReply
56     \inmodule QtLocation
57     \ingroup QtLocation-places
58     \ingroup QtLocation-places-replies
59     \since 5.6
60 
61     \brief The QPlaceMatchReply class manages a place matching operation started by an
62     instance of QPlaceManager.
63 
64     If the operation is successful, the number of places in the reply matches those
65     in the request.  If a particular place in the request is not found, a default
66     constructed place is used as a place holder in the reply. In this way, there
67     is always a one is to one relationship between input places in the request,
68     and output places in the reply.
69 
70     If the operation is not successful the number of places is always zero.
71 
72     See \l {Matching places between managers} for an example on how to use
73     a match reply.
74 
75     \sa QPlaceMatchRequest, QPlaceManager
76 */
77 
78 /*!
79     Constructs a match reply with a given \a parent.
80 */
QPlaceMatchReply(QObject * parent)81 QPlaceMatchReply::QPlaceMatchReply(QObject *parent)
82     : QPlaceReply(new QPlaceMatchReplyPrivate, parent)
83 {
84 }
85 
86 /*!
87     Destroys the match reply.
88 */
~QPlaceMatchReply()89 QPlaceMatchReply::~QPlaceMatchReply()
90 {
91 }
92 
93 /*!
94     Returns the type of reply.
95 */
type() const96 QPlaceReply::Type QPlaceMatchReply::type() const
97 {
98     return QPlaceReply::MatchReply;
99 }
100 
101  /*!
102     Returns a list of matching places;
103 */
places() const104 QList<QPlace> QPlaceMatchReply::places() const
105 {
106     Q_D(const QPlaceMatchReply);
107     return d->places;
108 }
109 
110 /*!
111     Sets the list of matching \a places.
112 */
setPlaces(const QList<QPlace> & places)113 void QPlaceMatchReply::setPlaces(const QList<QPlace> &places)
114 {
115     Q_D(QPlaceMatchReply);
116     d->places = places;
117 }
118 
119 /*!
120     Returns the match request that was used to generate this reply.
121 */
request() const122 QPlaceMatchRequest QPlaceMatchReply::request() const
123 {
124     Q_D(const QPlaceMatchReply);
125     return d->request;
126 }
127 
128 /*!
129     Sets the match \a request used to generate this reply.
130 */
setRequest(const QPlaceMatchRequest & request)131 void QPlaceMatchReply::setRequest(const QPlaceMatchRequest &request)
132 {
133     Q_D(QPlaceMatchReply);
134     d->request = request;
135 }
136