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
qcompressedhelpinfo.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 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
6
8
9#include <QtCore/qversionnumber.h>
10
12
13using namespace Qt::StringLiterals;
14
32
33/*!
34 \class QCompressedHelpInfo
35 \since 5.13
36 \inmodule QtHelp
37 \brief The QCompressedHelpInfo class provides access to
38 the details about a compressed help file.
39
40 The detailed information about the compressed
41 help file can be fetched by calling the fromCompressedHelpFile()
42 static method, providing the path to the compressed
43 help file.
44
45 The class provides access to various information about a compressed help file.
46 The namespace associated with the given compressed help file is
47 namespaceName(), the associated component name is component()
48 and version() provides version information.
49
50 \sa QHelpFilterEngine
51*/
52
53/*!
54 Constructs empty information about a compressed help file.
55*/
56QCompressedHelpInfo::QCompressedHelpInfo()
57 : d(new QCompressedHelpInfoPrivate)
58{}
59
60/*!
61 Constructs a copy of \a other.
62*/
63QCompressedHelpInfo::QCompressedHelpInfo(const QCompressedHelpInfo &) = default;
64
65/*!
66 Move-constructs a QCompressedHelpInfo instance,
67 making it point to the same object that \a other was pointing to,
68 so that it contains the information the \a other used to contain.
69*/
70QCompressedHelpInfo::QCompressedHelpInfo(QCompressedHelpInfo &&) = default;
71
72/*!
73 Destroys the QCompressedHelpInfo.
74*/
75QCompressedHelpInfo::~QCompressedHelpInfo() = default;
76
77/*!
78 Makes this QHelpCollectionDetails into a copy of \a other, so the two
79 are identical, and returns a reference to this QHelpCollectionDetails.
80*/
81QCompressedHelpInfo &QCompressedHelpInfo::operator=(const QCompressedHelpInfo &) = default;
82
83/*!
84 Move-assigns \a other to this QCompressedHelpInfo instance.
85*/
86QCompressedHelpInfo &QCompressedHelpInfo::operator=(QCompressedHelpInfo &&) = default;
87
88/*!
89 \fn void QCompressedHelpInfo::swap(QCompressedHelpInfo &other)
90
91 Swaps the compressed help file \a other with this compressed help file. This
92 operation is very fast and never fails.
93*/
94
95/*!
96 Returns the namespace name of the compressed help file.
97*/
98QString QCompressedHelpInfo::namespaceName() const
99{
100 return d->m_namespaceName;
101}
102
103/*!
104 Returns the component of the compressed help file.
105*/
106QString QCompressedHelpInfo::component() const
107{
108 return d->m_component;
109}
110
111/*!
112 Returns the version of the compressed help file.
113*/
114QVersionNumber QCompressedHelpInfo::version() const
115{
116 return d->m_version;
117}
118
119/*!
120 Returns \c true if the info is invalid, otherwise returns
121 \c false.
122*/
123bool QCompressedHelpInfo::isNull() const
124{
125 return d->m_isNull;
126}
127
128/*!
129 Returns the QCompressedHelpInfo instance for the
130 \a documentationFileName of the existing qch file.
131*/
132QCompressedHelpInfo QCompressedHelpInfo::fromCompressedHelpFile(const QString &documentationFileName)
133{
134 void *pointer = const_cast<QString *>(&documentationFileName);
135 QHelpDBReader reader(documentationFileName, QHelpGlobal::uniquifyConnectionName(
136 "GetCompressedHelpInfo"_L1, pointer), nullptr);
137 if (reader.init()) {
138 QCompressedHelpInfo info;
139 info.d->m_namespaceName = reader.namespaceName();
140 info.d->m_component = reader.virtualFolder();
141 info.d->m_version = QVersionNumber::fromString(reader.version());
142 info.d->m_isNull = false;
143 return info;
144 }
145 return {};
146}
147
148QT_END_NAMESPACE
QCompressedHelpInfoPrivate(const QCompressedHelpInfoPrivate &other)
QCompressedHelpInfoPrivate()=default
\inmodule QtCore
Combined button and popup list for selecting options.