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:
parent
332e805dad
commit
d1038da54d
@ -1,9 +1,6 @@
|
||||
---
|
||||
assumeFilename: io/source/services.cxx
|
||||
excludelist:
|
||||
io/source/acceptor/acceptor.cxx:
|
||||
# Avoid loplugin:unreffun error
|
||||
- services.hxx
|
||||
io/source/connector/connector.hxx:
|
||||
# Base class needs full type
|
||||
- com/sun/star/connection/XConnection.hpp
|
||||
@ -11,26 +8,6 @@ excludelist:
|
||||
# Don't replace with impl. detail
|
||||
- osl/socket.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:
|
||||
# Avoid loplugin:unreffun error
|
||||
- services.hxx
|
||||
# Don't replace with URE API impl. detail
|
||||
- cppuhelper/interfacecontainer.hxx
|
||||
io/source/stm/omark.cxx:
|
||||
# Avoid loplugin:unreffun error
|
||||
- services.hxx
|
||||
|
@ -28,7 +28,6 @@ $(eval $(call gb_Library_set_include,io,\
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,io,\
|
||||
io/source/services \
|
||||
io/source/acceptor/acc_pipe \
|
||||
io/source/acceptor/acc_socket \
|
||||
io/source/acceptor/acceptor \
|
||||
|
@ -32,8 +32,6 @@
|
||||
#include <com/sun/star/io/XTextInputStream2.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
|
||||
#include <services.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
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::io;
|
||||
|
||||
namespace io_TextInputStream
|
||||
{
|
||||
|
||||
// Implementation XTextInputStream
|
||||
|
||||
@ -380,27 +376,9 @@ Reference< XInputStream > OTextInputStream::getInputStream()
|
||||
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()
|
||||
{
|
||||
return TextInputStream_getImplementationName();
|
||||
return IMPLEMENTATION_NAME;
|
||||
}
|
||||
|
||||
sal_Bool OTextInputStream::supportsService(const OUString& ServiceName)
|
||||
@ -410,9 +388,15 @@ sal_Bool OTextInputStream::supportsService(const OUString& ServiceName)
|
||||
|
||||
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: */
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <com/sun/star/io/XTextOutputStream2.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
|
||||
#include <services.hxx>
|
||||
|
||||
namespace com::sun::star::uno { class XComponentContext; }
|
||||
|
||||
#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::io;
|
||||
|
||||
namespace io_TextOutputStream
|
||||
{
|
||||
|
||||
// Implementation XTextOutputStream
|
||||
|
||||
namespace {
|
||||
@ -220,28 +215,9 @@ Reference< XOutputStream > OTextOutputStream::getOutputStream()
|
||||
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()
|
||||
{
|
||||
return TextOutputStream_getImplementationName();
|
||||
return IMPLEMENTATION_NAME;
|
||||
}
|
||||
|
||||
sal_Bool OTextOutputStream::supportsService(const OUString& ServiceName)
|
||||
@ -251,10 +227,16 @@ sal_Bool OTextOutputStream::supportsService(const OUString& ServiceName)
|
||||
|
||||
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: */
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <services.hxx>
|
||||
#include "acceptor.hxx"
|
||||
#include <memory>
|
||||
|
||||
@ -44,9 +43,7 @@ using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::connection;
|
||||
|
||||
namespace io_acceptor
|
||||
{
|
||||
namespace {
|
||||
namespace {
|
||||
|
||||
class OAcceptor : public WeakImplHelper< XAcceptor, XServiceInfo >
|
||||
{
|
||||
@ -64,8 +61,8 @@ namespace io_acceptor
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<PipeAcceptor> m_pPipe;
|
||||
std::unique_ptr<SocketAcceptor> m_pSocket;
|
||||
std::unique_ptr<io_acceptor::PipeAcceptor> m_pPipe;
|
||||
std::unique_ptr<io_acceptor::SocketAcceptor> m_pSocket;
|
||||
Mutex m_mutex;
|
||||
OUString m_sLastDescription;
|
||||
bool m_bInAccept;
|
||||
@ -75,199 +72,185 @@ namespace io_acceptor
|
||||
Reference<XAcceptor> _xAcceptor;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
OAcceptor::OAcceptor( const Reference< XComponentContext > & xCtx )
|
||||
: m_bInAccept( false )
|
||||
, _xSMgr( xCtx->getServiceManager() )
|
||||
, _xCtx( xCtx )
|
||||
{}
|
||||
OAcceptor::OAcceptor( const Reference< XComponentContext > & xCtx )
|
||||
: m_bInAccept( false )
|
||||
, _xSMgr( xCtx->getServiceManager() )
|
||||
, _xCtx( xCtx )
|
||||
{}
|
||||
|
||||
OAcceptor::~OAcceptor()
|
||||
{
|
||||
m_pPipe.reset();
|
||||
}
|
||||
OAcceptor::~OAcceptor()
|
||||
{
|
||||
m_pPipe.reset();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct BeingInAccept
|
||||
{
|
||||
/// @throws AlreadyAcceptingException
|
||||
BeingInAccept( bool *pFlag,const OUString & sConnectionDescription )
|
||||
: 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 )
|
||||
namespace {
|
||||
struct BeingInAccept
|
||||
{
|
||||
/// @throws AlreadyAcceptingException
|
||||
BeingInAccept( bool *pFlag,const OUString & sConnectionDescription )
|
||||
: m_pFlag( pFlag )
|
||||
{
|
||||
// instantiate another acceptor for different ports
|
||||
throw ConnectionSetupException( "acceptor::accept called multiple times with different connection strings\n" );
|
||||
if( *m_pFlag )
|
||||
throw AlreadyAcceptingException( "AlreadyAcceptingException :" + sConnectionDescription );
|
||||
*m_pFlag = true;
|
||||
}
|
||||
|
||||
if( m_sLastDescription.isEmpty() )
|
||||
~BeingInAccept()
|
||||
{
|
||||
// setup the acceptor
|
||||
try
|
||||
*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
|
||||
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);
|
||||
if ( aDesc.getName() == "pipe" )
|
||||
OUString aName(
|
||||
aDesc.getParameter(
|
||||
"name"));
|
||||
|
||||
m_pPipe.reset(new io_acceptor::PipeAcceptor(aName, sConnectionDescription));
|
||||
|
||||
try
|
||||
{
|
||||
OUString aName(
|
||||
aDesc.getParameter(
|
||||
"name"));
|
||||
|
||||
m_pPipe.reset(new PipeAcceptor(aName, sConnectionDescription));
|
||||
|
||||
try
|
||||
{
|
||||
m_pPipe->init();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
{
|
||||
MutexGuard g( m_mutex );
|
||||
m_pPipe.reset();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
m_pPipe->init();
|
||||
}
|
||||
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();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
{
|
||||
MutexGuard g( m_mutex );
|
||||
m_pSocket.reset();
|
||||
}
|
||||
throw;
|
||||
MutexGuard g( m_mutex );
|
||||
m_pPipe.reset();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else if ( aDesc.getName() == "socket" )
|
||||
{
|
||||
OUString aHost;
|
||||
if (aDesc.hasParameter(
|
||||
"host"))
|
||||
aHost = aDesc.getParameter(
|
||||
"host");
|
||||
else
|
||||
{
|
||||
OUString delegatee = "com.sun.star.connection.Acceptor." + aDesc.getName();
|
||||
_xAcceptor.set(_xSMgr->createInstanceWithContext(delegatee, _xCtx), UNO_QUERY);
|
||||
aHost = "localhost";
|
||||
sal_uInt16 nPort = static_cast< sal_uInt16 >(
|
||||
aDesc.getParameter(
|
||||
"port").
|
||||
toInt32());
|
||||
bool bTcpNoDelay
|
||||
= aDesc.getParameter(
|
||||
"tcpnodelay").toInt32() != 0;
|
||||
|
||||
if(!_xAcceptor.is())
|
||||
throw ConnectionSetupException("Acceptor: unknown delegatee " + delegatee);
|
||||
m_pSocket.reset(new io_acceptor::SocketAcceptor(
|
||||
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(
|
||||
rEx.getMessage(),
|
||||
Reference< XInterface > (),
|
||||
0 );
|
||||
OUString delegatee = "com.sun.star.connection.Acceptor." + aDesc.getName();
|
||||
_xAcceptor.set(_xSMgr->createInstanceWithContext(delegatee, _xCtx), UNO_QUERY);
|
||||
|
||||
if(!_xAcceptor.is())
|
||||
throw ConnectionSetupException("Acceptor: unknown delegatee " + delegatee);
|
||||
}
|
||||
m_sLastDescription = sConnectionDescription;
|
||||
}
|
||||
|
||||
if( m_pPipe )
|
||||
catch (const rtl::MalformedUriException & rEx)
|
||||
{
|
||||
r = m_pPipe->accept();
|
||||
throw IllegalArgumentException(
|
||||
rEx.getMessage(),
|
||||
Reference< XInterface > (),
|
||||
0 );
|
||||
}
|
||||
else if( m_pSocket )
|
||||
{
|
||||
r = m_pSocket->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
r = _xAcceptor->accept(sConnectionDescription);
|
||||
}
|
||||
|
||||
return r;
|
||||
m_sLastDescription = sConnectionDescription;
|
||||
}
|
||||
|
||||
void SAL_CALL OAcceptor::stopAccepting( )
|
||||
if( m_pPipe )
|
||||
{
|
||||
MutexGuard guard( m_mutex );
|
||||
|
||||
if( m_pPipe )
|
||||
{
|
||||
m_pPipe->stopAccepting();
|
||||
}
|
||||
else if ( m_pSocket )
|
||||
{
|
||||
m_pSocket->stopAccepting();
|
||||
}
|
||||
else if( _xAcceptor.is() )
|
||||
{
|
||||
_xAcceptor->stopAccepting();
|
||||
}
|
||||
|
||||
r = m_pPipe->accept();
|
||||
}
|
||||
|
||||
OUString acceptor_getImplementationName()
|
||||
else if( m_pSocket )
|
||||
{
|
||||
return IMPLEMENTATION_NAME;
|
||||
r = m_pSocket->accept();
|
||||
}
|
||||
|
||||
Reference< XInterface > acceptor_CreateInstance( const Reference< XComponentContext > & xCtx)
|
||||
else
|
||||
{
|
||||
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 };
|
||||
return seqNames;
|
||||
m_pPipe->stopAccepting();
|
||||
}
|
||||
|
||||
OUString OAcceptor::getImplementationName()
|
||||
else if ( m_pSocket )
|
||||
{
|
||||
return acceptor_getImplementationName();
|
||||
m_pSocket->stopAccepting();
|
||||
}
|
||||
|
||||
sal_Bool OAcceptor::supportsService(const OUString& ServiceName)
|
||||
else if( _xAcceptor.is() )
|
||||
{
|
||||
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: */
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <com/sun/star/connection/XConnector.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <services.hxx>
|
||||
#include "connector.hxx"
|
||||
|
||||
#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::connection;
|
||||
|
||||
namespace stoc_connector
|
||||
{
|
||||
namespace {
|
||||
namespace {
|
||||
|
||||
class OConnector : public WeakImplHelper< XConnector, XServiceInfo >
|
||||
{
|
||||
@ -64,128 +61,119 @@ namespace stoc_connector
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
OConnector::OConnector(const Reference< XComponentContext > &xCtx)
|
||||
: _xSMgr( xCtx->getServiceManager() )
|
||||
, _xCtx( xCtx )
|
||||
{}
|
||||
OConnector::OConnector(const Reference< XComponentContext > &xCtx)
|
||||
: _xSMgr( xCtx->getServiceManager() )
|
||||
, _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
|
||||
try
|
||||
cppu::UnoUrlDescriptor aDesc(sConnectionDescription);
|
||||
|
||||
Reference< XConnection > r;
|
||||
if ( aDesc.getName() == "pipe" )
|
||||
{
|
||||
cppu::UnoUrlDescriptor aDesc(sConnectionDescription);
|
||||
OUString aName(aDesc.getParameter("name"));
|
||||
|
||||
Reference< XConnection > r;
|
||||
if ( aDesc.getName() == "pipe" )
|
||||
std::unique_ptr<stoc_connector::PipeConnection> pConn(new stoc_connector::PipeConnection( sConnectionDescription ));
|
||||
|
||||
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()) );
|
||||
}
|
||||
else
|
||||
{
|
||||
OUString delegatee= "com.sun.star.connection.Connector." + aDesc.getName();
|
||||
|
||||
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());
|
||||
OUString const sMessage(
|
||||
"Connector : couldn't connect to pipe \"" + aName + "\": "
|
||||
+ OUString::number(pConn->m_pipe.getError()));
|
||||
SAL_WARN("io.connector", sMessage);
|
||||
throw NoConnectException( sMessage );
|
||||
}
|
||||
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 };
|
||||
return seqNames;
|
||||
throw ConnectionSetupException(rEx.getMessage());
|
||||
}
|
||||
|
||||
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: */
|
||||
|
@ -18,41 +18,53 @@
|
||||
-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||
prefix="io" xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.io.Pump">
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.comp.io.Pump"
|
||||
constructor="io_Pump_get_implementation">
|
||||
<service name="com.sun.star.io.Pump"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
@ -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: */
|
@ -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: */
|
@ -45,8 +45,6 @@ using namespace ::com::sun::star::io;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::lang;
|
||||
|
||||
#include <services.hxx>
|
||||
|
||||
namespace io_stm {
|
||||
|
||||
namespace {
|
||||
@ -392,7 +390,7 @@ Reference < XConnectable > ODataInputStream::getPredecessor()
|
||||
// XServiceInfo
|
||||
OUString ODataInputStream::getImplementationName()
|
||||
{
|
||||
return ODataInputStream_getImplementationName();
|
||||
return "com.sun.star.comp.io.stm.DataInputStream";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -404,32 +402,14 @@ sal_Bool ODataInputStream::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
Sequence< OUString > ODataInputStream::getSupportedServiceNames()
|
||||
{
|
||||
return ODataInputStream_getSupportedServiceNames();
|
||||
return { "com.sun.star.io.DataInputStream" };
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* registration information
|
||||
*
|
||||
*
|
||||
****/
|
||||
|
||||
Reference< XInterface > ODataInputStream_CreateInstance(
|
||||
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
io_ODataInputStream_get_implementation(
|
||||
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
ODataInputStream *p = 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;
|
||||
return cppu::acquire(new ODataInputStream());
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -704,7 +684,7 @@ Reference < XConnectable > ODataOutputStream::getPredecessor()
|
||||
// XServiceInfo
|
||||
OUString ODataOutputStream::getImplementationName()
|
||||
{
|
||||
return ODataOutputStream_getImplementationName();
|
||||
return "com.sun.star.comp.io.stm.DataOutputStream";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -716,27 +696,14 @@ sal_Bool ODataOutputStream::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
Sequence< OUString > ODataOutputStream::getSupportedServiceNames()
|
||||
{
|
||||
return ODataOutputStream_getSupportedServiceNames();
|
||||
return { "com.sun.star.io.DataOutputStream" };
|
||||
}
|
||||
|
||||
Reference< XInterface > ODataOutputStream_CreateInstance(
|
||||
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
io_ODataOutputStream_get_implementation(
|
||||
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
ODataOutputStream *p = 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;
|
||||
return cppu::acquire(new ODataOutputStream());
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -974,29 +941,10 @@ sal_Int32 OObjectOutputStream::offsetToMark(sal_Int32 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
|
||||
OUString OObjectOutputStream::getImplementationName()
|
||||
{
|
||||
return OObjectOutputStream_getImplementationName();
|
||||
return "com.sun.star.comp.io.stm.ObjectOutputStream";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -1008,7 +956,14 @@ sal_Bool OObjectOutputStream::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
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 {
|
||||
@ -1247,7 +1202,7 @@ sal_Int32 OObjectInputStream::offsetToMark(sal_Int32 nMark)
|
||||
// XServiceInfo
|
||||
OUString OObjectInputStream::getImplementationName()
|
||||
{
|
||||
return OObjectInputStream_getImplementationName();
|
||||
return "com.sun.star.comp.io.stm.ObjectInputStream";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -1259,26 +1214,17 @@ sal_Bool OObjectInputStream::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
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 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;
|
||||
return cppu::acquire(new OObjectInputStream(context));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <com/sun/star/io/XConnectable.hpp>
|
||||
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <cppuhelper/weak.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::lang;
|
||||
|
||||
#include <services.hxx>
|
||||
#include "streamhelper.hxx"
|
||||
|
||||
namespace io_stm {
|
||||
@ -345,7 +345,7 @@ void OMarkableOutputStream::checkMarksAndFlush()
|
||||
// XServiceInfo
|
||||
OUString OMarkableOutputStream::getImplementationName()
|
||||
{
|
||||
return OMarkableOutputStream_getImplementationName();
|
||||
return "com.sun.star.comp.io.stm.MarkableOutputStream";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -357,32 +357,14 @@ sal_Bool OMarkableOutputStream::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
Sequence< OUString > OMarkableOutputStream::getSupportedServiceNames()
|
||||
{
|
||||
return OMarkableOutputStream_getSupportedServiceNames();
|
||||
return { "com.sun.star.io.MarkableOutputStream" };
|
||||
}
|
||||
|
||||
/*------------------------
|
||||
*
|
||||
* external binding
|
||||
*
|
||||
*------------------------*/
|
||||
Reference< XInterface > OMarkableOutputStream_CreateInstance(
|
||||
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
io_OMarkableOutputStream_get_implementation(
|
||||
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
OMarkableOutputStream *p = 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;
|
||||
return cppu::acquire(new OMarkableOutputStream());
|
||||
}
|
||||
|
||||
|
||||
@ -758,7 +740,7 @@ void OMarkableInputStream::checkMarksAndFlush()
|
||||
// XServiceInfo
|
||||
OUString OMarkableInputStream::getImplementationName()
|
||||
{
|
||||
return OMarkableInputStream_getImplementationName();
|
||||
return "com.sun.star.comp.io.stm.MarkableInputStream";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -770,30 +752,14 @@ sal_Bool OMarkableInputStream::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
Sequence< OUString > OMarkableInputStream::getSupportedServiceNames()
|
||||
{
|
||||
return OMarkableInputStream_getSupportedServiceNames();
|
||||
return { "com.sun.star.io.MarkableInputStream" };
|
||||
}
|
||||
|
||||
/*------------------------
|
||||
*
|
||||
* external binding
|
||||
*
|
||||
*------------------------*/
|
||||
Reference < XInterface > OMarkableInputStream_CreateInstance(
|
||||
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
io_OMarkableInputStream_get_implementation(
|
||||
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
OMarkableInputStream *p = 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;
|
||||
return cppu::acquire(new OMarkableInputStream());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::io;
|
||||
using namespace ::com::sun::star::lang;
|
||||
|
||||
#include <services.hxx>
|
||||
#include "streamhelper.hxx"
|
||||
|
||||
namespace com::sun::star::uno { class XComponentContext; }
|
||||
@ -334,7 +333,7 @@ Reference < XConnectable > OPipeImpl::getPredecessor()
|
||||
// XServiceInfo
|
||||
OUString OPipeImpl::getImplementationName()
|
||||
{
|
||||
return OPipeImpl_getImplementationName();
|
||||
return IMPLEMENTATION_NAME;
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -346,35 +345,16 @@ sal_Bool OPipeImpl::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
Sequence< OUString > OPipeImpl::getSupportedServiceNames()
|
||||
{
|
||||
return OPipeImpl_getSupportedServiceNames();
|
||||
return { "com.sun.star.io.Pipe" };
|
||||
}
|
||||
|
||||
/* implementation functions
|
||||
*
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Reference < XInterface > OPipeImpl_CreateInstance(
|
||||
SAL_UNUSED_PARAMETER const Reference < XComponentContext > & )
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
io_OPipeImpl_get_implementation(
|
||||
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
OPipeImpl *p = new OPipeImpl;
|
||||
|
||||
return Reference < XInterface > ( static_cast< OWeakObject * >(p) );
|
||||
return cppu::acquire(new io_stm::OPipeImpl());
|
||||
}
|
||||
|
||||
|
||||
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: */
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <com/sun/star/io/XActiveDataControl.hpp>
|
||||
#include <com/sun/star/io/XConnectable.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <cppuhelper/implbase.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::io;
|
||||
|
||||
#include <services.hxx>
|
||||
|
||||
namespace io_stm {
|
||||
|
||||
namespace {
|
||||
@ -421,7 +420,7 @@ Reference< XOutputStream > Pump::getOutputStream()
|
||||
// XServiceInfo
|
||||
OUString Pump::getImplementationName()
|
||||
{
|
||||
return OPumpImpl_getImplementationName();
|
||||
return "com.sun.star.comp.io.Pump";
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
@ -433,26 +432,17 @@ sal_Bool Pump::supportsService(const OUString& ServiceName)
|
||||
// XServiceInfo
|
||||
Sequence< OUString > Pump::getSupportedServiceNames()
|
||||
{
|
||||
return OPumpImpl_getSupportedServiceNames();
|
||||
return { "com.sun.star.io.Pump" };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference< XInterface > OPumpImpl_CreateInstance(
|
||||
SAL_UNUSED_PARAMETER const Reference< XComponentContext > & )
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
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: */
|
||||
|
Loading…
x
Reference in New Issue
Block a user