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 "qplaceuser.h"
38 #include "qplaceuser_p.h"
39 
40 QT_USE_NAMESPACE
41 
QPlaceUserPrivate()42 QPlaceUserPrivate::QPlaceUserPrivate()
43     : QSharedData()
44 {
45 }
46 
QPlaceUserPrivate(const QPlaceUserPrivate & other)47 QPlaceUserPrivate::QPlaceUserPrivate(const QPlaceUserPrivate &other)
48     : QSharedData(), userId(other.userId), name(other.name)
49 {
50 }
51 
~QPlaceUserPrivate()52 QPlaceUserPrivate::~QPlaceUserPrivate()
53 {
54 }
55 
operator ==(const QPlaceUserPrivate & other) const56 bool QPlaceUserPrivate::operator==(const QPlaceUserPrivate &other) const
57 {
58     return userId == other.userId && name == other.name;
59 }
60 
61 /*!
62     \class QPlaceUser
63     \inmodule QtLocation
64     \ingroup QtLocation-places
65     \ingroup QtLocation-places-data
66     \since 5.6
67 
68     \brief The QPlaceUser class represents an individual user.
69 */
70 
71 /*!
72     Constructs a new user object.
73 */
QPlaceUser()74 QPlaceUser::QPlaceUser()
75     : d(new QPlaceUserPrivate)
76 {
77 }
78 
79 /*!
80     Constructs a copy of \a other.
81 */
QPlaceUser(const QPlaceUser & other)82 QPlaceUser::QPlaceUser(const QPlaceUser &other)
83     :d(other.d)
84 {
85 }
86 
87 /*!
88     Destroys the user object.
89 */
~QPlaceUser()90 QPlaceUser::~QPlaceUser()
91 {
92 }
93 
94 /*!
95     Assigns \a other to this user and returns a reference to this user.
96 */
operator =(const QPlaceUser & other)97 QPlaceUser &QPlaceUser::operator=(const QPlaceUser &other)
98 {
99     if (this == &other)
100         return *this;
101 
102     d = other.d;
103     return *this;
104 }
105 
106 /*!
107     \fn bool QPlaceUser::operator!=(const QPlaceUser &other) const
108 
109     Returns true if \a other is not equal to this user,
110     otherwise returns false.
111 */
112 
113 /*!
114     Returns true if this user is equal to \a other.
115     Otherwise returns false.
116 */
operator ==(const QPlaceUser & other) const117 bool QPlaceUser::operator==(const QPlaceUser &other) const
118 {
119     return (*d) == *(other.d);
120 }
121 
122 /*!
123     Returns the identifier of the user.
124 */
userId() const125 QString QPlaceUser::userId() const
126 {
127     return d->userId;
128 }
129 
130 /*!
131     Sets the \a identifier of the user.
132 */
setUserId(const QString & identifier)133 void QPlaceUser::setUserId(const QString &identifier)
134 {
135     d->userId = identifier;
136 }
137 
138 /*!
139     Returns the name of the user.
140 */
name() const141 QString QPlaceUser::name() const
142 {
143     return d->name;
144 }
145 
146 /*!
147     Sets the \a name of the user.
148 */
149 
setName(const QString & name)150 void QPlaceUser::setName(const QString &name)
151 {
152     d->name = name;
153 }
154