summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-05-29 20:24:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-01 11:59:06 +0200
commit5e68d6cfade45f40b1ad46025a81afe4cb8dd337 (patch)
treeaf7740f3636e6b303371c764bfe7ff083e847879 /sax
parentf15a6e1b1b186bf42e1ade05630d17841add2c46 (diff)
Convert XFastParser into a normal C++ interface
There is no need for it to be an UNO interface anymore (ever since we started supporting dynamic_cast on UNO objects). Which means that XImportFilter2 also needs become a C++ interface. Change-Id: Ice2db0f098271bba32b199bd083b08cb8410ce93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152388 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r--sax/qa/cppunit/parser.cxx1
-rw-r--r--sax/source/expatwrap/expwrap.component4
-rw-r--r--sax/source/fastparser/fastparser.cxx14
-rw-r--r--sax/source/fastparser/legacyfastparser.cxx13
4 files changed, 20 insertions, 12 deletions
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index 261091fe8769..88e0ebd90cf9 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -12,6 +12,7 @@
#include <com/sun/star/io/Pipe.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <sax/fastparser.hxx>
#include <sax/fastattribs.hxx>
diff --git a/sax/source/expatwrap/expwrap.component b/sax/source/expatwrap/expwrap.component
index 1f72eccf3145..dbc9822c566d 100644
--- a/sax/source/expatwrap/expwrap.component
+++ b/sax/source/expatwrap/expwrap.component
@@ -27,10 +27,6 @@
constructor="com_sun_star_extensions_xml_sax_Writer_get_implementation">
<service name="com.sun.star.xml.sax.Writer"/>
</implementation>
- <implementation name="com.sun.star.comp.extensions.xml.sax.FastParser"
- constructor="com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation">
- <service name="com.sun.star.xml.sax.FastParser"/>
- </implementation>
<implementation name="com.sun.star.comp.extensions.xml.sax.LegacyFastParser"
constructor="com_sun_star_comp_extensions_xml_sax_LegacyFastParser_get_implementation">
<service name="com.sun.star.xml.sax.LegacyFastParser"/>
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 344dda9cd63e..d92d0de0321d 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -19,6 +19,7 @@
#include <sax/fastparser.hxx>
#include <sax/fastattribs.hxx>
+#include <sax/ximportfilter2.hxx>
#include <utility>
#include <xml2utf.hxx>
@@ -27,8 +28,13 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XFastNamespaceHandler.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -1484,9 +1490,9 @@ void FastSaxParser::registerNamespace( const OUString& NamespaceURL, sal_Int32 N
mpImpl->registerNamespace(NamespaceURL, NamespaceToken);
}
-OUString FastSaxParser::getNamespaceURL( const OUString& rPrefix )
+OUString FastSaxParser::getNamespaceURL( std::u16string_view aPrefix )
{
- return mpImpl->getNamespaceURL(rPrefix);
+ return mpImpl->getNamespaceURL(aPrefix);
}
void FastSaxParser::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
@@ -1675,5 +1681,9 @@ static bool NormalizeOasisURN( OUString& rName )
return true;
}
+XFastParser::~XFastParser() {}
+
+XImportFilter2::~XImportFilter2() {}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx
index 62e7b8a57a88..8dd5e5379aa0 100644
--- a/sax/source/fastparser/legacyfastparser.cxx
+++ b/sax/source/fastparser/legacyfastparser.cxx
@@ -19,13 +19,16 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
+#include <com/sun/star/xml/sax/XFastNamespaceHandler.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/Pair.hpp>
#include <comphelper/attributelist.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/ref.hxx>
+#include <sax/fastparser.hxx>
#include <memory>
#include <utility>
#include <vector>
@@ -115,7 +118,7 @@ public:
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
private:
- Reference< XFastParser > m_xParser;
+ rtl::Reference< sax_fastparser::FastSaxParser > m_xParser;
Reference< XDocumentHandler > m_xDocumentHandler;
Reference< XFastTokenHandler > m_xTokenHandler;
@@ -281,7 +284,7 @@ void SAL_CALL CallbackDocumentHandler::characters( const OUString& aChars )
}
SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new NamespaceHandler ),
- m_xParser(FastParser::create(::comphelper::getProcessComponentContext() ))
+ m_xParser(new sax_fastparser::FastSaxParser)
{
m_xParser->setNamespaceHandler( m_aNamespaceHandler );
}
@@ -308,9 +311,7 @@ void SAL_CALL SaxLegacyFastParser::initialize(Sequence< Any > const& rArguments
}
else
{
- uno::Reference<lang::XInitialization> const xInit(m_xParser,
- uno::UNO_QUERY_THROW);
- xInit->initialize( rArguments );
+ m_xParser->initialize( rArguments );
}
}