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
nodeextractor.cpp
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
#
include
"nodeextractor.h"
5
6
#
include
"atom.h"
7
#
include
"doc.h"
8
#
include
"ir/contentbuilder.h"
9
#
include
"pagenode.h"
10
#
include
"text.h"
11
12
QT_BEGIN_NAMESPACE
13
14
namespace
NodeExtractor
{
15
16
/*!
17
\internal
18
Extract page-level metadata from a PageNode into a value-type struct.
19
20
This function reads classification, identity, brief, and body fields
21
from the given PageNode and returns them as an IR::PageMetadata value.
22
Body content is populated via ContentBuilder, which transforms the
23
atom chain into structured content blocks. Format-conditional atoms
24
are skipped unconditionally since the template generator builds a
25
format-agnostic IR.
26
27
The caller (TemplateGenerator) invokes this before passing the
28
result to IR::Builder, ensuring Builder never includes PageNode
29
or other Node subclass headers.
30
*/
31
IR
::
PageMetadata
extractPageMetadata
(
const
PageNode
*pn)
32
{
33
Q_ASSERT_X(pn,
"NodeExtractor::extractPageMetadata"
,
34
"PageNode pointer must be non-null"
);
35
IR
::
PageMetadata
pm;
36
37
pm
.
nodeType
= pn
->
nodeType
();
38
pm
.
genus
= pn
->
genus
();
39
pm
.
status
= pn
->
status
();
40
pm
.
access
= pn
->
access
();
41
42
pm.title = pn->title();
43
pm.fullTitle = pn->fullTitle();
44
pm.url = pn->url();
45
pm.since = pn->since();
46
pm.deprecatedSince = pn->deprecatedSince();
47
pm.brief = pn
->
doc
().briefText().toString();
48
49
const
Text
&bodyText = pn
->
doc
().body();
50
if
(
const
Atom
*firstAtom = bodyText
.
firstAtom
(
)
) {
51
IR
::
ContentBuilder
contentBuilder;
52
pm.body = contentBuilder.build(firstAtom);
53
}
54
55
return
pm;
56
}
57
58
}
// namespace NodeExtractor
59
60
QT_END_NAMESPACE
Atom
The Atom class is the fundamental unit for representing documents internally.
Definition
atom.h:19
IR::ContentBuilder
Converts Atom chains to QList<IR::ContentBlock> trees.
Definition
contentbuilder.h:20
PageNode
A PageNode is a Node that generates a documentation page.
Definition
pagenode.h:19
Text
Definition
text.h:12
Text::firstAtom
const Atom * firstAtom() const
Definition
text.h:34
IR
Definition
builder.cpp:14
NodeExtractor
Definition
nodeextractor.cpp:14
NodeExtractor::extractPageMetadata
IR::PageMetadata extractPageMetadata(const PageNode *pn)
Definition
nodeextractor.cpp:31
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
IR::PageMetadata
Definition
pagemetadata.h:21
IR::PageMetadata::status
Status status
Definition
pagemetadata.h:24
IR::PageMetadata::access
Access access
Definition
pagemetadata.h:25
IR::PageMetadata::genus
Genus genus
Definition
pagemetadata.h:23
IR::PageMetadata::nodeType
NodeType nodeType
Definition
pagemetadata.h:22
Node::doc
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition
node.h:235
Node::nodeType
NodeType nodeType() const override
Returns this node's type.
Definition
node.h:82
Node::genus
Genus genus() const override
Returns this node's Genus.
Definition
node.h:85
Node::status
virtual Status status() const
Returns the node's status value.
Definition
node.h:239
Node::access
Access access() const
Returns the node's Access setting, which can be Public, Protected, or Private.
Definition
node.h:228
qttools
src
qdoc
qdoc
src
qdoc
nodeextractor.cpp
Generated on
for Qt by
1.16.1