Coverage Report

Created: 2026-10-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/xml/dom/qdomhelpers_p.h
Line
Count
Source
1
// Copyright (C) 2021 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
#ifndef QDOMHELPERS_P_H
4
#define QDOMHELPERS_P_H
5
6
#include <qcoreapplication.h>
7
#include <qdom.h>
8
#include <private/qglobal_p.h>
9
10
QT_REQUIRE_CONFIG(dom);
11
QT_BEGIN_NAMESPACE
12
13
//
14
//  W A R N I N G
15
//  -------------
16
//
17
// This file is not part of the Qt API. It exists for the convenience of
18
// qxml.cpp and qdom.cpp. This header file may change from version to version without
19
// notice, or even be removed.
20
//
21
// We mean it.
22
//
23
24
class QDomDocumentPrivate;
25
class QDomNodePrivate;
26
class QXmlStreamReader;
27
class QXmlStreamAttributes;
28
29
/**************************************************************
30
 *
31
 * QDomBuilder
32
 *
33
 **************************************************************/
34
35
class QDomBuilder
36
{
37
public:
38
    QDomBuilder(QDomDocumentPrivate *d, QXmlStreamReader *r, QDomDocument::ParseOptions options);
39
    ~QDomBuilder();
40
41
    bool endDocument();
42
    bool startElement(const QString &nsURI, const QString &qName, const QXmlStreamAttributes &atts);
43
    bool endElement();
44
    bool characters(const QString &characters, bool cdata = false);
45
    bool processingInstruction(const QString &target, const QString &data);
46
    bool skippedEntity(const QString &name);
47
    bool startDTD(const QString &name, const QString &publicId, const QString &systemId);
48
    bool parseDTD(const QString &dtd);
49
    bool comment(const QString &characters);
50
    bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId);
51
    bool notationDecl(const QString &name, const QString &publicId, const QString &systemId);
52
    bool unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId,
53
                            const QString &notationName);
54
55
    void fatalError(const QString &message);
56
33.9k
    QDomDocument::ParseResult result() const { return parseResult; }
57
58
    bool preserveSpacingOnlyNodes() const
59
582k
    { return parseOptions & QDomDocument::ParseOption::PreserveSpacingOnlyNodes; }
60
61
private:
62
    QString dtdInternalSubset(const QString &dtd);
63
64
    QDomDocument::ParseResult parseResult;
65
    QDomDocumentPrivate *doc;
66
    QDomNodePrivate *node;
67
    QXmlStreamReader *reader;
68
    QDomDocument::ParseOptions parseOptions;
69
};
70
71
/**************************************************************
72
 *
73
 * QDomParser
74
 *
75
 **************************************************************/
76
77
class QDomParser
78
{
79
    Q_DECLARE_TR_FUNCTIONS(QDomParser)
80
public:
81
    QDomParser(QDomDocumentPrivate *d, QXmlStreamReader *r, QDomDocument::ParseOptions options);
82
83
    bool parse();
84
33.9k
    QDomDocument::ParseResult result() const { return domBuilder.result(); }
85
86
private:
87
    bool parseProlog();
88
    bool parseBody();
89
    bool parseMarkupDecl();
90
91
    QXmlStreamReader *reader;
92
    QDomBuilder domBuilder;
93
};
94
95
QT_END_NAMESPACE
96
97
#endif // QDOMHELPERS_P_H