summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2023-06-30 17:02:37 +0200
committerIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2023-07-06 21:51:18 +0200
commitbcc93850fc73689bdd796b19f98cca525636a0fd (patch)
treef3ac413c1ff593a371608cbefeccd733e2f6e93c
parent2e8a48c1cdc8547ec47f097a41dd53c641715b77 (diff)
QDBusIntrospection: Pass diagnostics reporter to parser
This would allow to emit parser-related diagnostics from tools like qdbusxml2cpp. Also such tools could stop processing if there were parse errors. Task-number: QTBUG-2597 Change-Id: I573296bb57613d5a443b8c4dbe645b7e82f65adc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/dbus/qdbusintrospection.cpp20
-rw-r--r--src/dbus/qdbusintrospection_p.h7
2 files changed, 15 insertions, 12 deletions
diff --git a/src/dbus/qdbusintrospection.cpp b/src/dbus/qdbusintrospection.cpp
index 3f8766636f..484d901ad7 100644
--- a/src/dbus/qdbusintrospection.cpp
+++ b/src/dbus/qdbusintrospection.cpp
@@ -297,11 +297,11 @@ QT_BEGIN_NAMESPACE
If there are multiple interfaces in this XML data, it is undefined which one will be
returned.
*/
-QDBusIntrospection::Interface
-QDBusIntrospection::parseInterface(const QString &xml)
+QDBusIntrospection::Interface QDBusIntrospection::parseInterface(const QString &xml,
+ DiagnosticsReporter *reporter)
{
// be lazy
- Interfaces ifs = parseInterfaces(xml);
+ Interfaces ifs = parseInterfaces(xml, reporter);
if (ifs.isEmpty())
return Interface();
@@ -315,11 +315,11 @@ QDBusIntrospection::parseInterface(const QString &xml)
If the first element tag in this document fragment is \<node\>, the interfaces parsed will
be those found as child elements of the \<node\> tag.
*/
-QDBusIntrospection::Interfaces
-QDBusIntrospection::parseInterfaces(const QString &xml)
+QDBusIntrospection::Interfaces QDBusIntrospection::parseInterfaces(const QString &xml,
+ DiagnosticsReporter *reporter)
{
QString null;
- QDBusXmlParser parser(null, null, xml);
+ QDBusXmlParser parser(null, null, xml, reporter);
return parser.interfaces();
}
@@ -334,10 +334,12 @@ QDBusIntrospection::parseInterfaces(const QString &xml)
This function does not parse the interfaces contained in the node, nor sub-object's contents.
It will only list their names.
*/
-QDBusIntrospection::Object
-QDBusIntrospection::parseObject(const QString &xml, const QString &service, const QString &path)
+QDBusIntrospection::Object QDBusIntrospection::parseObject(const QString &xml,
+ const QString &service,
+ const QString &path,
+ DiagnosticsReporter *reporter)
{
- QDBusXmlParser parser(service, path, xml);
+ QDBusXmlParser parser(service, path, xml, reporter);
QSharedDataPointer<QDBusIntrospection::Object> retval = parser.object();
if (!retval)
return QDBusIntrospection::Object();
diff --git a/src/dbus/qdbusintrospection_p.h b/src/dbus/qdbusintrospection_p.h
index 38a7d5cc66..8a95e71794 100644
--- a/src/dbus/qdbusintrospection_p.h
+++ b/src/dbus/qdbusintrospection_p.h
@@ -155,10 +155,11 @@ public:
};
public:
- static Interface parseInterface(const QString &xml);
- static Interfaces parseInterfaces(const QString &xml);
+ static Interface parseInterface(const QString &xml, DiagnosticsReporter *reporter = nullptr);
+ static Interfaces parseInterfaces(const QString &xml, DiagnosticsReporter *reporter = nullptr);
static Object parseObject(const QString &xml, const QString &service = QString(),
- const QString &path = QString());
+ const QString &path = QString(),
+ DiagnosticsReporter *reporter = nullptr);
private:
QDBusIntrospection();