| 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 "qplaceidreply.h" | 
| 38 | #include "qplacereply_p.h" | 
| 39 |  | 
| 40 | QT_BEGIN_NAMESPACE | 
| 41 | class QPlaceIdReplyPrivate : public QPlaceReplyPrivate | 
| 42 | { | 
| 43 | public: | 
| 44 |     QPlaceIdReplyPrivate(QPlaceIdReply::OperationType operationType) | 
| 45 |         : operationType(operationType) {} | 
| 46 |     ~QPlaceIdReplyPrivate() {} | 
| 47 |     QString id; | 
| 48 |     QPlaceIdReply::OperationType operationType; | 
| 49 | }; | 
| 50 |  | 
| 51 | QT_END_NAMESPACE | 
| 52 |  | 
| 53 | QT_USE_NAMESPACE | 
| 54 |  | 
| 55 | /*! | 
| 56 |     \class QPlaceIdReply | 
| 57 |     \inmodule QtLocation | 
| 58 |     \ingroup QtLocation-places | 
| 59 |     \ingroup QtLocation-places-replies | 
| 60 |     \since 5.6 | 
| 61 |  | 
| 62 |     \brief The QPlaceIdReply class manages operations which return an identifier such as | 
| 63 |            saving and removal operations of places and categories. | 
| 64 |  | 
| 65 |     The QPlaceIdReply can be considered a multipurpose reply in that it can | 
| 66 |     be used to save places, save categories, remove places and remove categories. | 
| 67 |     In each case it returns an identifier of the place or category that was added, modified or removed. | 
| 68 |  | 
| 69 |     See \l {Saving a place cpp}{Saving a place} for an example of how to use an identifier reply. | 
| 70 |     \sa QPlaceManager | 
| 71 | */ | 
| 72 |  | 
| 73 | /*! | 
| 74 |     \enum QPlaceIdReply::OperationType | 
| 75 |     Defines the type of operation that was used to generate this reply. | 
| 76 |     \value SavePlace The reply was created for a save place operation | 
| 77 |     \value RemovePlace The reply was created for a remove place operation. | 
| 78 |     \value SaveCategory The reply was created for a save category operation | 
| 79 |     \value RemoveCategory The reply was created for a remove category operation. | 
| 80 | */ | 
| 81 |  | 
| 82 | /*! | 
| 83 |     Constructs a reply which contains the identifier of the object operated upon. The reply is for the given \a operationType and with \a parent. | 
| 84 | */ | 
| 85 | QPlaceIdReply::QPlaceIdReply(QPlaceIdReply::OperationType operationType, QObject *parent) | 
| 86 |     : QPlaceReply(new QPlaceIdReplyPrivate(operationType), parent) {} | 
| 87 |  | 
| 88 | /*! | 
| 89 |     Destroys the reply. | 
| 90 | */ | 
| 91 | QPlaceIdReply::~QPlaceIdReply() | 
| 92 | { | 
| 93 | } | 
| 94 |  | 
| 95 | /*! | 
| 96 |     Returns the type of reply. | 
| 97 | */ | 
| 98 | QPlaceReply::Type QPlaceIdReply::type() const | 
| 99 | { | 
| 100 |     return QPlaceReply::IdReply; | 
| 101 | } | 
| 102 |  | 
| 103 | /*! | 
| 104 |     Returns the operation type of the reply. This means whether this | 
| 105 |     identifier reply was for a save place operation, | 
| 106 |     remove category operation and so on. | 
| 107 | */ | 
| 108 | QPlaceIdReply::OperationType QPlaceIdReply::operationType() const | 
| 109 | { | 
| 110 |     Q_D(const QPlaceIdReply); | 
| 111 |     return d->operationType; | 
| 112 | } | 
| 113 |  | 
| 114 | /*! | 
| 115 |     Returns the relevant identifier for the operation. For example for a save place operation, | 
| 116 |     the identifier is that of the saved place.  For a category removal operation, | 
| 117 |     it is the identifier of the category that was removed. | 
| 118 | */ | 
| 119 | QString QPlaceIdReply::id() const | 
| 120 | { | 
| 121 |     Q_D(const QPlaceIdReply); | 
| 122 |     return d->id; | 
| 123 | } | 
| 124 |  | 
| 125 | /*! | 
| 126 |     Sets the \a identifier of the reply. | 
| 127 | */ | 
| 128 | void QPlaceIdReply::setId(const QString &identifier) | 
| 129 | { | 
| 130 |     Q_D(QPlaceIdReply); | 
| 131 |     d->id = identifier; | 
| 132 | } | 
| 133 |  |