summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-03-11 14:19:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-25 12:13:26 +0200
commit0dbc76a3ca25f43232073484541504e342380d0a (patch)
treed0324098ee97a845cbbf9f7205a43af94ca7306d /unoxml
parentaf9642350db024e9a9ff73f46693ff5d0a4ce66b (diff)
make FastParser always take a FastTokenHandlerBase subclass
since most of the call sites already do, and we can skip the slow path this way. Change-Id: I64ed30c51324e0510818f42ef838f97c401bb6dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90326 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/CppunitTest_unoxml_domtest.mk1
-rw-r--r--unoxml/inc/node.hxx8
-rw-r--r--unoxml/qa/unit/domtest.cxx9
-rw-r--r--unoxml/source/dom/document.cxx2
4 files changed, 13 insertions, 7 deletions
diff --git a/unoxml/CppunitTest_unoxml_domtest.mk b/unoxml/CppunitTest_unoxml_domtest.mk
index 530624b0cb41..e6a6b2959d67 100644
--- a/unoxml/CppunitTest_unoxml_domtest.mk
+++ b/unoxml/CppunitTest_unoxml_domtest.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,unoxml_domtest, \
cppu \
cppuhelper \
sal \
+ sax \
test \
unotest \
))
diff --git a/unoxml/inc/node.hxx b/unoxml/inc/node.hxx
index a6fae4ac2745..f91a08421c13 100644
--- a/unoxml/inc/node.hxx
+++ b/unoxml/inc/node.hxx
@@ -50,13 +50,13 @@ namespace DOM
struct Context
{
Context( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& i_xHandler,
- const css::uno::Reference< css::xml::sax::XFastTokenHandler >& i_xTokenHandler ) :
+ sax_fastparser::FastTokenHandlerBase* pTokenHandler ) :
maNamespaces( 1, std::vector<Namespace>() ),
maNamespaceMap(101),
- mxAttribList(new sax_fastparser::FastAttributeList(i_xTokenHandler)),
+ mxAttribList(new sax_fastparser::FastAttributeList(pTokenHandler)),
mxCurrentHandler(i_xHandler),
mxDocHandler(i_xHandler),
- mxTokenHandler(i_xTokenHandler)
+ mxTokenHandler(pTokenHandler)
{}
struct Namespace
@@ -76,7 +76,7 @@ namespace DOM
::rtl::Reference<sax_fastparser::FastAttributeList> mxAttribList;
css::uno::Reference<css::xml::sax::XFastContextHandler> mxCurrentHandler;
css::uno::Reference<css::xml::sax::XFastDocumentHandler> mxDocHandler;
- css::uno::Reference<css::xml::sax::XFastTokenHandler> mxTokenHandler;
+ rtl::Reference<sax_fastparser::FastTokenHandlerBase> mxTokenHandler;
};
void pushContext(Context& io_rContext);
diff --git a/unoxml/qa/unit/domtest.cxx b/unoxml/qa/unit/domtest.cxx
index 31909dba6e29..b6e468defdb5 100644
--- a/unoxml/qa/unit/domtest.cxx
+++ b/unoxml/qa/unit/domtest.cxx
@@ -19,6 +19,7 @@
#include <rtl/ref.hxx>
#include <sal/log.hxx>
+#include <sax/fastattribs.hxx>
#include <comphelper/seqstream.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppunit/extensions/HelperMacros.h>
@@ -168,8 +169,7 @@ struct DocumentHandler
}
};
-struct TokenHandler
- : public ::cppu::WeakImplHelper< xml::sax::XFastTokenHandler >
+struct TokenHandler : public sax_fastparser::FastTokenHandlerBase
{
virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const uno::Sequence< ::sal_Int8 >& Identifier ) override
{
@@ -182,6 +182,11 @@ struct TokenHandler
false );
return uno::Sequence<sal_Int8>();
}
+
+ virtual sal_Int32 getTokenDirect( const char * /* pToken */, sal_Int32 /* nLength */ ) const override
+ {
+ return -1;
+ }
};
struct BasicTest : public test::BootstrapFixture
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index d74a913217d0..68f88442e4f5 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -1008,7 +1008,7 @@ namespace DOM
}
Context aContext(i_xHandler,
- i_xTokenHandler);
+ dynamic_cast<sax_fastparser::FastTokenHandlerBase*>(i_xTokenHandler.get()));
// register namespace ids
for (const beans::Pair<OUString,sal_Int32>& rNs : i_rRegisterNamespaces)