aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6_generator/ApiExtractor/xmlutils.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <friedemann.kleint@qt.io>2023-05-10 13:50:56 +0200
committerCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2025-11-24 12:06:06 +0100
commit845630ad239c4b37ff37e49ef5bb969a8946744b (patch)
tree5c65f2e270511459d346c14f0ad8d01f5e6e39a0 /sources/shiboken6_generator/ApiExtractor/xmlutils.cpp
parent3cf2077a1b060bbea3419ccde23c5da6485a2e24 (diff)
Move the shiboken-generator source around
THIS COMMIT WAS GENERATED BY A SCRIPT Task-number: PYSIDE-962 Task-number: PYSIDE-1587 Change-Id: I58b05c3d05606efb6303193f2d7f907a0ab5741b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken6_generator/ApiExtractor/xmlutils.cpp')
-rw-r--r--sources/shiboken6_generator/ApiExtractor/xmlutils.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/sources/shiboken6_generator/ApiExtractor/xmlutils.cpp b/sources/shiboken6_generator/ApiExtractor/xmlutils.cpp
new file mode 100644
index 000000000..104cca1fe
--- /dev/null
+++ b/sources/shiboken6_generator/ApiExtractor/xmlutils.cpp
@@ -0,0 +1,44 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "xmlutils.h"
+
+#include "xmlutils_libxslt.h"
+
+#include "qtcompat.h"
+
+using namespace Qt::StringLiterals;
+
+XQuery::XQuery() = default;
+
+XQuery::~XQuery() = default;
+
+QString XQuery::evaluate(QString xPathExpression, QString *errorMessage)
+{
+ // XQuery can't have invalid XML characters
+ xPathExpression.replace(u'&', u"&amp;"_s);
+ xPathExpression.replace(u'<', u"&lt;"_s);
+ return doEvaluate(xPathExpression, errorMessage);
+}
+
+std::shared_ptr<XQuery> XQuery::create(const QString &focus, QString *errorMessage)
+{
+#if defined(HAVE_LIBXSLT)
+ return libXml_createXQuery(focus, errorMessage);
+#else
+ Q_UNUSED(focus);
+ *errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
+ return {};
+#endif
+}
+
+QString xsl_transform(const QString &xml, const QString &xsl, QString *errorMessage)
+{
+#if defined(HAVE_LIBXSLT)
+ return libXslt_transform(xml, xsl, errorMessage);
+#else
+ Q_UNUSED(xsl);
+ *errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
+ return xml;
+#endif
+}