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 "qgeomaptype_p.h"
38 #include "qgeomaptype_p_p.h"
39 
40 QT_BEGIN_NAMESPACE
41 
QGeoMapType()42 QGeoMapType::QGeoMapType()
43     : d_ptr(new QGeoMapTypePrivate()) {}
44 
QGeoMapType(const QGeoMapType & other)45 QGeoMapType::QGeoMapType(const QGeoMapType &other)
46     : d_ptr(other.d_ptr) {}
47 
QGeoMapType(QGeoMapType::MapStyle style,const QString & name,const QString & description,bool mobile,bool night,int mapId,const QByteArray & pluginName,const QGeoCameraCapabilities & cameraCapabilities,const QVariantMap & metadata)48 QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name,
49                          const QString &description, bool mobile, bool night, int mapId,
50                          const QByteArray &pluginName,
51                          const QGeoCameraCapabilities &cameraCapabilities,
52                          const QVariantMap &metadata)
53 :   d_ptr(new QGeoMapTypePrivate(style, name, description, mobile, night, mapId, pluginName, cameraCapabilities, metadata))
54 {
55 }
56 
~QGeoMapType()57 QGeoMapType::~QGeoMapType() {}
58 
operator =(const QGeoMapType & other)59 QGeoMapType &QGeoMapType::operator = (const QGeoMapType &other)
60 {
61     if (this == &other)
62         return *this;
63 
64     d_ptr = other.d_ptr;
65     return *this;
66 }
67 
operator ==(const QGeoMapType & other) const68 bool QGeoMapType::operator == (const QGeoMapType &other) const
69 {
70     return (*d_ptr.constData() == *other.d_ptr.constData());
71 }
72 
operator !=(const QGeoMapType & other) const73 bool QGeoMapType::operator != (const QGeoMapType &other) const
74 {
75     return !(operator ==(other));
76 }
77 
style() const78 QGeoMapType::MapStyle QGeoMapType::style() const
79 {
80     return d_ptr->style_;
81 }
82 
name() const83 QString QGeoMapType::name() const
84 {
85     return d_ptr->name_;
86 }
87 
description() const88 QString QGeoMapType::description() const
89 {
90     return d_ptr->description_;
91 }
92 
mobile() const93 bool QGeoMapType::mobile() const
94 {
95     return d_ptr->mobile_;
96 }
97 
night() const98 bool QGeoMapType::night() const
99 {
100     return d_ptr->night_;
101 }
102 
mapId() const103 int QGeoMapType::mapId() const
104 {
105     return d_ptr->mapId_;
106 }
107 
pluginName() const108 QByteArray QGeoMapType::pluginName() const
109 {
110     return d_ptr->pluginName_;
111 }
112 
cameraCapabilities() const113 QGeoCameraCapabilities QGeoMapType::cameraCapabilities() const
114 {
115     return d_ptr->cameraCapabilities_;
116 }
117 
metadata() const118 QVariantMap QGeoMapType::metadata() const
119 {
120     return d_ptr->metadata_;
121 }
122 
QGeoMapTypePrivate()123 QGeoMapTypePrivate::QGeoMapTypePrivate()
124 :   style_(QGeoMapType::NoMap), mobile_(false), night_(false), mapId_(0)
125 {
126 }
127 
QGeoMapTypePrivate(const QGeoMapTypePrivate & other)128 QGeoMapTypePrivate::QGeoMapTypePrivate(const QGeoMapTypePrivate &other)
129 :   QSharedData(other), style_(other.style_), name_(other.name_), description_(other.description_),
130     mobile_(other.mobile_), night_(other.night_), mapId_(other.mapId_), pluginName_(other.pluginName_),
131     cameraCapabilities_(other.cameraCapabilities_), metadata_(other.metadata_)
132 {
133 }
134 
QGeoMapTypePrivate(QGeoMapType::MapStyle style,const QString & name,const QString & description,bool mobile,bool night,int mapId,const QByteArray & pluginName,const QGeoCameraCapabilities & cameraCapabilities,const QVariantMap & metadata)135 QGeoMapTypePrivate::QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name,
136                                        const QString &description, bool mobile, bool night,
137                                        int mapId, const QByteArray &pluginName,
138                                        const QGeoCameraCapabilities &cameraCapabilities,
139                                        const QVariantMap &metadata)
140 :   style_(style), name_(name), description_(description), mobile_(mobile), night_(night),
141     mapId_(mapId), pluginName_(pluginName), cameraCapabilities_(cameraCapabilities), metadata_(metadata)
142 {
143 }
144 
~QGeoMapTypePrivate()145 QGeoMapTypePrivate::~QGeoMapTypePrivate()
146 {
147 }
148 
operator ==(const QGeoMapTypePrivate & other) const149 bool QGeoMapTypePrivate::operator==(const QGeoMapTypePrivate &other) const
150 {
151     return pluginName_ == other.pluginName_ && style_ == other.style_ && name_ == other.name_ &&
152            description_ == other.description_ && mobile_ == other.mobile_ && night_ == other.night_ &&
153            mapId_ == other.mapId_ && cameraCapabilities_ == other.cameraCapabilities_ &&
154            metadata_ == other.metadata_;
155 }
156 
157 QT_END_NAMESPACE
158