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
qplacesearchresult_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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#ifndef QPLACESEARCHRESULT_P_H
5#define QPLACESEARCHRESULT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qplacesearchresult.h"
19#include "qplacesearchrequest.h"
20
21#include <QSharedData>
22#include <QtLocation/QPlaceIcon>
23
25
26// defines must be in sync with class below
27#define Q_IMPLEMENT_SEARCHRESULT_D_FUNC(Class) \
28 Class##Private *Class::d_func() { return reinterpret_cast<Class##Private *>(d_ptr.data()); } \
29 const Class##Private *Class::d_func() const { return reinterpret_cast<const Class##Private *>(d_ptr.constData()); } \
30
31#define Q_IMPLEMENT_SEARCHRESULT_COPY_CTOR(Class) \
32 Class::Class(const QPlaceSearchResult &other) : QPlaceSearchResult() { Class##Private::copyIfPossible(d_ptr, other); }
33
34#define Q_DEFINE_SEARCHRESULT_PRIVATE_HELPER(Class, ResultType) \
35 QPlaceSearchResultPrivate *clone() const override { return new Class##Private(*this); } \
36 QPlaceSearchResult::SearchResultType type() const override {return ResultType;} \
37 static void copyIfPossible(QSharedDataPointer<QPlaceSearchResultPrivate> &d_ptr, const QPlaceSearchResult &other) \
38 { \
39 if (other.type() == ResultType) \
40 d_ptr = extract_d(other); \
41 else \
42 d_ptr = new Class##Private; \
43 }
44
46{
47public:
50
51 virtual bool compare(const QPlaceSearchResultPrivate *other) const;
52
53 static const QSharedDataPointer<QPlaceSearchResultPrivate>
54 &extract_d(const QPlaceSearchResult &other) { return other.d_ptr; }
55
56 virtual QPlaceSearchResultPrivate *clone() const { return new QPlaceSearchResultPrivate(*this); }
58 static void copyIfPossible(QSharedDataPointer<QPlaceSearchResultPrivate> &d_ptr, const QPlaceSearchResult &other)
59 {
61 d_ptr = extract_d(other);
62 else
63 d_ptr = new QPlaceSearchResultPrivate;
64 }
65
68};
69
71
73
74#endif // QPLACESEARCHRESULT_P_H
\inmodule QtLocation
Definition qplaceicon.h:23
virtual QPlaceSearchResultPrivate * clone() const
static void copyIfPossible(QSharedDataPointer< QPlaceSearchResultPrivate > &d_ptr, const QPlaceSearchResult &other)
virtual bool compare(const QPlaceSearchResultPrivate *other) const
static const QSharedDataPointer< QPlaceSearchResultPrivate > & extract_d(const QPlaceSearchResult &other)
virtual QPlaceSearchResult::SearchResultType type() const
\inmodule QtLocation
SearchResultType
Defines the type of search result.
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
QSharedPointer< T > other(t)
[5]