Coverage Report

Created: 2025-12-03 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qt/qtbase/src/dbus/qdbusxmlparser_p.h
Line
Count
Source
1
// Copyright (C) 2016 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
5
#ifndef QDBUSXMLPARSER_P_H
6
#define QDBUSXMLPARSER_P_H
7
8
//
9
//  W A R N I N G
10
//  -------------
11
//
12
// This file is not part of the Qt API.  It exists for the convenience
13
// of the QLibrary class.  This header file may change from
14
// version to version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#include <QtDBus/private/qtdbusglobal_p.h>
20
#include <QtCore/qloggingcategory.h>
21
#include <QtCore/qmap.h>
22
#include <QtCore/qxmlstream.h>
23
#include "qdbusintrospection_p.h"
24
25
#ifndef QT_NO_DBUS
26
27
QT_BEGIN_NAMESPACE
28
29
Q_DECLARE_LOGGING_CATEGORY(dbusParser)
30
31
/*!
32
    \internal
33
*/
34
class QDBusXmlParser
35
{
36
    QString m_service;
37
    QString m_path;
38
    QSharedDataPointer<QDBusIntrospection::Object> m_object;
39
    std::unique_ptr<QDBusIntrospection::Interface> m_currentInterface;
40
    QDBusIntrospection::Interfaces m_interfaces;
41
    QXmlStreamReader m_xml;
42
    QDBusIntrospection::SourceLocation m_currentLocation;
43
    QDBusIntrospection::DiagnosticsReporter *m_reporter;
44
45
public:
46
    QDBusXmlParser(const QString &service, const QString &path, const QString &xmlData,
47
                   QDBusIntrospection::DiagnosticsReporter *reporter = nullptr);
48
49
0
    inline QDBusIntrospection::Interfaces interfaces() const { return m_interfaces; }
50
0
    inline QSharedDataPointer<QDBusIntrospection::Object> object() const { return m_object; }
51
52
private:
53
    void readNode(int nodeLevel);
54
    void readInterface();
55
    bool parseSignal(QDBusIntrospection::Signal &signalData);
56
    bool parseMethod(QDBusIntrospection::Method &methodData);
57
    bool parseProperty(QDBusIntrospection::Property &propertyData);
58
    bool parseAnnotation(QDBusIntrospection::Annotations &annotations,
59
                         bool interfaceAnnotation = false);
60
    bool parseArg(const QXmlStreamAttributes &attributes, QDBusIntrospection::Argument &argData);
61
    bool readNextStartElement();
62
    void updateCurrentLocation();
63
};
64
65
QT_END_NAMESPACE
66
67
#endif // QT_NO_DBUS
68
#endif