From eb8e7a76328408bc12ff4abb761d7f44c27bf402 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Wed, 1 Oct 2014 18:45:23 +0200 Subject: FastSerializer: Simplify a bit Change-Id: I7dee908f5441ad34128d688e1008fd6ffad2ab3f --- sax/source/tools/fastserializer.cxx | 19 +++++++------------ sax/source/tools/fastserializer.hxx | 5 +---- sax/source/tools/fshelper.cxx | 8 +------- 3 files changed, 9 insertions(+), 23 deletions(-) (limited to 'sax/source/tools') diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 8ea04d285b1e..7afdc4d53cda 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -19,7 +19,9 @@ #include "fastserializer.hxx" +#include #include +#include #include #include @@ -52,11 +54,14 @@ static const char sSpace[] = " "; static const char sXmlHeader[] = "\n"; namespace sax_fastparser { - FastSaxSerializer::FastSaxSerializer( ) + FastSaxSerializer::FastSaxSerializer( const css::uno::Reference< css::io::XOutputStream >& xOutputStream ) : maCachedOutputStream() - , mxFastTokenHandler() , maMarkStack() { + mxFastTokenHandler = css::xml::sax::FastTokenHandler::create( + ::comphelper::getProcessComponentContext()); + assert(xOutputStream.is()); // cannot do anything without that + maCachedOutputStream.setOutputStream( xOutputStream ); } FastSaxSerializer::~FastSaxSerializer() {} @@ -189,21 +194,11 @@ namespace sax_fastparser { writeBytes(sSlashAndClosingBracket, N_CHARS(sSlashAndClosingBracket)); } - void FastSaxSerializer::setOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream ) - { - maCachedOutputStream.setOutputStream( xOutputStream ); - } - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > FastSaxSerializer::getOutputStream() { return maCachedOutputStream.getOutputStream(); } - void FastSaxSerializer::setFastTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xFastTokenHandler ) - { - mxFastTokenHandler = xFastTokenHandler; - } - void FastSaxSerializer::writeTokenValueList() { #ifdef DBG_UTIL diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 6e81c910d691..60ef71bb59b7 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -48,7 +48,7 @@ class FastSaxSerializer typedef ::com::sun::star::uno::Sequence< ::sal_Int32 > Int32Sequence; public: - FastSaxSerializer(); + FastSaxSerializer( const css::uno::Reference< css::io::XOutputStream >& xOutputStream ); ~FastSaxSerializer(); ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getOutputStream(); @@ -106,9 +106,6 @@ public: */ void singleFastElement( ::sal_Int32 Element, FastAttributeList* pAttrList = NULL ); - void setOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream ); - void setFastTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xFastTokenHandler ); - // C++ helpers void writeId( ::sal_Int32 Element ); OString getId( ::sal_Int32 Element ); diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index 222735207b3d..55be646f748d 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -19,9 +19,7 @@ #include #include "fastserializer.hxx" -#include #include -#include #include using namespace ::com::sun::star; @@ -30,12 +28,8 @@ using namespace ::com::sun::star::uno; namespace sax_fastparser { FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >& xOutputStream, bool bWriteHeader ) : - mpSerializer(new FastSaxSerializer()) + mpSerializer(new FastSaxSerializer(xOutputStream)) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), UNO_SET_THROW ); - mpSerializer->setFastTokenHandler( css::xml::sax::FastTokenHandler::create(xContext) ); - assert(xOutputStream.is()); // cannot do anything without that - mpSerializer->setOutputStream( xOutputStream ); if( bWriteHeader ) mpSerializer->startDocument(); } -- cgit