Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
20
21#include <QSharedData>
22#include <QtLocation/QPlaceIcon>
23
24QT_BEGIN_NAMESPACE
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
45class QPlaceSearchResultPrivate : public QSharedData
46{
47public:
48 QPlaceSearchResultPrivate() {}
49 virtual ~QPlaceSearchResultPrivate() {}
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); }
57 virtual QPlaceSearchResult::SearchResultType type() const { return QPlaceSearchResult::UnknownSearchResult; }
58 static void copyIfPossible(QSharedDataPointer<QPlaceSearchResultPrivate> &d_ptr, const QPlaceSearchResult &other)
59 {
60 if (other.type() == QPlaceSearchResult::UnknownSearchResult)
61 d_ptr = extract_d(other);
62 else
63 d_ptr = new QPlaceSearchResultPrivate;
64 }
65
66 QString title;
67 QPlaceIcon icon;
68};
69
70template<> QPlaceSearchResultPrivate *QSharedDataPointer<QPlaceSearchResultPrivate>::clone();
71
73
74#endif // QPLACESEARCHRESULT_P_H
bool compare(const QPlaceSearchResultPrivate *other) const override
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
#define Q_IMPLEMENT_SEARCHRESULT_D_FUNC(Class)
#define Q_IMPLEMENT_SEARCHRESULT_COPY_CTOR(Class)
#define Q_DEFINE_SEARCHRESULT_PRIVATE_HELPER(Class, ResultType)