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