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// Qt-Security score:significant reason:default
4
5#ifndef QPLACESEARCHRESULT_P_H
6#define QPLACESEARCHRESULT_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
21
22#include <QSharedData>
23#include <QtLocation/QPlaceIcon>
24
25QT_BEGIN_NAMESPACE
26
27// defines must be in sync with class below
28#define Q_IMPLEMENT_SEARCHRESULT_D_FUNC(Class)
29 Class##Private *Class::d_func() { return reinterpret_cast<Class##Private *>(d_ptr.data()); }
30 const Class##Private *Class::d_func() const { return reinterpret_cast<const Class##Private *>(d_ptr.constData()); }
31
32#define Q_IMPLEMENT_SEARCHRESULT_COPY_CTOR(Class)
33 Class::Class(const QPlaceSearchResult &other) : QPlaceSearchResult() { Class##Private::copyIfPossible(d_ptr, other); }
34
35#define Q_DEFINE_SEARCHRESULT_PRIVATE_HELPER(Class, ResultType)
36 QPlaceSearchResultPrivate *clone() const override { return new Class##Private(*this); }
37 QPlaceSearchResult::SearchResultType type() const override {return ResultType;}
38 static void copyIfPossible(QSharedDataPointer<QPlaceSearchResultPrivate> &d_ptr, const QPlaceSearchResult &other)
39 {
40 if (other.type() == ResultType)
41 d_ptr = extract_d(other);
42 else
43 d_ptr = new Class##Private;
44 }
45
46class QPlaceSearchResultPrivate : public QSharedData
47{
48public:
49 QPlaceSearchResultPrivate() {}
50 virtual ~QPlaceSearchResultPrivate() {}
51
52 virtual bool compare(const QPlaceSearchResultPrivate *other) const;
53
54 static const QSharedDataPointer<QPlaceSearchResultPrivate>
55 &extract_d(const QPlaceSearchResult &other) { return other.d_ptr; }
56
57 virtual QPlaceSearchResultPrivate *clone() const { return new QPlaceSearchResultPrivate(*this); }
58 virtual QPlaceSearchResult::SearchResultType type() const { return QPlaceSearchResult::UnknownSearchResult; }
59 static void copyIfPossible(QSharedDataPointer<QPlaceSearchResultPrivate> &d_ptr, const QPlaceSearchResult &other)
60 {
61 if (other.type() == QPlaceSearchResult::UnknownSearchResult)
62 d_ptr = extract_d(other);
63 else
64 d_ptr = new QPlaceSearchResultPrivate;
65 }
66
67 QString title;
68 QPlaceIcon icon;
69};
70
71template<> QPlaceSearchResultPrivate *QSharedDataPointer<QPlaceSearchResultPrivate>::clone();
72
74
75#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)