summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2013-12-16 10:58:22 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2013-12-18 07:15:48 +0100
commit291e846db9840b9f82bc28e495b54ae5ac51d0fc (patch)
tree95d49b4430ce572143cf12818c3ee0d693e1b6ff
parentDeduplicate some foo_component_getFactory declarations. (diff)
downloadcore-291e846db9840b9f82bc28e495b54ae5ac51d0fc.tar.gz
core-291e846db9840b9f82bc28e495b54ae5ac51d0fc.zip
sax: various clean up. Move _getFactory next to the implementation.
Use more anonymous namespaces, de-duplicate code, bin some comments. Makes the library smaller. Change-Id: Id0cefdcaa72a74741303fc27e36038488ef8b059
-rw-r--r--include/sax/fastparser.hxx3
-rw-r--r--sax/source/expatwrap/factory.hxx27
-rw-r--r--sax/source/expatwrap/sax_expat.cxx118
-rw-r--r--sax/source/expatwrap/saxwriter.cxx69
-rw-r--r--sax/source/fastparser/fastparser.cxx138
-rw-r--r--sax/test/sax/testsax.cxx2
-rw-r--r--sax/test/sax/testwriter.cxx2
7 files changed, 106 insertions, 253 deletions
diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index afd5add88b00..83fbe9df7fa7 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -52,9 +52,6 @@ public:
FastSaxParser();
virtual ~FastSaxParser();
- // The implementation details
- static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void);
-
// XFastParser
virtual void SAL_CALL parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/sax/source/expatwrap/factory.hxx b/sax/source/expatwrap/factory.hxx
deleted file mode 100644
index a3a94fbe8c83..000000000000
--- a/sax/source/expatwrap/factory.hxx
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-namespace sax_expatwrap {
-Reference< XInterface > SAL_CALL SaxWriter_CreateInstance(
- const Reference< XMultiServiceFactory > & rSMgr ) throw (Exception);
-OUString SaxWriter_getServiceName() throw();
-OUString SaxWriter_getImplementationName() throw();
-Sequence< OUString > SaxWriter_getSupportedServiceNames(void) throw();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 214d2625dbc5..83dff1afe9f5 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -46,12 +46,10 @@ using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::io;
-#include "factory.hxx"
#include "attrlistimpl.hxx"
#include "xml2utf.hxx"
-#include <sax/fastparser.hxx>
-namespace sax_expatwrap {
+namespace {
// Useful macros for correct String conversion depending on the choosen expat-mode
#ifdef XML_UNICODE
@@ -128,11 +126,15 @@ OUString XmlChar2OUString( const XML_Char *p )
}\
((void)0)
-#define IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.ParserExpat"
-#define SERVICE_NAME "com.sun.star.xml.sax.Parser"
class SaxExpatParser_Impl;
+static Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void)
+{
+ Sequence<OUString> seq(1);
+ seq[0] = OUString("com.sun.star.xml.sax.Parser");
+ return seq;
+}
// This class implements the external Parser interface
class SaxExpatParser
@@ -145,12 +147,6 @@ public:
SaxExpatParser();
~SaxExpatParser();
-public:
-
- // The implementation details
- static Sequence< OUString > getSupportedServiceNames_Static(void) throw ();
-
-public:
// ::com::sun::star::lang::XInitialization:
virtual void SAL_CALL initialize(Sequence<Any> const& rArguments)
throw (RuntimeException, Exception);
@@ -183,45 +179,13 @@ private:
};
-//--------------------------------------
-// the extern interface
-//---------------------------------------
-Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance(
- SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
- throw(Exception)
-{
- SaxExpatParser *p = new SaxExpatParser;
-
- return Reference< XInterface > ( (OWeakObject * ) p );
-}
-
-Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
- SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
- throw(Exception)
-{
- ::sax_fastparser::FastSaxParser *p = new ::sax_fastparser::FastSaxParser;
- return Reference< XInterface > ( (OWeakObject * ) p );
-}
-
-Sequence< OUString > SaxExpatParser::getSupportedServiceNames_Static(void) throw ()
-{
- Sequence<OUString> aRet(1);
- aRet[0] = SERVICE_NAME;
- return aRet;
-}
-
-
-//---------------------------------------------
-// the implementation part
-//---------------------------------------------
-
// Entity binds all information neede for a single file
struct Entity
{
InputSource structSource;
XML_Parser pParser;
- XMLFile2UTFConverter converter;
+ sax_expatwrap::XMLFile2UTFConverter converter;
};
@@ -242,7 +206,7 @@ public: // module scope
Reference < XAttributeList > rAttrList;
- AttributeList *pAttrList;
+ sax_expatwrap::AttributeList *pAttrList;
// External entity stack
vector<struct Entity> vecEntity;
@@ -450,7 +414,7 @@ SaxExpatParser::SaxExpatParser( )
// performance-improvement. Reference is needed when calling the startTag callback.
// Handing out the same object with every call is allowed (see sax-specification)
- m_pImpl->pAttrList = new AttributeList;
+ m_pImpl->pAttrList = new sax_expatwrap::AttributeList;
m_pImpl->rAttrList = Reference< XAttributeList > ( m_pImpl->pAttrList );
m_pImpl->bExceptionWasThrown = false;
@@ -630,7 +594,7 @@ void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException)
// XServiceInfo
OUString SaxExpatParser::getImplementationName() throw ()
{
- return OUString( IMPLEMENTATION_NAME );
+ return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat");
}
// XServiceInfo
@@ -642,10 +606,7 @@ sal_Bool SaxExpatParser::supportsService(const OUString& ServiceName) throw ()
// XServiceInfo
Sequence< OUString > SaxExpatParser::getSupportedServiceNames(void) throw ()
{
-
- Sequence<OUString> seq(1);
- seq[0] = SERVICE_NAME;
- return seq;
+ return SaxExpatParser_getSupportedServiceNames();
}
@@ -1058,56 +1019,29 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() );
}
+} // namespace
+
+static Reference< XInterface > SaxExpatParser_CreateInstance(
+ SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
+ throw(Exception)
+{
+ SaxExpatParser *p = new SaxExpatParser;
+ return Reference< XInterface > ( (OWeakObject * ) p );
}
-static void * getSingleFactory(
- void *pServiceManager,
- const OUString& sImplementation,
- ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames)
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
+ const char * , void *pServiceManager, void * )
{
Reference< XSingleServiceFactory > xFactory;
Reference< XMultiServiceFactory > xSMgr =
reinterpret_cast< XMultiServiceFactory * >( pServiceManager );
xFactory = createSingleFactory( xSMgr,
- sImplementation, pCreateFunction, rServiceNames );
- xFactory->acquire();
- return xFactory.get();
-}
-
-using namespace sax_expatwrap;
-
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
- const char * , void *pServiceManager, void * )
-{
- return getSingleFactory( pServiceManager,
"com.sun.star.comp.extensions.xml.sax.ParserExpat",
SaxExpatParser_CreateInstance,
- SaxExpatParser::getSupportedServiceNames_Static() );
-}
-
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_extensions_xml_sax_Writer_component_getFactory(
- const char * , void *pServiceManager, void * )
-{
- return getSingleFactory( pServiceManager,
- "com.sun.star.extensions.xml.sax.Writer",
- SaxWriter_CreateInstance,
- SaxWriter_getSupportedServiceNames() );
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory(
- const char * , void *pServiceManager, void * )
-{
- return getSingleFactory( pServiceManager,
- "com.sun.star.comp.extensions.xml.sax.FastParser",
- FastSaxParser_CreateInstance,
- sax_fastparser::FastSaxParser::getSupportedServiceNames_Static() );
-}
-
+ SaxExpatParser_getSupportedServiceNames() );
+ xFactory->acquire();
+ return xFactory.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 12e4674863c1..a6b9a31d0a4e 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -51,7 +51,6 @@ using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
-#include "factory.hxx"
#include "xml2utf.hxx"
#define LINEFEED 10
@@ -66,7 +65,7 @@ using namespace ::com::sun::star::io;
*
*****/
-namespace sax_expatwrap {
+namespace {
enum SaxInvalidCharacterError
{
@@ -868,6 +867,13 @@ static inline sal_Int32 getFirstLineBreak( const OUString & str ) throw ()
return -1;
}
+static Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw ()
+{
+ Sequence<OUString> seq(1);
+ seq.getArray()[0] = OUString("com.sun.star.xml.sax.Writer");
+ return seq;
+}
+
class SAXWriter :
public WeakImplHelper2<
XWriter,
@@ -965,36 +971,6 @@ private:
sal_Int32 m_nLevel;
};
-
-//--------------------------------------
-// the extern interface
-//---------------------------------------
-Reference < XInterface > SAL_CALL SaxWriter_CreateInstance(
- SAL_UNUSED_PARAMETER const Reference < XMultiServiceFactory > & )
- throw (Exception)
-{
- SAXWriter *p = new SAXWriter;
- return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) );
-}
-
-OUString SaxWriter_getServiceName() throw()
-{
- return OUString("com.sun.star.xml.sax.Writer");
-}
-
-OUString SaxWriter_getImplementationName() throw()
-{
- return OUString("com.sun.star.extensions.xml.sax.Writer");
-}
-
-Sequence< OUString > SaxWriter_getSupportedServiceNames(void) throw()
-{
- Sequence<OUString> aRet(1);
- aRet.getArray()[0] = SaxWriter_getServiceName();
- return aRet;
-}
-
-
sal_Int32 SAXWriter::getIndentPrefixLength( sal_Int32 nFirstLineBreakOccurrence ) throw()
{
sal_Int32 nLength =-1;
@@ -1018,7 +994,7 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw()
// XServiceInfo
OUString SAXWriter::getImplementationName() throw()
{
- return SaxWriter_getImplementationName();
+ return OUString("com.sun.star.extensions.xml.sax.Writer");
}
// XServiceInfo
@@ -1030,9 +1006,7 @@ sal_Bool SAXWriter::supportsService(const OUString& ServiceName) throw()
// XServiceInfo
Sequence< OUString > SAXWriter::getSupportedServiceNames(void) throw ()
{
- Sequence<OUString> seq(1);
- seq.getArray()[0] = SaxWriter_getServiceName();
- return seq;
+ return SAXWriter_getSupportedServiceNames();
}
void SAXWriter::startDocument() throw(SAXException, RuntimeException )
@@ -1398,6 +1372,29 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc
}
}
+} // namespace
+
+static Reference < XInterface > SAXWriter_CreateInstance(
+ SAL_UNUSED_PARAMETER const Reference < XMultiServiceFactory > & )
+ throw (Exception)
+{
+ SAXWriter *p = new SAXWriter;
+ return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) );
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_extensions_xml_sax_Writer_component_getFactory(
+ const char * , void *pServiceManager, void * )
+{
+ Reference< XSingleServiceFactory > xFactory;
+ Reference< XMultiServiceFactory > xSMgr =
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager );
+ xFactory = createSingleFactory( xSMgr,
+ "com.sun.star.extensions.xml.sax.Writer",
+ SAXWriter_CreateInstance,
+ SAXWriter_getSupportedServiceNames() );
+ xFactory->acquire();
+ return xFactory.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index af73f238274f..5dd5c6455498 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -45,9 +45,6 @@
#include <cstring>
#include <expat.h>
-#define PARSER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser"
-#define PARSER_SERVICE_NAME "com.sun.star.xml.sax.FastParser"
-
using namespace ::std;
using namespace ::osl;
using namespace ::cppu;
@@ -56,8 +53,17 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::io;
using namespace com::sun::star;
+using namespace sax_fastparser;
-namespace sax_fastparser {
+static uno::Sequence<OUString> FastSaxParser_getSupportedServiceNames()
+ throw (uno::RuntimeException)
+{
+ Sequence<OUString> seq(1);
+ seq.getArray()[0] = OUString("com.sun.star.xml.sax.FastParser");
+ return seq;
+}
+
+namespace {
struct Event;
class FastLocatorImpl;
@@ -186,9 +192,9 @@ struct Entity : public ParserData
Event& getEvent( CallbackType aType );
};
-// --------------------------------------------------------------------
-// FastSaxParser implementation
-// --------------------------------------------------------------------
+} // namespace
+
+namespace sax_fastparser {
class FastSaxParserImpl
{
@@ -196,9 +202,6 @@ public:
FastSaxParserImpl( FastSaxParser* pFront );
~FastSaxParserImpl();
- // The implementation details
- static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void);
-
// XFastParser
void parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
void setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
@@ -209,11 +212,6 @@ public:
void setEntityResolver( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver >& Resolver ) throw (::com::sun::star::uno::RuntimeException);
void setLocale( const ::com::sun::star::lang::Locale& rLocale ) throw (::com::sun::star::uno::RuntimeException);
- // XServiceInfo
- OUString getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
- sal_Bool supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-
// called by the C callbacks of the expat parser
void callbackStartElement( const XML_Char* name, const XML_Char** atts );
void callbackEndElement( const XML_Char* name );
@@ -262,6 +260,10 @@ private:
FastTokenLookup maTokenLookup;
};
+} // namespace sax_fastparser
+
+namespace {
+
class ParserThread: public salhelper::Thread
{
FastSaxParserImpl *mpParser;
@@ -282,25 +284,23 @@ private:
}
};
-}
-
extern "C" {
static void call_callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts)
{
- sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( userData );
+ FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( userData );
pFastParser->callbackStartElement( name, atts );
}
static void call_callbackEndElement(void *userData, const XML_Char *name)
{
- sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( userData );
+ FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( userData );
pFastParser->callbackEndElement( name );
}
static void call_callbackCharacters( void *userData , const XML_Char *s , int nLen )
{
- sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( userData );
+ FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( userData );
pFastParser->callbackCharacters( s, nLen );
}
@@ -309,7 +309,7 @@ static void call_callbackEntityDecl(void *userData, const XML_Char *entityName,
const XML_Char *base, const XML_Char *systemId,
const XML_Char *publicId, const XML_Char *notationName)
{
- sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>(userData);
+ FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>(userData);
pFastParser->callbackEntityDecl(entityName, is_parameter_entity, value,
value_length, base, systemId, publicId, notationName);
}
@@ -317,18 +317,12 @@ static void call_callbackEntityDecl(void *userData, const XML_Char *entityName,
static int call_callbackExternalEntityRef( XML_Parser parser,
const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId )
{
- sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( XML_GetUserData( parser ) );
+ FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( XML_GetUserData( parser ) );
return pFastParser->callbackExternalEntityRef( parser, openEntityNames, base, systemId, publicId );
}
}
-namespace sax_fastparser {
-
-// --------------------------------------------------------------------
-// FastLocatorImpl
-// --------------------------------------------------------------------
-
class FastLocatorImpl : public WeakImplHelper1< XLocator >
{
public:
@@ -347,19 +341,6 @@ private:
FastSaxParserImpl *mpParser;
};
-// --------------------------------------------------------------------
-// FastSaxParser
-// --------------------------------------------------------------------
-
-//---------------------------------------------
-// the implementation part
-//---------------------------------------------
-
-
-// --------------------------------------------------------------------
-// FastLocatorImpl implementation
-// --------------------------------------------------------------------
-
sal_Int32 SAL_CALL FastLocatorImpl::getColumnNumber(void) throw (RuntimeException)
{
checkDispose();
@@ -546,6 +527,10 @@ Event& Entity::getEvent( CallbackType aType )
return rEvent;
}
+} // namespace
+
+namespace sax_fastparser {
+
FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* pFront ) : mpFront(pFront)
{
mxDocumentLocator.set( new FastLocatorImpl( this ) );
@@ -870,44 +855,7 @@ void FastSaxParserImpl::setLocale( const Locale & Locale ) throw (RuntimeExcepti
maData.maLocale = Locale;
}
-Sequence< OUString > FastSaxParserImpl::getSupportedServiceNames_Static(void)
-{
- Sequence<OUString> aRet(1);
- aRet.getArray()[0] = OUString( PARSER_SERVICE_NAME );
- return aRet;
-}
-
-// XServiceInfo
-OUString FastSaxParserImpl::getImplementationName() throw (RuntimeException)
-{
- return OUString( PARSER_IMPLEMENTATION_NAME );
-}
-
-// XServiceInfo
-sal_Bool FastSaxParserImpl::supportsService(const OUString& ServiceName) throw (RuntimeException)
-{
- return cppu::supportsService(mpFront, ServiceName);
-}
-
-// XServiceInfo
-Sequence< OUString > FastSaxParserImpl::getSupportedServiceNames(void) throw (RuntimeException)
-{
-
- Sequence<OUString> seq(1);
- seq.getArray()[0] = OUString( PARSER_SERVICE_NAME );
- return seq;
-}
-
-
-/*---------------------------------------
-*
-* Helper functions and classes
-*
-*-------------------------------------------*/
-
-namespace {
-
-OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine )
+static OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine )
{
const sal_Char* pMessage = "";
switch( xmlE )
@@ -948,8 +896,6 @@ OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int3
return aBuffer.makeStringAndClear();
}
-} // namespace
-
void FastSaxParserImpl::deleteUsedEvents()
{
Entity& rEntity = getEntity();
@@ -1404,11 +1350,6 @@ FastSaxParser::~FastSaxParser()
delete mpImpl;
}
-uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames_Static()
-{
- return FastSaxParserImpl::getSupportedServiceNames_Static();
-}
-
void FastSaxParser::parseStream( const xml::sax::InputSource& aInputSource )
throw (xml::sax::SAXException, io::IOException, uno::RuntimeException)
{
@@ -1460,19 +1401,19 @@ void FastSaxParser::setLocale( const lang::Locale& rLocale )
OUString FastSaxParser::getImplementationName()
throw (uno::RuntimeException)
{
- return mpImpl->getImplementationName();
+ return OUString("com.sun.star.comp.extensions.xml.sax.FastParser");
}
sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
throw (uno::RuntimeException)
{
- return mpImpl->supportsService(ServiceName);
+ return cppu::supportsService(this, ServiceName);
}
uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames()
throw (uno::RuntimeException)
{
- return mpImpl->getSupportedServiceNames();
+ return FastSaxParser_getSupportedServiceNames();
}
bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
@@ -1482,12 +1423,27 @@ bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
} // namespace sax_fastparser
-Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
+static Reference< XInterface > FastSaxParser_CreateInstance(
SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
throw(Exception)
{
- sax_fastparser::FastSaxParser *p = new sax_fastparser::FastSaxParser;
+ FastSaxParser *p = new FastSaxParser;
return Reference< XInterface > ( (OWeakObject * ) p );
}
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory(
+ const char * , void *pServiceManager, void * )
+{
+ Reference< XSingleServiceFactory > xFactory;
+ Reference< XMultiServiceFactory > xSMgr =
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager );
+ xFactory = createSingleFactory( xSMgr,
+ "com.sun.star.comp.extensions.xml.sax.FastParser",
+ FastSaxParser_CreateInstance,
+ FastSaxParser_getSupportedServiceNames() );
+ xFactory->acquire();
+ return xFactory.get();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx
index fff579fc4e0c..bfcf4eefdc63 100644
--- a/sax/test/sax/testsax.cxx
+++ b/sax/test/sax/testsax.cxx
@@ -42,8 +42,6 @@ using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::xml::sax;
-#include "factory.hxx"
-
// test szenarios
namespace sax_test {
diff --git a/sax/test/sax/testwriter.cxx b/sax/test/sax/testwriter.cxx
index a6a2986e40e1..24c9258004d5 100644
--- a/sax/test/sax/testwriter.cxx
+++ b/sax/test/sax/testwriter.cxx
@@ -45,8 +45,6 @@ using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::xml::sax;
-#include "factory.hxx"
-
namespace sax_test {
class OFileWriter :