Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeoareamonitorinfo.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QGeoAreaMonitorInfo>
5#include <QDateTime>
6#include <QSharedData>
7#include <QUuid>
8#include <QDataStream>
9
10#ifndef QT_NO_DEBUG_STREAM
11#include <QDebug>
12#endif
13
15
17
18
54{
55public:
59 {
60 uid = other.uid;
61 name = other.name;
62 shape = other.shape;
63 persistent = other.persistent;
64 notificationParameters = other.notificationParameters;
65 expiry = other.expiry;
66 }
68
75};
76
83{
85 d->name = name;
87}
88
96
114
116
117
122{
123 d = other.d;
124 return *this;
125}
126
158{
159 return d->name;
160}
161
166{
167 if (d->name != name) {
168 d.detach();
169 d->name = name;
170 }
171}
172
180{
181 return d->uid.toString();
182}
183
190{
191 return (!d->name.isEmpty() && !d->shape.isEmpty());
192}
193
200{
201 return d->shape;
202}
203
210{
211 d.detach();
212 d->shape = newShape;
213}
214
229{
230 return d->expiry;
231}
232
237{
238 d.detach();
239 d->expiry = expiry;
240}
241
256{
257 return d->persistent;
258}
259
271{
272 d.detach();
274}
275
276
287
294{
295 d.detach();
296 d->notificationParameters = parameters;
297}
298
303{
304 if (d)
305 d.detach();
306 else
308}
309
310bool QGeoAreaMonitorInfo::equals(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs)
311{
312 return (lhs.d->name == rhs.d->name &&
313 lhs.d->uid == rhs.d->uid &&
314 lhs.d->shape == rhs.d->shape &&
315 lhs.d->persistent == rhs.d->persistent &&
316 lhs.d->expiry == rhs.d->expiry &&
318}
319
320#ifndef QT_NO_DATASTREAM
321
329QDataStream &QGeoAreaMonitorInfo::dataStreamOut(QDataStream &ds, const QGeoAreaMonitorInfo &monitor)
330{
331 ds << monitor.name() << monitor.d->uid << monitor.area()
332 << monitor.isPersistent() << monitor.notificationParameters() << monitor.expiration();
333 return ds;
334}
335
344QDataStream &QGeoAreaMonitorInfo::dataStreamIn(QDataStream &ds, QGeoAreaMonitorInfo &monitor)
345{
346 QString s;
347 ds >> s;
348 monitor = QGeoAreaMonitorInfo(s);
349
350 QUuid id;
351 ds >> id;
352 monitor.d->uid = id;
353
354 QGeoShape shape;
355 ds >> shape;
356 monitor.setArea(shape);
357
358 bool persistent;
359 ds >> persistent;
360 monitor.setPersistent(persistent);
361
363 ds >> map;
365
366 QDateTime dt;
367 ds >> dt;
368 monitor.setExpiration(dt);
369
370 return ds;
371}
372
373#endif
374
375#ifndef QT_NO_DEBUG_STREAM
376QDebug QGeoAreaMonitorInfo::debugStreaming(QDebug dbg, const QGeoAreaMonitorInfo &monitor)
377{
378 QDebugStateSaver saver(dbg);
379 dbg.nospace() << "QGeoAreaMonitorInfo(\"" << qPrintable(monitor.name())
380 << "\", " << monitor.area()
381 << ", persistent: " << monitor.isPersistent()
382 << ", expiry: " << monitor.expiration() << ")";
383 return dbg;
384}
385
386#endif
387
388size_t qHash(const QGeoAreaMonitorInfo &key, size_t seed) noexcept
389{
390 return qHashMulti(seed, key.d->uid);
391}
392
393namespace QTest
394{
395
397{
399 QDebug dbg(&result);
400 dbg << info;
401 return qstrdup(qPrintable(result));
402}
403
404} // namespace QTest
405
\inmodule QtCore\reentrant
Definition qdatastream.h:46
\inmodule QtCore\reentrant
Definition qdatetime.h:283
\inmodule QtCore
\inmodule QtCore
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
QGeoAreaMonitorInfoPrivate(const QGeoAreaMonitorInfoPrivate &other)
\inmodule QtPositioning
void setArea(const QGeoShape &newShape)
Sets the to-be-monitored area to newShape.
void setName(const QString &name)
Sets the user visibile name.
QGeoAreaMonitorInfo(const QString &name=QString())
Constructs a QGeoAreaMonitorInfo object with the specified name.
void setExpiration(const QDateTime &expiry)
Sets the expiry date and time to expiry.
friend class QGeoAreaMonitorInfoPrivate
QGeoShape area() const
Returns the boundaries of the to-be-monitored area.
void setNotificationParameters(const QVariantMap &parameters)
Sets the set of platform specific parameters used by QGeoAreaMonitorInfo.
bool isValid() const
Returns true, if the monitor is valid.
void setPersistent(bool isPersistent)
Sets the QGeoAreaMonitorInfo object's persistence to isPersistent.
QString identifier() const
Returns the identifier of the QGeoAreaMonitorInfo object.
QVariantMap notificationParameters() const
Returns the set of platform specific parameters used by this QGeoAreaMonitorInfo.
QDateTime expiration() const
Returns the expiry date.
QString name() const
Returns the name of the QGeoAreaMonitorInfo object.
bool isPersistent() const
Returns true if the QGeoAreaMonitorInfo is persistent.
\inmodule QtPositioning
Definition qgeoshape.h:17
bool isEmpty
This property defines whether this geo shape is empty.
Definition qgeoshape.h:21
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
\inmodule QtCore
Definition quuid.h:31
static QUuid createUuid()
On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and vers...
Definition quuid.cpp:997
QString toString(StringFormat mode=WithBraces) const
Definition quuid.cpp:650
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
char * toString(const MyPoint &point)
Q_CORE_EXPORT char * qstrdup(const char *)
size_t qHash(const QGeoAreaMonitorInfo &key, size_t seed) noexcept
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
#define QT_IMPL_METATYPE_EXTERN(TYPE)
Definition qmetatype.h:1390
GLuint64 key
GLenum GLuint id
[7]
GLuint name
GLdouble s
[6]
Definition qopenglext.h:235
GLuint64EXT * result
[6]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)
#define qPrintable(string)
Definition qstring.h:1531
QSharedPointer< T > other(t)
[5]
QHostInfo info
[0]