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 "qplacecontentreply.h"
38#include "qplacereply_p.h"
39
40QT_BEGIN_NAMESPACE
41class QPlaceContentReplyPrivate : public QPlaceReplyPrivate
42{
43public:
44 QPlaceContentReplyPrivate()
45 : totalCount(0)
46 { }
47
48 QPlaceContent::Collection contentCollection;
49 int totalCount;
50 QPlaceContentRequest contentRequest;
51 QPlaceContentRequest previousPageRequest;
52 QPlaceContentRequest nextPageRequest;
53};
54
55QT_END_NAMESPACE
56
57QT_USE_NAMESPACE
58
59/*!
60 \class QPlaceContentReply
61 \inmodule QtLocation
62 \ingroup QtLocation-places
63 \ingroup QtLocation-places-replies
64 \since 5.6
65
66 \brief The QPlaceContentReply class manages a content retrieval operation started by an
67 instance of QPlaceManager.
68
69 See \l {Fetching Rich Content} for an example on how to use a content reply.
70 \sa QPlaceContentRequest, QPlaceManager
71*/
72
73/*!
74 Constructs a content reply with a given \a parent.
75*/
76QPlaceContentReply::QPlaceContentReply(QObject *parent)
77 : QPlaceReply(new QPlaceContentReplyPrivate, parent)
78{
79}
80
81/*!
82 Destroys the reply.
83*/
84QPlaceContentReply::~QPlaceContentReply()
85{
86}
87
88 /*!
89 Returns the collection of content retrieved.
90*/
91QPlaceContent::Collection QPlaceContentReply::content() const
92{
93 Q_D(const QPlaceContentReply);
94 return d->contentCollection;
95}
96
97/*!
98 Returns the type of reply.
99*/
100QPlaceReply::Type QPlaceContentReply::type() const
101{
102 return QPlaceReply::ContentReply;
103}
104
105/*!
106 Sets the \a content of the reply.
107*/
108void QPlaceContentReply::setContent(const QPlaceContent::Collection &content)
109{
110 Q_D(QPlaceContentReply);
111 d->contentCollection = content;
112}
113
114/*!
115 Returns the total number of content objects for a place. If the total number of
116 content objects cannot be counted, a value of -1 is returned. This count only
117 refers to the total count for a single content type, that is, the content type that
118 was specified when content was requested with the QPlaceManager.
119*/
120int QPlaceContentReply::totalCount() const
121{
122 Q_D(const QPlaceContentReply);
123 return d->totalCount;
124}
125
126/*!
127 Sets the \a total number of content objects for a place.
128*/
129void QPlaceContentReply::setTotalCount(int total)
130{
131 Q_D(QPlaceContentReply);
132 d->totalCount = total;
133}
134
135/*!
136 Returns the content request that was used to generate this reply.
137*/
138QPlaceContentRequest QPlaceContentReply::request() const
139{
140 Q_D(const QPlaceContentReply);
141 return d->contentRequest;
142}
143
144/*!
145 Returns a place content request that can be used to request the previous batch of place content
146 results.
147*/
148QPlaceContentRequest QPlaceContentReply::previousPageRequest() const
149{
150 Q_D(const QPlaceContentReply);
151 return d->previousPageRequest;
152}
153
154/*!
155 Returns a place content request that can be used to request the next batch of place content
156 results.
157*/
158QPlaceContentRequest QPlaceContentReply::nextPageRequest() const
159{
160 Q_D(const QPlaceContentReply);
161 return d->nextPageRequest;
162}
163
164/*!
165 Sets the content \a request used to generate this this reply.
166*/
167void QPlaceContentReply::setRequest(const QPlaceContentRequest &request)
168{
169 Q_D(QPlaceContentReply);
170 d->contentRequest = request;
171}
172
173/*!
174 Sets the place content request that can be used to request the previous batch of place content
175 results to \a previous.
176*/
177void QPlaceContentReply::setPreviousPageRequest(const QPlaceContentRequest &previous)
178{
179 Q_D(QPlaceContentReply);
180 d->previousPageRequest = previous;
181}
182
183/*!
184 Sets the place content request that can be used to request the next batch of place content
185 results to \a next.
186*/
187void QPlaceContentReply::setNextPageRequest(const QPlaceContentRequest &next)
188{
189 Q_D(QPlaceContentReply);
190 d->nextPageRequest = next;
191}
192

source code of qtlocation/src/location/places/qplacecontentreply.cpp