source: trunk/tools/assistant/lib/qhelpdatainterface.cpp@ 109

Last change on this file since 109 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 6.7 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the Qt Assistant of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "qhelpdatainterface_p.h"
43
44QT_BEGIN_NAMESPACE
45
46/*!
47 \internal
48 \class QHelpDataContentItem
49 \since 4.4
50 \brief The QHelpDataContentItem class provides an item which represents
51 a topic or section of the contents.
52
53 Every item holds several pieces of information, most notably the title
54 which can later be displayed in a contents overview. The reference is used
55 to store a relative file link to the corresponding section in the
56 documentation.
57*/
58
59/*!
60 Constructs a new content item with \a parent as parent item.
61 The constucted item has the title \a title and links to the
62 location specified by \a reference.
63*/
64QHelpDataContentItem::QHelpDataContentItem(QHelpDataContentItem *parent,
65 const QString &title, const QString &reference)
66 : m_title(title), m_reference(reference)
67{
68 if (parent)
69 parent->m_children.append(this);
70}
71
72/*!
73 Destructs the item and its children.
74*/
75QHelpDataContentItem::~QHelpDataContentItem()
76{
77 qDeleteAll(m_children);
78}
79
80/*!
81 Returns the title of the item.
82*/
83QString QHelpDataContentItem::title() const
84{
85 return m_title;
86}
87
88/*!
89 Returns the file reference of the item.
90*/
91QString QHelpDataContentItem::reference() const
92{
93 return m_reference;
94}
95
96/*!
97 Returns a list of all its child items.
98*/
99QList<QHelpDataContentItem*> QHelpDataContentItem::children() const
100{
101 return m_children;
102}
103
104bool QHelpDataIndexItem::operator==(const QHelpDataIndexItem & other) const
105{
106 return (other.name == name)
107 && (other.reference == reference);
108}
109
110
111
112/*!
113 \internal
114 \class QHelpDataFilterSection
115 \since 4.4
116*/
117
118/*!
119 Constructs a help data filter section.
120*/
121QHelpDataFilterSection::QHelpDataFilterSection()
122{
123 d = new QHelpDataFilterSectionData();
124}
125
126/*!
127 Adds the filter attribute \a filter to the filter attributes of
128 this section.
129*/
130void QHelpDataFilterSection::addFilterAttribute(const QString &filter)
131{
132 d->filterAttributes.append(filter);
133}
134
135/*!
136 Returns a list of all filter attributes defined for this section.
137*/
138QStringList QHelpDataFilterSection::filterAttributes() const
139{
140 return d->filterAttributes;
141}
142
143/*!
144 Adds the index item \a index to the list of indices.
145*/
146void QHelpDataFilterSection::addIndex(const QHelpDataIndexItem &index)
147{
148 d->indices.append(index);
149}
150
151/*!