diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-10-01 18:45:23 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-10-23 13:24:26 +0200 |
commit | eb8e7a76328408bc12ff4abb761d7f44c27bf402 (patch) | |
tree | c8722533ef44230f3f26f5fa7cbb1d1132f17d6a /sax | |
parent | 865fc150ea61b49dc28a56f287096efae0621163 (diff) |
FastSerializer: Simplify a bit
Change-Id: I7dee908f5441ad34128d688e1008fd6ffad2ab3f
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/tools/fastserializer.cxx | 19 | ||||
-rw-r--r-- | sax/source/tools/fastserializer.hxx | 5 | ||||
-rw-r--r-- | sax/source/tools/fshelper.cxx | 8 |
3 files changed, 9 insertions, 23 deletions
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 <com/sun/star/xml/sax/FastTokenHandler.hpp> #include <rtl/ustrbuf.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/sequenceasvector.hxx> #include <string.h> @@ -52,11 +54,14 @@ static const char sSpace[] = " "; static const char sXmlHeader[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\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 <sax/fshelper.hxx> #include "fastserializer.hxx" -#include <com/sun/star/xml/sax/FastTokenHandler.hpp> #include <com/sun/star/xml/sax/XFastTokenHandler.hpp> -#include <comphelper/processfactory.hxx> #include <rtl/ustrbuf.hxx> 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(); } |