io: create instances with uno constructors

See tdf#74608 for motivation.

Change-Id: Ic5942f00147e4024ffc3d5880cf3c7462bcc14de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98678
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-07-13 20:00:37 +02:00 committed by Noel Grandin
parent 332e805dad
commit d1038da54d
13 changed files with 338 additions and 734 deletions

View File

@ -1,9 +1,6 @@
--- ---
assumeFilename: io/source/services.cxx assumeFilename: io/source/services.cxx
excludelist: excludelist:
io/source/acceptor/acceptor.cxx:
# Avoid loplugin:unreffun error
- services.hxx
io/source/connector/connector.hxx: io/source/connector/connector.hxx:
# Base class needs full type # Base class needs full type
- com/sun/star/connection/XConnection.hpp - com/sun/star/connection/XConnection.hpp
@ -11,26 +8,6 @@ excludelist:
# Don't replace with impl. detail # Don't replace with impl. detail
- osl/socket.hxx - osl/socket.hxx
- osl/pipe.hxx - osl/pipe.hxx
io/source/connector/connector.cxx:
# Avoid loplugin:unreffun error
- services.hxx
io/source/TextInputStream/TextInputStream.cxx:
# Avoid loplugin:unreffun error
- services.hxx
io/source/TextOutputStream/TextOutputStream.cxx:
# Avoid loplugin:unreffun error
- services.hxx
io/source/stm/odata.cxx:
# Avoid loplugin:unreffun error
- services.hxx
io/source/stm/opipe.cxx:
# Avoid loplugin:unreffun error
- services.hxx
io/source/stm/opump.cxx: io/source/stm/opump.cxx:
# Avoid loplugin:unreffun error
- services.hxx
# Don't replace with URE API impl. detail # Don't replace with URE API impl. detail
- cppuhelper/interfacecontainer.hxx - cppuhelper/interfacecontainer.hxx
io/source/stm/omark.cxx:
# Avoid loplugin:unreffun error
- services.hxx

View File

@ -28,7 +28,6 @@ $(eval $(call gb_Library_set_include,io,\
)) ))
$(eval $(call gb_Library_add_exception_objects,io,\ $(eval $(call gb_Library_add_exception_objects,io,\
io/source/services \
io/source/acceptor/acc_pipe \ io/source/acceptor/acc_pipe \
io/source/acceptor/acc_socket \ io/source/acceptor/acc_socket \
io/source/acceptor/acceptor \ io/source/acceptor/acceptor \

View File

@ -32,8 +32,6 @@
#include <com/sun/star/io/XTextInputStream2.hpp> #include <com/sun/star/io/XTextInputStream2.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <services.hxx>
#include <vector> #include <vector>
namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::uno { class XComponentContext; }
@ -47,8 +45,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io; using namespace ::com::sun::star::io;
namespace io_TextInputStream
{
// Implementation XTextInputStream // Implementation XTextInputStream
@ -380,27 +376,9 @@ Reference< XInputStream > OTextInputStream::getInputStream()
return mxStream; return mxStream;
} }
Reference< XInterface > TextInputStream_CreateInstance(
SAL_UNUSED_PARAMETER const Reference< XComponentContext > &)
{
return Reference < XInterface >( static_cast<OWeakObject *>(new OTextInputStream()) );
}
OUString TextInputStream_getImplementationName()
{
return IMPLEMENTATION_NAME;
}
Sequence< OUString > TextInputStream_getSupportedServiceNames()
{
Sequence< OUString > seqNames { SERVICE_NAME };
return seqNames;
}
OUString OTextInputStream::getImplementationName() OUString OTextInputStream::getImplementationName()
{ {
return TextInputStream_getImplementationName(); return IMPLEMENTATION_NAME;
} }
sal_Bool OTextInputStream::supportsService(const OUString& ServiceName) sal_Bool OTextInputStream::supportsService(const OUString& ServiceName)
@ -410,9 +388,15 @@ sal_Bool OTextInputStream::supportsService(const OUString& ServiceName)
Sequence< OUString > OTextInputStream::getSupportedServiceNames() Sequence< OUString > OTextInputStream::getSupportedServiceNames()
{ {
return TextInputStream_getSupportedServiceNames(); return { SERVICE_NAME };
} }
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
io_OTextInputStream_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new OTextInputStream());
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -29,8 +29,6 @@
#include <com/sun/star/io/XTextOutputStream2.hpp> #include <com/sun/star/io/XTextOutputStream2.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <services.hxx>
namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::uno { class XComponentContext; }
#define IMPLEMENTATION_NAME "com.sun.star.comp.io.TextOutputStream" #define IMPLEMENTATION_NAME "com.sun.star.comp.io.TextOutputStream"
@ -42,9 +40,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io; using namespace ::com::sun::star::io;
namespace io_TextOutputStream
{
// Implementation XTextOutputStream // Implementation XTextOutputStream
namespace { namespace {
@ -220,28 +215,9 @@ Reference< XOutputStream > OTextOutputStream::getOutputStream()
return mxStream; return mxStream;
} }
Reference< XInterface > TextOutputStream_CreateInstance(
SAL_UNUSED_PARAMETER const Reference< XComponentContext > &)
{
return Reference < XInterface >( static_cast<OWeakObject *>(new OTextOutputStream()) );
}
OUString TextOutputStream_getImplementationName()
{
return IMPLEMENTATION_NAME;
}
Sequence< OUString > TextOutputStream_getSupportedServiceNames()
{
Sequence< OUString > seqNames { SERVICE_NAME };
return seqNames;
}
OUString OTextOutputStream::getImplementationName() OUString OTextOutputStream::getImplementationName()
{ {
return TextOutputStream_getImplementationName(); return IMPLEMENTATION_NAME;
} }
sal_Bool OTextOutputStream::supportsService(const OUString& ServiceName) sal_Bool OTextOutputStream::supportsService(const OUString& ServiceName)
@ -251,10 +227,16 @@ sal_Bool OTextOutputStream::supportsService(const OUString& ServiceName)
Sequence< OUString > OTextOutputStream::getSupportedServiceNames() Sequence< OUString > OTextOutputStream::getSupportedServiceNames()
{ {
return TextOutputStream_getSupportedServiceNames(); return { SERVICE_NAME };
} }
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
io_OTextOutputStream_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new OTextOutputStream());
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -31,7 +31,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <services.hxx>
#include "acceptor.hxx" #include "acceptor.hxx"
#include <memory> #include <memory>
@ -44,9 +43,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::connection; using namespace ::com::sun::star::connection;
namespace io_acceptor namespace {
{
namespace {
class OAcceptor : public WeakImplHelper< XAcceptor, XServiceInfo > class OAcceptor : public WeakImplHelper< XAcceptor, XServiceInfo >
{ {
@ -64,8 +61,8 @@ namespace io_acceptor
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
private: private:
std::unique_ptr<PipeAcceptor> m_pPipe; std::unique_ptr<io_acceptor::PipeAcceptor> m_pPipe;
std::unique_ptr<SocketAcceptor> m_pSocket; std::unique_ptr<io_acceptor::SocketAcceptor> m_pSocket;
Mutex m_mutex; Mutex m_mutex;
OUString m_sLastDescription; OUString m_sLastDescription;
bool m_bInAccept; bool m_bInAccept;
@ -75,199 +72,185 @@ namespace io_acceptor
Reference<XAcceptor> _xAcceptor; Reference<XAcceptor> _xAcceptor;
}; };
} }
OAcceptor::OAcceptor( const Reference< XComponentContext > & xCtx ) OAcceptor::OAcceptor( const Reference< XComponentContext > & xCtx )
: m_bInAccept( false ) : m_bInAccept( false )
, _xSMgr( xCtx->getServiceManager() ) , _xSMgr( xCtx->getServiceManager() )
, _xCtx( xCtx ) , _xCtx( xCtx )
{} {}
OAcceptor::~OAcceptor() OAcceptor::~OAcceptor()
{ {
m_pPipe.reset(); m_pPipe.reset();
} }
namespace { namespace {
struct BeingInAccept
struct BeingInAccept {
{ /// @throws AlreadyAcceptingException
/// @throws AlreadyAcceptingException BeingInAccept( bool *pFlag,const OUString & sConnectionDescription )
BeingInAccept( bool *pFlag,const OUString & sConnectionDescription ) : m_pFlag( pFlag )
: m_pFlag( pFlag )
{
if( *m_pFlag )
throw AlreadyAcceptingException( "AlreadyAcceptingException :" + sConnectionDescription );
*m_pFlag = true;
}
~BeingInAccept()
{
*m_pFlag = false;
}
bool *m_pFlag;
};
}
Reference< XConnection > OAcceptor::accept( const OUString &sConnectionDescription )
{
// if there is a thread already accepting in this object, throw an exception.
struct BeingInAccept guard( &m_bInAccept, sConnectionDescription );
Reference< XConnection > r;
if( !m_sLastDescription.isEmpty() &&
m_sLastDescription != sConnectionDescription )
{ {
// instantiate another acceptor for different ports if( *m_pFlag )
throw ConnectionSetupException( "acceptor::accept called multiple times with different connection strings\n" ); throw AlreadyAcceptingException( "AlreadyAcceptingException :" + sConnectionDescription );
*m_pFlag = true;
} }
~BeingInAccept()
if( m_sLastDescription.isEmpty() )
{ {
// setup the acceptor *m_pFlag = false;
try }
bool *m_pFlag;
};
}
Reference< XConnection > OAcceptor::accept( const OUString &sConnectionDescription )
{
// if there is a thread already accepting in this object, throw an exception.
struct BeingInAccept guard( &m_bInAccept, sConnectionDescription );
Reference< XConnection > r;
if( !m_sLastDescription.isEmpty() &&
m_sLastDescription != sConnectionDescription )
{
// instantiate another acceptor for different ports
throw ConnectionSetupException( "acceptor::accept called multiple times with different connection strings\n" );
}
if( m_sLastDescription.isEmpty() )
{
// setup the acceptor
try
{
cppu::UnoUrlDescriptor aDesc(sConnectionDescription);
if ( aDesc.getName() == "pipe" )
{ {
cppu::UnoUrlDescriptor aDesc(sConnectionDescription); OUString aName(
if ( aDesc.getName() == "pipe" ) aDesc.getParameter(
"name"));
m_pPipe.reset(new io_acceptor::PipeAcceptor(aName, sConnectionDescription));
try
{ {
OUString aName( m_pPipe->init();
aDesc.getParameter(
"name"));
m_pPipe.reset(new PipeAcceptor(aName, sConnectionDescription));
try
{
m_pPipe->init();
}
catch( ... )
{
{
MutexGuard g( m_mutex );
m_pPipe.reset();
}
throw;
}
} }
else if ( aDesc.getName() == "socket" ) catch( ... )
{ {
OUString aHost;
if (aDesc.hasParameter(
"host"))
aHost = aDesc.getParameter(
"host");
else
aHost = "localhost";
sal_uInt16 nPort = static_cast< sal_uInt16 >(
aDesc.getParameter(
"port").
toInt32());
bool bTcpNoDelay
= aDesc.getParameter(
"tcpnodelay").toInt32() != 0;
m_pSocket.reset(new SocketAcceptor(
aHost, nPort, bTcpNoDelay, sConnectionDescription));
try
{ {
m_pSocket->init(); MutexGuard g( m_mutex );
} m_pPipe.reset();
catch( ... )
{
{
MutexGuard g( m_mutex );
m_pSocket.reset();
}
throw;
} }
throw;
} }
}
else if ( aDesc.getName() == "socket" )
{
OUString aHost;
if (aDesc.hasParameter(
"host"))
aHost = aDesc.getParameter(
"host");
else else
{ aHost = "localhost";
OUString delegatee = "com.sun.star.connection.Acceptor." + aDesc.getName(); sal_uInt16 nPort = static_cast< sal_uInt16 >(
_xAcceptor.set(_xSMgr->createInstanceWithContext(delegatee, _xCtx), UNO_QUERY); aDesc.getParameter(
"port").
toInt32());
bool bTcpNoDelay
= aDesc.getParameter(
"tcpnodelay").toInt32() != 0;
if(!_xAcceptor.is()) m_pSocket.reset(new io_acceptor::SocketAcceptor(
throw ConnectionSetupException("Acceptor: unknown delegatee " + delegatee); aHost, nPort, bTcpNoDelay, sConnectionDescription));
try
{
m_pSocket->init();
}
catch( ... )
{
{
MutexGuard g( m_mutex );
m_pSocket.reset();
}
throw;
} }
} }
catch (const rtl::MalformedUriException & rEx) else
{ {
throw IllegalArgumentException( OUString delegatee = "com.sun.star.connection.Acceptor." + aDesc.getName();
rEx.getMessage(), _xAcceptor.set(_xSMgr->createInstanceWithContext(delegatee, _xCtx), UNO_QUERY);
Reference< XInterface > (),
0 ); if(!_xAcceptor.is())
throw ConnectionSetupException("Acceptor: unknown delegatee " + delegatee);
} }
m_sLastDescription = sConnectionDescription;
} }
catch (const rtl::MalformedUriException & rEx)
if( m_pPipe )
{ {
r = m_pPipe->accept(); throw IllegalArgumentException(
rEx.getMessage(),
Reference< XInterface > (),
0 );
} }
else if( m_pSocket ) m_sLastDescription = sConnectionDescription;
{
r = m_pSocket->accept();
}
else
{
r = _xAcceptor->accept(sConnectionDescription);
}
return r;
} }
void SAL_CALL OAcceptor::stopAccepting( ) if( m_pPipe )
{ {
MutexGuard guard( m_mutex ); r = m_pPipe->accept();
if( m_pPipe )
{
m_pPipe->stopAccepting();
}
else if ( m_pSocket )
{
m_pSocket->stopAccepting();
}
else if( _xAcceptor.is() )
{
_xAcceptor->stopAccepting();
}
} }
else if( m_pSocket )
OUString acceptor_getImplementationName()
{ {
return IMPLEMENTATION_NAME; r = m_pSocket->accept();
} }
else
Reference< XInterface > acceptor_CreateInstance( const Reference< XComponentContext > & xCtx)
{ {
return Reference < XInterface >( static_cast<OWeakObject *>(new OAcceptor(xCtx)) ); r = _xAcceptor->accept(sConnectionDescription);
} }
Sequence< OUString > acceptor_getSupportedServiceNames() return r;
}
void SAL_CALL OAcceptor::stopAccepting( )
{
MutexGuard guard( m_mutex );
if( m_pPipe )
{ {
Sequence< OUString > seqNames { SERVICE_NAME }; m_pPipe->stopAccepting();
return seqNames;
} }
else if ( m_pSocket )
OUString OAcceptor::getImplementationName()
{ {
return acceptor_getImplementationName(); m_pSocket->stopAccepting();
} }
else if( _xAcceptor.is() )
sal_Bool OAcceptor::supportsService(const OUString& ServiceName)
{ {
return cppu::supportsService(this, ServiceName); _xAcceptor->stopAccepting();
} }
Sequence< OUString > OAcceptor::getSupportedServiceNames() }
{
return acceptor_getSupportedServiceNames(); OUString OAcceptor::getImplementationName()
} {
return IMPLEMENTATION_NAME;
}
sal_Bool OAcceptor::supportsService(const OUString& ServiceName)
{
return cppu::supportsService(this, ServiceName);
}
Sequence< OUString > OAcceptor::getSupportedServiceNames()
{
return { SERVICE_NAME };
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
io_OAcceptor_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new OAcceptor(context));
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -31,7 +31,6 @@
#include <com/sun/star/connection/XConnector.hpp> #include <com/sun/star/connection/XConnector.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <services.hxx>
#include "connector.hxx" #include "connector.hxx"
#define IMPLEMENTATION_NAME "com.sun.star.comp.io.Connector" #define IMPLEMENTATION_NAME "com.sun.star.comp.io.Connector"
@ -43,9 +42,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::connection; using namespace ::com::sun::star::connection;
namespace stoc_connector namespace {
{
namespace {
class OConnector : public WeakImplHelper< XConnector, XServiceInfo > class OConnector : public WeakImplHelper< XConnector, XServiceInfo >
{ {
@ -64,128 +61,119 @@ namespace stoc_connector
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
}; };
} }
OConnector::OConnector(const Reference< XComponentContext > &xCtx) OConnector::OConnector(const Reference< XComponentContext > &xCtx)
: _xSMgr( xCtx->getServiceManager() ) : _xSMgr( xCtx->getServiceManager() )
, _xCtx( xCtx ) , _xCtx( xCtx )
{} {}
Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnectionDescription ) Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnectionDescription )
{
// split string into tokens
try
{ {
// split string into tokens cppu::UnoUrlDescriptor aDesc(sConnectionDescription);
try
Reference< XConnection > r;
if ( aDesc.getName() == "pipe" )
{ {
cppu::UnoUrlDescriptor aDesc(sConnectionDescription); OUString aName(aDesc.getParameter("name"));
Reference< XConnection > r; std::unique_ptr<stoc_connector::PipeConnection> pConn(new stoc_connector::PipeConnection( sConnectionDescription ));
if ( aDesc.getName() == "pipe" )
if( pConn->m_pipe.create( aName.pData, osl_Pipe_OPEN, osl::Security() ) )
{ {
OUString aName(aDesc.getParameter("name"));
std::unique_ptr<PipeConnection> pConn(new PipeConnection( sConnectionDescription ));
if( pConn->m_pipe.create( aName.pData, osl_Pipe_OPEN, osl::Security() ) )
{
r.set( static_cast<XConnection *>(pConn.release()) );
}
else
{
OUString const sMessage(
"Connector : couldn't connect to pipe \"" + aName + "\": "
+ OUString::number(pConn->m_pipe.getError()));
SAL_WARN("io.connector", sMessage);
throw NoConnectException( sMessage );
}
}
else if ( aDesc.getName() == "socket" )
{
OUString aHost;
if (aDesc.hasParameter("host"))
aHost = aDesc.getParameter("host");
else
aHost = "localhost";
sal_uInt16 nPort = static_cast< sal_uInt16 >(
aDesc.getParameter("port").
toInt32());
bool bTcpNoDelay
= aDesc.getParameter("tcpnodelay").toInt32() != 0;
std::unique_ptr<SocketConnection> pConn(new SocketConnection( sConnectionDescription));
SocketAddr AddrTarget( aHost.pData, nPort );
if(pConn->m_socket.connect(AddrTarget) != osl_Socket_Ok)
{
OUString sMessage("Connector : couldn't connect to socket (");
OUString sError = pConn->m_socket.getErrorAsString();
sMessage += sError + ")";
throw NoConnectException( sMessage );
}
// we enable tcpNoDelay for loopback connections because
// it can make a significant speed difference on linux boxes.
if( bTcpNoDelay || aHost == "localhost" || aHost.startsWith("127.0.0.") )
{
sal_Int32 nTcpNoDelay = sal_Int32(true);
pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , &nTcpNoDelay,
sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp );
}
pConn->completeConnectionString();
r.set( static_cast<XConnection *>(pConn.release()) ); r.set( static_cast<XConnection *>(pConn.release()) );
} }
else else
{ {
OUString delegatee= "com.sun.star.connection.Connector." + aDesc.getName(); OUString const sMessage(
"Connector : couldn't connect to pipe \"" + aName + "\": "
Reference<XConnector> xConnector( + OUString::number(pConn->m_pipe.getError()));
_xSMgr->createInstanceWithContext(delegatee, _xCtx), UNO_QUERY ); SAL_WARN("io.connector", sMessage);
throw NoConnectException( sMessage );
if(!xConnector.is())
throw ConnectionSetupException("Connector: unknown delegatee " + delegatee);
sal_Int32 index = sConnectionDescription.indexOf(',');
r = xConnector->connect(sConnectionDescription.copy(index + 1).trim());
} }
return r;
} }
catch (const rtl::MalformedUriException & rEx) else if ( aDesc.getName() == "socket" )
{ {
throw ConnectionSetupException(rEx.getMessage()); OUString aHost;
if (aDesc.hasParameter("host"))
aHost = aDesc.getParameter("host");
else
aHost = "localhost";
sal_uInt16 nPort = static_cast< sal_uInt16 >(
aDesc.getParameter("port").
toInt32());
bool bTcpNoDelay
= aDesc.getParameter("tcpnodelay").toInt32() != 0;
std::unique_ptr<stoc_connector::SocketConnection> pConn(new stoc_connector::SocketConnection( sConnectionDescription));
SocketAddr AddrTarget( aHost.pData, nPort );
if(pConn->m_socket.connect(AddrTarget) != osl_Socket_Ok)
{
OUString sMessage("Connector : couldn't connect to socket (");
OUString sError = pConn->m_socket.getErrorAsString();
sMessage += sError + ")";
throw NoConnectException( sMessage );
}
// we enable tcpNoDelay for loopback connections because
// it can make a significant speed difference on linux boxes.
if( bTcpNoDelay || aHost == "localhost" || aHost.startsWith("127.0.0.") )
{
sal_Int32 nTcpNoDelay = sal_Int32(true);
pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , &nTcpNoDelay,
sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp );
}
pConn->completeConnectionString();
r.set( static_cast<XConnection *>(pConn.release()) );
} }
} else
{
OUString delegatee= "com.sun.star.connection.Connector." + aDesc.getName();
Sequence< OUString > connector_getSupportedServiceNames() Reference<XConnector> xConnector(
_xSMgr->createInstanceWithContext(delegatee, _xCtx), UNO_QUERY );
if(!xConnector.is())
throw ConnectionSetupException("Connector: unknown delegatee " + delegatee);
sal_Int32 index = sConnectionDescription.indexOf(',');
r = xConnector->connect(sConnectionDescription.copy(index + 1).trim());
}
return r;
}
catch (const rtl::MalformedUriException & rEx)
{ {
Sequence< OUString > seqNames { SERVICE_NAME }; throw ConnectionSetupException(rEx.getMessage());
return seqNames;
} }
OUString connector_getImplementationName()
{
return IMPLEMENTATION_NAME;
}
OUString OConnector::getImplementationName()
{
return connector_getImplementationName();
}
sal_Bool OConnector::supportsService(const OUString& ServiceName)
{
return cppu::supportsService(this, ServiceName);
}
Sequence< OUString > OConnector::getSupportedServiceNames()
{
return connector_getSupportedServiceNames();
}
Reference< XInterface > connector_CreateInstance( const Reference< XComponentContext > & xCtx)
{
return Reference < XInterface >( static_cast<OWeakObject *>(new OConnector(xCtx)) );
}
} }
OUString OConnector::getImplementationName()
{
return IMPLEMENTATION_NAME;
}
sal_Bool OConnector::supportsService(const OUString& ServiceName)
{
return cppu::supportsService(this, ServiceName);
}
Sequence< OUString > OConnector::getSupportedServiceNames()
{
return { SERVICE_NAME };
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
io_OConnector_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new OConnector(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -18,41 +18,53 @@
--> -->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="io" xmlns="http://openoffice.org/2010/uno-components"> xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.io.Pump"> <implementation name="com.sun.star.comp.io.Pump"
constructor="io_Pump_get_implementation">
<service name="com.sun.star.io.Pump"/> <service name="com.sun.star.io.Pump"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.DataInputStream"> <implementation name="com.sun.star.comp.io.stm.DataInputStream"
constructor="io_ODataInputStream_get_implementation">
<service name="com.sun.star.io.DataInputStream"/> <service name="com.sun.star.io.DataInputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.DataOutputStream"> <implementation name="com.sun.star.comp.io.stm.DataOutputStream"
constructor="io_ODataOutputStream_get_implementation">
<service name="com.sun.star.io.DataOutputStream"/> <service name="com.sun.star.io.DataOutputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.MarkableInputStream"> <implementation name="com.sun.star.comp.io.stm.MarkableInputStream"
constructor="io_OMarkableInputStream_get_implementation">
<service name="com.sun.star.io.MarkableInputStream"/> <service name="com.sun.star.io.MarkableInputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.MarkableOutputStream"> <implementation name="com.sun.star.comp.io.stm.MarkableOutputStream"
constructor="io_OMarkableOutputStream_get_implementation">
<service name="com.sun.star.io.MarkableOutputStream"/> <service name="com.sun.star.io.MarkableOutputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.ObjectInputStream"> <implementation name="com.sun.star.comp.io.stm.ObjectInputStream"
constructor="io_OObjectInputStream_get_implementation">
<service name="com.sun.star.io.ObjectInputStream"/> <service name="com.sun.star.io.ObjectInputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.ObjectOutputStream"> <implementation name="com.sun.star.comp.io.stm.ObjectOutputStream"
constructor="io_OObjectOutputStream_get_implementation">
<service name="com.sun.star.io.ObjectOutputStream"/> <service name="com.sun.star.io.ObjectOutputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.stm.Pipe"> <implementation name="com.sun.star.comp.io.stm.Pipe"
constructor="io_OPipeImpl_get_implementation">
<service name="com.sun.star.io.Pipe"/> <service name="com.sun.star.io.Pipe"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.Acceptor"> <implementation name="com.sun.star.comp.io.Acceptor"
constructor="io_OAcceptor_get_implementation">
<service name="com.sun.star.connection.Acceptor"/> <service name="com.sun.star.connection.Acceptor"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.Connector"> <implementation name="com.sun.star.comp.io.Connector"
constructor="io_OConnector_get_implementation">
<service name="com.sun.star.connection.Connector"/> <service name="com.sun.star.connection.Connector"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.TextInputStream"> <implementation name="com.sun.star.comp.io.TextInputStream"
constructor="io_OTextInputStream_get_implementation">
<service name="com.sun.star.io.TextInputStream"/> <service name="com.sun.star.io.TextInputStream"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.io.TextOutputStream"> <implementation name="com.sun.star.comp.io.TextOutputStream"
constructor="io_OTextOutputStream_get_implementation">
<service name="com.sun.star.io.TextOutputStream"/> <service name="com.sun.star.io.TextOutputStream"/>
</implementation> </implementation>
</component> </component>

View File

@ -1,101 +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 .
*/
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
#include "services.hxx"
using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
const struct ImplementationEntry g_entries[] =
{
{
io_acceptor::acceptor_CreateInstance, io_acceptor::acceptor_getImplementationName ,
io_acceptor::acceptor_getSupportedServiceNames, createSingleComponentFactory ,
nullptr, 0
},
{
stoc_connector::connector_CreateInstance, stoc_connector::connector_getImplementationName ,
stoc_connector::connector_getSupportedServiceNames, createSingleComponentFactory ,
nullptr, 0
},
{
io_stm::OPipeImpl_CreateInstance, io_stm::OPipeImpl_getImplementationName ,
io_stm::OPipeImpl_getSupportedServiceNames, createSingleComponentFactory ,
nullptr, 0
},
{
io_stm::OPumpImpl_CreateInstance, io_stm::OPumpImpl_getImplementationName ,
io_stm::OPumpImpl_getSupportedServiceNames, createSingleComponentFactory ,
nullptr, 0
},
{
io_stm::ODataInputStream_CreateInstance, io_stm::ODataInputStream_getImplementationName,
io_stm::ODataInputStream_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{
io_stm::ODataOutputStream_CreateInstance, io_stm::ODataOutputStream_getImplementationName,
io_stm::ODataOutputStream_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{
io_stm::OObjectInputStream_CreateInstance, io_stm::OObjectInputStream_getImplementationName,
io_stm::OObjectInputStream_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{
io_stm::OObjectOutputStream_CreateInstance, io_stm::OObjectOutputStream_getImplementationName,
io_stm::OObjectOutputStream_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{
io_stm::OMarkableInputStream_CreateInstance, io_stm::OMarkableInputStream_getImplementationName,
io_stm::OMarkableInputStream_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{
io_stm::OMarkableOutputStream_CreateInstance, io_stm::OMarkableOutputStream_getImplementationName,
io_stm::OMarkableOutputStream_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{
io_TextInputStream::TextInputStream_CreateInstance, io_TextInputStream::TextInputStream_getImplementationName ,
io_TextInputStream::TextInputStream_getSupportedServiceNames, createSingleComponentFactory ,
nullptr, 0
},
{
io_TextOutputStream::TextOutputStream_CreateInstance, io_TextOutputStream::TextOutputStream_getImplementationName ,
io_TextOutputStream::TextOutputStream_getSupportedServiceNames, createSingleComponentFactory ,
nullptr, 0
},
{nullptr, nullptr, nullptr, nullptr, nullptr, 0}
};
extern "C" SAL_DLLPUBLIC_EXPORT void * io_component_getFactory(
const char * pImplName, void * pServiceManager, void * pRegistryKey )
{
return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -1,102 +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 .
*/
#ifndef INCLUDED_IO_SOURCE_SERVICES_HXX
#define INCLUDED_IO_SOURCE_SERVICES_HXX
#include <sal/config.h>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
namespace com::sun::star::uno { class XComponentContext; }
using namespace ::com::sun::star::uno;
namespace io_acceptor{
Reference< XInterface > acceptor_CreateInstance( const Reference< XComponentContext > & xCtx);
OUString acceptor_getImplementationName();
Sequence< OUString > acceptor_getSupportedServiceNames();
}
namespace stoc_connector {
Reference< XInterface > connector_CreateInstance( const Reference< XComponentContext > & xCtx);
OUString connector_getImplementationName();
Sequence< OUString > connector_getSupportedServiceNames();
}
namespace io_TextInputStream {
Reference< XInterface > TextInputStream_CreateInstance(SAL_UNUSED_PARAMETER const Reference< XComponentContext > &);
OUString TextInputStream_getImplementationName();
Sequence< OUString > TextInputStream_getSupportedServiceNames();
}
namespace io_TextOutputStream {
Reference< XInterface > TextOutputStream_CreateInstance(SAL_UNUSED_PARAMETER const Reference< XComponentContext > &);
OUString TextOutputStream_getImplementationName();
Sequence< OUString > TextOutputStream_getSupportedServiceNames();
}
namespace io_stm {
/// @throws Exception
Reference< XInterface > OPipeImpl_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString OPipeImpl_getImplementationName();
Sequence<OUString> OPipeImpl_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > ODataInputStream_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString ODataInputStream_getImplementationName();
Sequence<OUString> ODataInputStream_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > ODataOutputStream_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString ODataOutputStream_getImplementationName();
Sequence<OUString> ODataOutputStream_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > OMarkableOutputStream_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString OMarkableOutputStream_getImplementationName();
Sequence<OUString> OMarkableOutputStream_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > OMarkableInputStream_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString OMarkableInputStream_getImplementationName() ;
Sequence<OUString> OMarkableInputStream_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > OObjectOutputStream_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString OObjectOutputStream_getImplementationName();
Sequence<OUString> OObjectOutputStream_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > OObjectInputStream_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString OObjectInputStream_getImplementationName() ;
Sequence<OUString> OObjectInputStream_getSupportedServiceNames();
/// @throws Exception
Reference< XInterface > OPumpImpl_CreateInstance( const Reference< XComponentContext > & rSMgr );
OUString OPumpImpl_getImplementationName();
Sequence<OUString> OPumpImpl_getSupportedServiceNames();
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -45,8 +45,6 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
#include <services.hxx>
namespace io_stm { namespace io_stm {
namespace { namespace {
@ -392,7 +390,7 @@ Reference < XConnectable > ODataInputStream::getPredecessor()
// XServiceInfo // XServiceInfo
OUString ODataInputStream::getImplementationName() OUString ODataInputStream::getImplementationName()
{ {
return ODataInputStream_getImplementationName(); return "com.sun.star.comp.io.stm.DataInputStream";
} }
// XServiceInfo // XServiceInfo
@ -404,32 +402,14 @@ sal_Bool ODataInputStream::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > ODataInputStream::getSupportedServiceNames() Sequence< OUString > ODataInputStream::getSupportedServiceNames()
{ {
return ODataInputStream_getSupportedServiceNames(); return { "com.sun.star.io.DataInputStream" };
} }
/*** extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
* io_ODataInputStream_get_implementation(
* registration information css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
*
*
****/
Reference< XInterface > ODataInputStream_CreateInstance(
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
{ {
ODataInputStream *p = new ODataInputStream; return cppu::acquire(new ODataInputStream());
return Reference< XInterface > ( static_cast<OWeakObject *>(p) );
}
OUString ODataInputStream_getImplementationName()
{
return "com.sun.star.comp.io.stm.DataInputStream";
}
Sequence<OUString> ODataInputStream_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.DataInputStream" };
return aRet;
} }
namespace { namespace {
@ -704,7 +684,7 @@ Reference < XConnectable > ODataOutputStream::getPredecessor()
// XServiceInfo // XServiceInfo
OUString ODataOutputStream::getImplementationName() OUString ODataOutputStream::getImplementationName()
{ {
return ODataOutputStream_getImplementationName(); return "com.sun.star.comp.io.stm.DataOutputStream";
} }
// XServiceInfo // XServiceInfo
@ -716,27 +696,14 @@ sal_Bool ODataOutputStream::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > ODataOutputStream::getSupportedServiceNames() Sequence< OUString > ODataOutputStream::getSupportedServiceNames()
{ {
return ODataOutputStream_getSupportedServiceNames(); return { "com.sun.star.io.DataOutputStream" };
} }
Reference< XInterface > ODataOutputStream_CreateInstance( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & ) io_ODataOutputStream_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{ {
ODataOutputStream *p = new ODataOutputStream; return cppu::acquire(new ODataOutputStream());
Reference< XInterface > xService = *p;
return xService;
}
OUString ODataOutputStream_getImplementationName()
{
return "com.sun.star.comp.io.stm.DataOutputStream";
}
Sequence<OUString> ODataOutputStream_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.DataOutputStream" };
return aRet;
} }
namespace { namespace {
@ -974,29 +941,10 @@ sal_Int32 OObjectOutputStream::offsetToMark(sal_Int32 nMark)
return m_rMarkable->offsetToMark( nMark ); return m_rMarkable->offsetToMark( nMark );
} }
Reference< XInterface > OObjectOutputStream_CreateInstance(
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
{
OObjectOutputStream *p = new OObjectOutputStream;
return Reference< XInterface > ( static_cast< OWeakObject * >(p) );
}
OUString OObjectOutputStream_getImplementationName()
{
return "com.sun.star.comp.io.stm.ObjectOutputStream";
}
Sequence<OUString> OObjectOutputStream_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.ObjectOutputStream" };
return aRet;
}
// XServiceInfo // XServiceInfo
OUString OObjectOutputStream::getImplementationName() OUString OObjectOutputStream::getImplementationName()
{ {
return OObjectOutputStream_getImplementationName(); return "com.sun.star.comp.io.stm.ObjectOutputStream";
} }
// XServiceInfo // XServiceInfo
@ -1008,7 +956,14 @@ sal_Bool OObjectOutputStream::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > OObjectOutputStream::getSupportedServiceNames() Sequence< OUString > OObjectOutputStream::getSupportedServiceNames()
{ {
return OObjectOutputStream_getSupportedServiceNames(); return { "com.sun.star.io.ObjectOutputStream" };
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
io_OObjectOutputStream_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new OObjectOutputStream());
} }
namespace { namespace {
@ -1247,7 +1202,7 @@ sal_Int32 OObjectInputStream::offsetToMark(sal_Int32 nMark)
// XServiceInfo // XServiceInfo
OUString OObjectInputStream::getImplementationName() OUString OObjectInputStream::getImplementationName()
{ {
return OObjectInputStream_getImplementationName(); return "com.sun.star.comp.io.stm.ObjectInputStream";
} }
// XServiceInfo // XServiceInfo
@ -1259,26 +1214,17 @@ sal_Bool OObjectInputStream::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > OObjectInputStream::getSupportedServiceNames() Sequence< OUString > OObjectInputStream::getSupportedServiceNames()
{ {
return OObjectInputStream_getSupportedServiceNames(); return { "com.sun.star.io.ObjectInputStream" };
} }
Reference< XInterface > OObjectInputStream_CreateInstance( const Reference < XComponentContext > & rCtx ) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
io_OObjectInputStream_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{ {
OObjectInputStream *p = new OObjectInputStream( rCtx ); return cppu::acquire(new OObjectInputStream(context));
return Reference< XInterface> ( static_cast< OWeakObject * >(p) );
}
OUString OObjectInputStream_getImplementationName()
{
return "com.sun.star.comp.io.stm.ObjectInputStream";
}
Sequence<OUString> OObjectInputStream_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.ObjectInputStream" };
return aRet;
} }
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -31,6 +31,7 @@
#include <com/sun/star/io/XConnectable.hpp> #include <com/sun/star/io/XConnectable.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
@ -47,7 +48,6 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
#include <services.hxx>
#include "streamhelper.hxx" #include "streamhelper.hxx"
namespace io_stm { namespace io_stm {
@ -345,7 +345,7 @@ void OMarkableOutputStream::checkMarksAndFlush()
// XServiceInfo // XServiceInfo
OUString OMarkableOutputStream::getImplementationName() OUString OMarkableOutputStream::getImplementationName()
{ {
return OMarkableOutputStream_getImplementationName(); return "com.sun.star.comp.io.stm.MarkableOutputStream";
} }
// XServiceInfo // XServiceInfo
@ -357,32 +357,14 @@ sal_Bool OMarkableOutputStream::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > OMarkableOutputStream::getSupportedServiceNames() Sequence< OUString > OMarkableOutputStream::getSupportedServiceNames()
{ {
return OMarkableOutputStream_getSupportedServiceNames(); return { "com.sun.star.io.MarkableOutputStream" };
} }
/*------------------------ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
* io_OMarkableOutputStream_get_implementation(
* external binding css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
*
*------------------------*/
Reference< XInterface > OMarkableOutputStream_CreateInstance(
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
{ {
OMarkableOutputStream *p = new OMarkableOutputStream( ); return cppu::acquire(new OMarkableOutputStream());
return Reference < XInterface > ( static_cast<OWeakObject *>(p) );
}
OUString OMarkableOutputStream_getImplementationName()
{
return "com.sun.star.comp.io.stm.MarkableOutputStream";
}
Sequence<OUString> OMarkableOutputStream_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.MarkableOutputStream" };
return aRet;
} }
@ -758,7 +740,7 @@ void OMarkableInputStream::checkMarksAndFlush()
// XServiceInfo // XServiceInfo
OUString OMarkableInputStream::getImplementationName() OUString OMarkableInputStream::getImplementationName()
{ {
return OMarkableInputStream_getImplementationName(); return "com.sun.star.comp.io.stm.MarkableInputStream";
} }
// XServiceInfo // XServiceInfo
@ -770,30 +752,14 @@ sal_Bool OMarkableInputStream::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > OMarkableInputStream::getSupportedServiceNames() Sequence< OUString > OMarkableInputStream::getSupportedServiceNames()
{ {
return OMarkableInputStream_getSupportedServiceNames(); return { "com.sun.star.io.MarkableInputStream" };
} }
/*------------------------ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
* io_OMarkableInputStream_get_implementation(
* external binding css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
*
*------------------------*/
Reference < XInterface > OMarkableInputStream_CreateInstance(
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
{ {
OMarkableInputStream *p = new OMarkableInputStream( ); return cppu::acquire(new OMarkableInputStream());
return Reference< XInterface > ( static_cast<OWeakObject *>(p) );
}
OUString OMarkableInputStream_getImplementationName()
{
return "com.sun.star.comp.io.stm.MarkableInputStream";
}
Sequence<OUString> OMarkableInputStream_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.MarkableInputStream" };
return aRet;
} }
} }

View File

@ -42,7 +42,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io; using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
#include <services.hxx>
#include "streamhelper.hxx" #include "streamhelper.hxx"
namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::uno { class XComponentContext; }
@ -334,7 +333,7 @@ Reference < XConnectable > OPipeImpl::getPredecessor()
// XServiceInfo // XServiceInfo
OUString OPipeImpl::getImplementationName() OUString OPipeImpl::getImplementationName()
{ {
return OPipeImpl_getImplementationName(); return IMPLEMENTATION_NAME;
} }
// XServiceInfo // XServiceInfo
@ -346,35 +345,16 @@ sal_Bool OPipeImpl::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > OPipeImpl::getSupportedServiceNames() Sequence< OUString > OPipeImpl::getSupportedServiceNames()
{ {
return OPipeImpl_getSupportedServiceNames(); return { "com.sun.star.io.Pipe" };
} }
/* implementation functions }
*
*
*/
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
Reference < XInterface > OPipeImpl_CreateInstance( io_OPipeImpl_get_implementation(
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & ) css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{ {
OPipeImpl *p = new OPipeImpl; return cppu::acquire(new io_stm::OPipeImpl());
return Reference < XInterface > ( static_cast< OWeakObject * >(p) );
} }
OUString OPipeImpl_getImplementationName()
{
return IMPLEMENTATION_NAME;
}
Sequence<OUString> OPipeImpl_getSupportedServiceNames()
{
Sequence<OUString> aRet { "com.sun.star.io.Pipe" };
return aRet;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -27,6 +27,7 @@
#include <com/sun/star/io/XActiveDataControl.hpp> #include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/io/XConnectable.hpp> #include <com/sun/star/io/XConnectable.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/interfacecontainer.hxx>
@ -42,8 +43,6 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang; using namespace com::sun::star::lang;
using namespace com::sun::star::io; using namespace com::sun::star::io;
#include <services.hxx>
namespace io_stm { namespace io_stm {
namespace { namespace {
@ -421,7 +420,7 @@ Reference< XOutputStream > Pump::getOutputStream()
// XServiceInfo // XServiceInfo
OUString Pump::getImplementationName() OUString Pump::getImplementationName()
{ {
return OPumpImpl_getImplementationName(); return "com.sun.star.comp.io.Pump";
} }
// XServiceInfo // XServiceInfo
@ -433,26 +432,17 @@ sal_Bool Pump::supportsService(const OUString& ServiceName)
// XServiceInfo // XServiceInfo
Sequence< OUString > Pump::getSupportedServiceNames() Sequence< OUString > Pump::getSupportedServiceNames()
{ {
return OPumpImpl_getSupportedServiceNames(); return { "com.sun.star.io.Pump" };
} }
}
Reference< XInterface > OPumpImpl_CreateInstance( extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
SAL_UNUSED_PARAMETER const Reference< XComponentContext > & ) io_Pump_get_implementation(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{ {
return Reference< XInterface >( *new Pump ); return cppu::acquire(new io_stm::Pump());
} }
OUString OPumpImpl_getImplementationName()
{
return "com.sun.star.comp.io.Pump";
}
Sequence<OUString> OPumpImpl_getSupportedServiceNames()
{
return Sequence< OUString > { "com.sun.star.io.Pump" };
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */