1// Copyright (C) 2016 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 "qhelpdatainterface_p.h"
5
6QT_BEGIN_NAMESPACE
7
8/*!
9 \internal
10 \class QHelpDataContentItem
11 \since 4.4
12 \brief The QHelpDataContentItem class provides an item which represents
13 a topic or section of the contents.
14
15 Every item holds several pieces of information, most notably the title
16 which can later be displayed in a contents overview. The reference is used
17 to store a relative file link to the corresponding section in the
18 documentation.
19*/
20
21/*!
22 Constructs a new content item with \a parent as parent item.
23 The constucted item has the title \a title and links to the
24 location specified by \a reference.
25*/
26QHelpDataContentItem::QHelpDataContentItem(QHelpDataContentItem *parent,
27 const QString &title, const QString &reference)
28 : m_title(title), m_reference(reference)
29{
30 if (parent)
31 parent->m_children.append(t: this);
32}
33
34/*!
35 Destructs the item and its children.
36*/
37QHelpDataContentItem::~QHelpDataContentItem()
38{
39 qDeleteAll(c: m_children);
40}
41
42/*!
43 Returns the title of the item.
44*/
45QString QHelpDataContentItem::title() const
46{
47 return m_title;
48}
49
50/*!
51 Returns the file reference of the item.
52*/
53QString QHelpDataContentItem::reference() const
54{
55 return m_reference;
56}
57
58/*!
59 Returns a list of all its child items.
60*/
61QList<QHelpDataContentItem*> QHelpDataContentItem::children() const
62{
63 return m_children;
64}
65
66bool QHelpDataIndexItem::operator==(const QHelpDataIndexItem &other) const
67{
68 return (other.name == name) && (other.reference == reference);
69}
70
71/*!
72 \internal
73 \class QHelpDataFilterSection
74 \since 4.4
75*/
76
77/*!
78 Constructs a help data filter section.
79*/
80QHelpDataFilterSection::QHelpDataFilterSection()
81{
82 d = new QHelpDataFilterSectionData();
83}
84
85/*!
86 Adds the filter attribute \a filter to the filter attributes of
87 this section.
88*/
89void QHelpDataFilterSection::addFilterAttribute(const QString &filter)
90{
91 d->filterAttributes.append(t: filter);
92}
93
94/*!
95 Returns a list of all filter attributes defined for this section.
96*/
97QStringList QHelpDataFilterSection::filterAttributes() const
98{
99 return d->filterAttributes;
100}
101
102/*!
103 Adds the index item \a index to the list of indices.
104*/
105void QHelpDataFilterSection::addIndex(const QHelpDataIndexItem &index)
106{
107 d->indices.append(t: index);
108}
109
110/*!
111 Sets the filter sections list of indices to \a indices.
112*/
113void QHelpDataFilterSection::setIndices(const QList<QHelpDataIndexItem> &indices)
114{
115 d->indices = indices;
116}
117
118/*!
119 Returns the list of indices.
120*/
121QList<QHelpDataIndexItem> QHelpDataFilterSection::indices() const
122{
123 return d->indices;
124}
125
126/*!
127 Adds the top level content item \a content to the filter section.
128*/
129void QHelpDataFilterSection::addContent(QHelpDataContentItem *content)
130{
131 d->contents.append(t: content);
132}
133
134/*!
135 Sets the list of top level content items of the filter section to
136 \a contents.
137*/
138void QHelpDataFilterSection::setContents(const QList<QHelpDataContentItem*> &contents)
139{
140 qDeleteAll(c: d->contents);
141 d->contents = contents;
142}
143
144/*!
145 Returns a list of top level content items.
146*/
147QList<QHelpDataContentItem*> QHelpDataFilterSection::contents() const
148{
149 return d->contents;
150}
151
152/*!
153 Adds the file \a file to the filter section.
154*/
155void QHelpDataFilterSection::addFile(const QString &file)
156{
157 d->files.append(t: file);
158}
159
160/*!
161 Set the list of files to \a files.
162*/
163void QHelpDataFilterSection::setFiles(const QStringList &files)
164{
165 d->files = files;
166}
167
168/*!
169 Returns the list of files.
170*/
171QStringList QHelpDataFilterSection::files() const
172{
173 return d->files;
174}
175
176/*!
177 \internal
178 \class QHelpDataInterface
179 \since 4.4
180*/
181
182/*!
183 \fn QHelpDataInterface::QHelpDataInterface()
184
185 Constructs a new help data interface.
186*/
187
188/*!
189 \fn QHelpDataInterface::~QHelpDataInterface()
190
191 Destroys the help data interface.
192*/
193
194/*!
195 \fn QString QHelpDataInterface::namespaceName() const = 0
196
197 Returns the namespace name of the help data set.
198*/
199
200/*!
201 \fn QString QHelpDataInterface::virtualFolder() const = 0
202
203 Returns the virtual folder of the help data set.
204*/
205
206/*!
207 \fn QList<QHelpDataCustomFilter> QHelpDataInterface::customFilters () const = 0
208
209 Returns a list of custom filters. Defining custom filters is optional.
210*/
211
212/*!
213 \fn QList<QHelpDataFilterSection> QHelpDataInterface::filterSections() const = 0
214
215 Returns a list of filter sections.
216*/
217
218/*!
219 \fn QMap<QString, QVariant> QHelpDataInterface::metaData() const = 0
220
221 Returns a map of meta data. A meta data item can hold almost any data
222 and is identified by its name.
223*/
224
225/*!
226 \fn QString QHelpDataInterface::rootPath() const = 0
227
228 Returns the root file path of the documentation data. All referenced file
229 path or links of content items are relative to this path.
230*/
231
232QT_END_NAMESPACE
233

source code of qttools/src/assistant/qhelpgenerator/qhelpdatainterface.cpp