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
contentblock.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef QDOC_IR_CONTENTBLOCK_H
5#define QDOC_IR_CONTENTBLOCK_H
6
7#include <QJsonObject>
8#include <QList>
9#include <QString>
10
11#include <optional>
12
13QT_BEGIN_NAMESPACE
14
15namespace IR {
16
34
35enum class LinkOrigin : unsigned char {
39};
40
49
51{
53 QString text; //!< Text content
54 QString href; //!< Link target or image source
55 QString title; //!< Link tooltip or image alt text
56 QList<InlineContent> children; //!< Nested inline content
57 QJsonObject attributes; //!< Type-specific metadata
58
60 QString filePath; //!< Source file of the originating atom
61 int lineNo { 0 }; //!< Line number within \c filePath
62 };
63
64 struct LinkData {
67 std::optional<SourceLocation> sourceLocation; //!< Set for author-written links; unset for synthesized links
68
69 LinkData() = default;
71 std::optional<SourceLocation> loc = std::nullopt)
72 : origin{o}, state{s}, sourceLocation{std::move(loc)} {}
73 };
74 std::optional<LinkData> link;
75
76 [[nodiscard]] QJsonObject toJson() const;
77 [[nodiscard]] QString plainText() const;
78};
79
107
109{
111 QJsonObject attributes; //!< Type-specific metadata
112 QList<InlineContent> inlineContent; //!< Rich inline content
113 QList<ContentBlock> children; //!< Nested blocks
114
115 [[nodiscard]] QJsonObject toJson() const;
116 [[nodiscard]] QString plainText() const;
117};
118
119} // namespace IR
120
121QT_END_NAMESPACE
122
123#endif // QDOC_IR_CONTENTBLOCK_H
Assembles IR Documents from pre-extracted metadata.
Definition builder.h:15
Builder()=default
Document buildPageIR(PageMetadata pm) const
Definition builder.cpp:196
Status
Specifies the status of the QQmlIncubator.
NodeType
Definition genustypes.h:165
Definition builder.cpp:14
static QList< ContentBlock > buildThreadSafetyAdmonition(const CppReferenceData::ThreadSafetyInfo &ts, const QString &typeWord)
Definition builder.cpp:107
static InlineContent makeResolvedLink(const QString &name, const QString &href)
Definition builder.cpp:74
LinkState
LinkOrigin
static void appendExceptionList(QList< InlineContent > &inlines, const QString &prefix, const QString &topicName, const QList< CppReferenceData::ThreadSafetyExceptionEntry > &exceptions)
Definition builder.cpp:84
BlockType
static InlineContent makeTopicLink(const QString &topicName)
Definition builder.cpp:54
static InlineContent makeTextInline(const QString &text)
Definition builder.cpp:35
static void gatherBodyTocEntries(const QList< ContentBlock > &blocks, QList< NavigationInfo::TocEntry > &out)
Definition builder.cpp:16
InlineType
Combined button and popup list for selecting options.
@ Active
Definition status.h:14
QString cmakeComponent
Definition document.h:62
QString logicalModuleVersion
Definition document.h:59
QList< MemberEntry > members
Definition document.h:80
QJsonObject toJson() const
Converts the CollectionInfo to a QJsonObject for template rendering.
Definition document.cpp:127
QString qtVariable
Definition document.h:60
QList< MemberEntry > classes
Definition document.h:79
QString cmakePackage
Definition document.h:61
QString logicalModuleName
Definition document.h:58
QList< MemberEntry > namespaces
Definition document.h:78
QString cmakeTargetItem
Definition document.h:63
Represents a structural block element in documentation.
QJsonObject toJson() const
Converts the ContentBlock to a QJsonObject for template rendering.
QList< InlineContent > inlineContent
Rich inline content.
QJsonObject attributes
Type-specific metadata.
QString plainText() const
Returns the concatenated plain text of this block's content, recursively.
QList< ContentBlock > children
Nested blocks.
QList< ThreadSafetyExceptionEntry > reentrantExceptions
Definition document.h:116
QList< ThreadSafetyExceptionEntry > nonReentrantExceptions
Definition document.h:118
QList< ThreadSafetyExceptionEntry > threadSafeExceptions
Definition document.h:117
QList< QString > referencedConcepts
Definition document.h:138
QList< SignatureSpan > templateDeclSpans
Definition document.h:137
std::optional< ThreadSafetyInfo > threadSafety
Definition document.h:154
QList< ContentBlock > threadSafetyAdmonition
Definition document.h:155
QList< ComparisonEntry > comparisonEntries
Definition document.h:152
QString cmakeTargetLinkLibraries
Definition document.h:128
QList< DerivedClassEntry > derivedClasses
Definition document.h:134
QStringList ancestorNames
Definition document.h:149
QString fullNamespaceModuleName
Definition document.h:146
QString cmakeFindPackage
Definition document.h:127
std::optional< QmlNativeTypeLink > qmlNativeType
Definition document.h:132
QString obsoleteMembersUrl
Definition document.h:160
QString fullNamespaceHref
Definition document.h:145
QList< GroupEntry > groups
Definition document.h:157
QString selfComparisonCategory
Definition document.h:151
QList< BaseClassEntry > baseClasses
Definition document.h:133
QJsonObject toJson() const
Converts CppReferenceInfo to a QJsonObject for template rendering.
Definition document.cpp:168
Intermediate representation for a documentation topic.
Definition document.h:201
QList< ContentBlock > body
Definition document.h:223
QString fullTitle
Definition document.h:210
QString membersPageUrl
Definition document.h:243
QList< SectionIR > summarySections
Definition document.h:227
std::optional< QmlTypeInfo > qmlTypeInfo
Definition document.h:231
QString deprecatedSinceQualified
Definition document.h:218
QString url
Definition document.h:211
QList< SectionIR > detailSections
Definition document.h:228
std::optional< NavigationInfo > navigationInfo
Definition document.h:240
Access access
Definition document.h:206
QString title
Definition document.h:209
QString brief
Definition document.h:220
std::optional< CppReferenceInfo > cppReferenceInfo
Definition document.h:237
QString typeNoun
Definition document.h:216
Status status
Definition document.h:205
QJsonObject contentJson
Definition document.h:224
NodeType nodeType
Definition document.h:203
QString deprecatedSince
Definition document.h:215
std::optional< CollectionInfo > collectionInfo
Definition document.h:234
QJsonObject toJson() const
Converts the Document to a QJsonObject for template rendering.
Definition document.cpp:390
QString since
Definition document.h:214
Genus genus
Definition document.h:204
LinkData(LinkOrigin o, LinkState s, std::optional< SourceLocation > loc=std::nullopt)
std::optional< SourceLocation > sourceLocation
Set for author-written links; unset for synthesized links.
QString filePath
Source file of the originating atom.
int lineNo
Line number within filePath.
Represents inline content within a documentation block.
QJsonObject attributes
Type-specific metadata.
QString href
Link target or image source.
QJsonObject toJson() const
Converts the InlineContent to a QJsonObject for template rendering.
QString text
Text content.
QList< InlineContent > children
Nested inline content.
std::optional< LinkData > link
QString title
Link tooltip or image alt text.
QString plainText() const
Returns the concatenated plain text of this inline element and all its children, recursively.
std::optional< LinkEntry > nextLink
Definition document.h:192
QList< TocEntry > tocEntries
Definition document.h:194
QList< BreadcrumbEntry > breadcrumbs
Definition document.h:190
std::optional< LinkEntry > startLink
Definition document.h:193
std::optional< LinkEntry > previousLink
Definition document.h:191
QJsonObject toJson() const
Converts NavigationInfo to a QJsonObject for template rendering.
Definition document.cpp:325
QString obsoleteMembersUrl
Definition document.h:32
std::optional< InheritsInfo > inherits
Definition document.h:39
QJsonObject toJson() const
\variable IR::Document::typeNoun
Definition document.cpp:62
std::optional< NativeTypeInfo > nativeType
Definition document.h:51
QList< InheritedByEntry > inheritedBy
Definition document.h:45
bool hasObsoleteMembers
Definition document.h:31
QString importStatement
Definition document.h:28