1/****************************************************************************
2**
3** Copyright (C) 2018 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Assistant of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qhelpfilterdata.h"
41#include <QtCore/QVersionNumber>
42
43QT_BEGIN_NAMESPACE
44
45class QHelpFilterDataPrivate : public QSharedData
46{
47public:
48 QHelpFilterDataPrivate() = default;
49 QHelpFilterDataPrivate(const QHelpFilterDataPrivate &other)
50 : QSharedData(other)
51 , m_components(other.m_components)
52 , m_versions(other.m_versions)
53 { }
54 ~QHelpFilterDataPrivate() = default;
55
56 QStringList m_components;
57 QList<QVersionNumber> m_versions;
58};
59
60/*!
61 \class QHelpFilterData
62 \since 5.13
63 \inmodule QtHelp
64 \brief The QHelpFilterData class provides details for the filters
65 used by QHelpFilterEngine.
66
67 By using setComponents() you may constrain the search results to
68 documents that belong only to components specified on the given list.
69 By using setVersions() you may constrain the search results to
70 documents that belong only to versions specified on the given list.
71
72 \sa QHelpFilterEngine
73*/
74
75/*!
76 Constructs the empty filter.
77*/
78QHelpFilterData::QHelpFilterData()
79 : d(new QHelpFilterDataPrivate)
80{
81}
82
83/*!
84 Constructs a copy of \a other.
85*/
86QHelpFilterData::QHelpFilterData(const QHelpFilterData &) = default;
87
88/*!
89 Move-constructs a QHelpFilterData instance, making it point at the same object that \a other was pointing to.
90*/
91QHelpFilterData::QHelpFilterData(QHelpFilterData &&) = default;
92
93/*!
94 Destroys the filter.
95*/
96QHelpFilterData::~QHelpFilterData() = default;
97
98/*!
99 Assigns \a other to this filter and returns a reference to this filter.
100*/
101QHelpFilterData &QHelpFilterData::operator=(const QHelpFilterData &) = default;
102
103
104/*!
105 Move-assigns \a other to this QHelpFilterData instance.
106*/
107QHelpFilterData &QHelpFilterData::operator=(QHelpFilterData &&) = default;
108
109/*!
110 \fn void QHelpFilterData::swap(QHelpFilterData &other)
111
112 Swaps the filter \a other with this filter. This
113 operation is very fast and never fails.
114*/
115
116bool QHelpFilterData::operator==(const QHelpFilterData &other) const
117{
118 return (d->m_components == other.d->m_components &&
119 d->m_versions == other.d->m_versions);
120}
121
122/*!
123 Specifies the component list that is used for filtering
124 the search results. Only results from components in the list
125 \a components shall be returned.
126*/
127void QHelpFilterData::setComponents(const QStringList &components)
128{
129 d->m_components = components;
130}
131
132/*!
133 Specifies the version list that is used for filtering
134 the search results. Only results from versions in the list
135 \a versions shall be returned.
136*/
137void QHelpFilterData::setVersions(const QList<QVersionNumber> &versions)
138{
139 d->m_versions = versions;
140}
141
142/*!
143 Returns the component list that is used for filtering
144 the search results.
145*/
146QStringList QHelpFilterData::components() const
147{
148 return d->m_components;
149}
150
151/*!
152 Returns the version list that is used for filtering
153 the search results.
154*/
155QList<QVersionNumber> QHelpFilterData::versions() const
156{
157 return d->m_versions;
158}
159
160QT_END_NAMESPACE
161

source code of qttools/src/assistant/help/qhelpfilterdata.cpp