1 | // Copyright (C) 2018 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 "qhelpfilterdata.h" |
5 | #include <QtCore/QVersionNumber> |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | class QHelpFilterDataPrivate : public QSharedData |
10 | { |
11 | public: |
12 | QHelpFilterDataPrivate() = default; |
13 | QHelpFilterDataPrivate(const QHelpFilterDataPrivate &other) |
14 | : QSharedData(other) |
15 | , m_components(other.m_components) |
16 | , m_versions(other.m_versions) |
17 | { } |
18 | ~QHelpFilterDataPrivate() = default; |
19 | |
20 | QStringList m_components; |
21 | QList<QVersionNumber> m_versions; |
22 | }; |
23 | |
24 | /*! |
25 | \class QHelpFilterData |
26 | \since 5.13 |
27 | \inmodule QtHelp |
28 | \brief The QHelpFilterData class provides details for the filters |
29 | used by QHelpFilterEngine. |
30 | |
31 | By using setComponents() you may constrain the search results to |
32 | documents that belong only to components specified on the given list. |
33 | By using setVersions() you may constrain the search results to |
34 | documents that belong only to versions specified on the given list. |
35 | |
36 | \sa QHelpFilterEngine |
37 | */ |
38 | |
39 | /*! |
40 | Constructs the empty filter. |
41 | */ |
42 | QHelpFilterData::QHelpFilterData() |
43 | : d(new QHelpFilterDataPrivate) |
44 | { |
45 | } |
46 | |
47 | /*! |
48 | Constructs a copy of \a other. |
49 | */ |
50 | QHelpFilterData::QHelpFilterData(const QHelpFilterData &) = default; |
51 | |
52 | /*! |
53 | Move-constructs a QHelpFilterData instance, making it point at the same object that \a other was pointing to. |
54 | */ |
55 | QHelpFilterData::QHelpFilterData(QHelpFilterData &&) = default; |
56 | |
57 | /*! |
58 | Destroys the filter. |
59 | */ |
60 | QHelpFilterData::~QHelpFilterData() = default; |
61 | |
62 | /*! |
63 | Assigns \a other to this filter and returns a reference to this filter. |
64 | */ |
65 | QHelpFilterData &QHelpFilterData::operator=(const QHelpFilterData &) = default; |
66 | |
67 | |
68 | /*! |
69 | Move-assigns \a other to this QHelpFilterData instance. |
70 | */ |
71 | QHelpFilterData &QHelpFilterData::operator=(QHelpFilterData &&) = default; |
72 | |
73 | /*! |
74 | \fn void QHelpFilterData::swap(QHelpFilterData &other) |
75 | |
76 | Swaps the filter \a other with this filter. This |
77 | operation is very fast and never fails. |
78 | */ |
79 | |
80 | bool QHelpFilterData::operator==(const QHelpFilterData &other) const |
81 | { |
82 | return (d->m_components == other.d->m_components && |
83 | d->m_versions == other.d->m_versions); |
84 | } |
85 | |
86 | /*! |
87 | Specifies the component list that is used for filtering |
88 | the search results. Only results from components in the list |
89 | \a components shall be returned. |
90 | */ |
91 | void QHelpFilterData::setComponents(const QStringList &components) |
92 | { |
93 | d->m_components = components; |
94 | } |
95 | |
96 | /*! |
97 | Specifies the version list that is used for filtering |
98 | the search results. Only results from versions in the list |
99 | \a versions shall be returned. |
100 | */ |
101 | void QHelpFilterData::setVersions(const QList<QVersionNumber> &versions) |
102 | { |
103 | d->m_versions = versions; |
104 | } |
105 | |
106 | /*! |
107 | Returns the component list that is used for filtering |
108 | the search results. |
109 | */ |
110 | QStringList QHelpFilterData::components() const |
111 | { |
112 | return d->m_components; |
113 | } |
114 | |
115 | /*! |
116 | Returns the version list that is used for filtering |
117 | the search results. |
118 | */ |
119 | QList<QVersionNumber> QHelpFilterData::versions() const |
120 | { |
121 | return d->m_versions; |
122 | } |
123 | |
124 | QT_END_NAMESPACE |
125 |