--- Begin Message ---
Hi Mikhail,
The attachment is the patches to udkapi and comphelper projects, the
compilation to udkapi, offapi, offuh, comphelper projects all passed,
and the application seems running fine after I delivered
comphelp4MSC.dll explicitly to the install directory. Could you help to
review them please?
This time I have some questions as well:
The first is about the ctor of SequenceOutputStream, I'm not sure if I
got your statement in our last IRC meeting, that the service constructor
should take sequence of bytes as output parameter, in the right way. At
first I declared the ctor as:
/_createStreamFromSequence( [out] sequence<byte> aData );
_/But then I was informed by the compiler that a parameter of a ctor may
*not* be /out /or /inout, /I modified it to:
/_createStreamFromSequence( [in] sequence<byte> aData );
_/then the compilation passed. However I don't know if this is
semantically correct. Could you please give me some instructions here?/_
_/
The second is about naming conventions on classes, I find sometimes a
class has an 'O' before its name, just like OSequenceOutputStream in
/compehelper/inc/seqstream.hxx, and OTempFileService in our first task,
too; but sometimes there isn't, like SequenceInputStream in
seqstream.hxx, what does the 'O' stand for and when is it appropriate to
have it?
Does it has something to do with the class deriving from a typedef-ed
base class, like OSequenceOutputStream_Base and OTempFileBase, I suppose?
Best Regards,
Felix.
diff -urNpw @udkapi/com/sun/star/io/SequenceOutputStream.idl
udkapi/com/sun/star/io/SequenceOutputStream.idl
--- @udkapi/com/sun/star/io/SequenceOutputStream.idl 1970-01-01
08:00:00.000000000 +0800
+++ udkapi/com/sun/star/io/SequenceOutputStream.idl 2007-09-11
13:23:06.000000000 +0800
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SequenceInputStream.idl,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2007/06/26 16:08:11 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_io_SequenceOutputStream_idl__
+#define __com_sun_star_io_SequenceOutputStream_idl__
+
+#ifndef __com_sun_star_io_XOutputStream_idl__
+#include <com/sun/star/io/XOutputStream.idl>
+#endif
+
+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+#endif
+
+
+//=============================================================================
+
+module com { module sun { module star { module io {
+
+//=============================================================================
+
+// DocMerge from xml: service com::sun::star::io::SequenceInputStream
+/** This service allows to wrap a sequence of bytes with a stream object.
+ */
+service SequenceOutputStream : XOutputStream
+{
+ /** allows to create a stream based on the sequence.
+ */
+ createStreamFromSequence( [in] sequence<byte> aData );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+/*=============================================================================
+
+=============================================================================*/
+#endif
diff -urNpw @udkapi/com/sun/star/io/makefile.mk
udkapi/com/sun/star/io/makefile.mk
--- @udkapi/com/sun/star/io/makefile.mk 2007-06-27 00:08:34.000000000 +0800
+++ udkapi/com/sun/star/io/makefile.mk 2007-09-11 13:18:42.000000000 +0800
@@ -61,6 +61,7 @@ IDLFILES=\
Pipe.idl\
Pump.idl\
SequenceInputStream.idl\
+ SequenceOutputStream.idl\
UnexpectedEOFException.idl\
WrongFormatException.idl\
XActiveDataControl.idl\
diff -urNpw @comphelper/source/streaming/makefile.mk
comphelper/source/streaming/makefile.mk
--- @comphelper/source/streaming/makefile.mk 2007-06-27 00:11:08.000000000
+0800
+++ comphelper/source/streaming/makefile.mk 2007-09-11 13:39:14.000000000
+0800
@@ -50,6 +50,7 @@ SLOFILES= $(SLO)$/basicio.obj \
$(SLO)$/oslfile2streamwrap.obj \
$(SLO)$/seqstream.obj \
$(SLO)$/seqinputstreamserv.obj \
+ $(SLO)$/seqoutputstreamserv.obj \
$(SLO)$/streamsection.obj \
$(SLO)$/seekableinput.obj \
$(SLO)$/otransactedfilestream.obj \
diff -urNpw @comphelper/source/streaming/seqoutputstreamserv.cxx
comphelper/source/streaming/seqoutputstreamserv.cxx
--- @comphelper/source/streaming/seqoutputstreamserv.cxx 1970-01-01
08:00:00.000000000 +0800
+++ comphelper/source/streaming/seqoutputstreamserv.cxx 2007-09-11
13:56:40.000000000 +0800
@@ -0,0 +1,200 @@
+/*************************************************************************
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: seqinputstreamserv.cxx,v $
+*
+* $Revision: 1.2 $
+*
+* last change: $Author: hr $ $Date: 2007/06/26 16:11:17 $
+*
+* The Contents of this file are made available subject to
+* the terms of GNU Lesser General Public License Version 2.1.
+*
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2005 by Sun Microsystems, Inc.
+* 901 San Antonio Road, Palo Alto, CA 94303, USA
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1, as published by the Free Software Foundation.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+* MA 02111-1307 USA
+*
+************************************************************************/
+
+#include "precompiled_comphelper.hxx"
+
+#include <sal/config.h>
+#include <osl/mutex.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/seqstream.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/DoubleInitializationException.hpp>
+
+using namespace ::com::sun::star;
+
+::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName();
+uno::Sequence< ::rtl::OUString > SAL_CALL
SequenceOutputStreamService_getSupportedServiceNames();
+uno::Reference< uno::XInterface > SAL_CALL
SequenceOutputStreamService_createInstance( const uno::Reference<
lang::XMultiServiceFactory > & xFactory ) SAL_THROW( (uno::Exception ) );
+
+
+namespace {
+
+class SequenceOutputStreamService:
+public ::cppu::WeakImplHelper3 <
+ lang::XServiceInfo,
+ io::XOutputStream,
+ lang::XInitialization >
+{
+public:
+ explicit SequenceOutputStreamService( uno::Reference<
lang::XMultiServiceFactory > const & xFactory );
+
+ // ::com::sun::star::lang::XServiceInfo:
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (
uno::RuntimeException );
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString &
ServiceName ) throw ( uno::RuntimeException );
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL
getSupportedServiceNames() throw ( uno::RuntimeException );
+
+ // ::com::sun::star::io::XOutputStream:
+ virtual void SAL_CALL writeBytes( const uno::Sequence< ::sal_Int8 > &
aData ) throw ( io::NotConnectedException, io::BufferSizeExceededException,
io::IOException, uno::RuntimeException );
+ virtual void SAL_CALL flush() throw ( uno::RuntimeException,
io::NotConnectedException, io::BufferSizeExceededException, io::IOException );
+ virtual void SAL_CALL closeOutput() throw ( uno::RuntimeException,
io::NotConnectedException, io::BufferSizeExceededException, io::IOException );
+
+ // ::com::sun::star::lang::XInitialization:
+ virtual void SAL_CALL initialize( const uno::Sequence<
::com::sun::star::uno::Any > & aArguments ) throw ( uno::RuntimeException,
uno::Exception );
+
+private:
+ SequenceOutputStreamService( SequenceOutputStreamService & ); //not defined
+ void operator =( SequenceOutputStreamService & ); //not defined
+
+ virtual ~SequenceOutputStreamService() {};
+
+
+ ::osl::Mutex m_aMutex;
+ uno::Reference< lang::XMultiServiceFactory > m_xFactory;
+ sal_Bool m_bInitialized;
+ uno::Reference< io::XOutputStream > m_xOutputStream;
+};
+
+SequenceOutputStreamService::SequenceOutputStreamService( uno::Reference<
lang::XMultiServiceFactory > const & xFactory )
+: m_xFactory( xFactory )
+, m_bInitialized( sal_False )
+{}
+
+// com.sun.star.uno.XServiceInfo:
+::rtl::OUString SAL_CALL SequenceOutputStreamService::getImplementationName()
throw ( uno::RuntimeException )
+{
+ return SequenceOutputStreamService_getImplementationName();
+}
+
+::sal_Bool SAL_CALL SequenceOutputStreamService::supportsService(
::rtl::OUString const & serviceName ) throw ( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > serviceNames =
SequenceOutputStreamService_getSupportedServiceNames();
+ for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) {
+ if ( serviceNames[i] == serviceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
SequenceOutputStreamService::getSupportedServiceNames() throw (
uno::RuntimeException )
+{
+ return SequenceOutputStreamService_getSupportedServiceNames();
+}
+
+// ::com::sun::star::io::XOutputStream:
+void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence<
::sal_Int8 > & aData ) throw ( uno::RuntimeException,
io::NotConnectedException, io::BufferSizeExceededException, io::IOException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xOutputStream.is() )
+ throw io::NotConnectedException();
+
+ m_xOutputStream->writeBytes( aData );
+}
+
+void SAL_CALL SequenceOutputStreamService::flush() throw (
uno::RuntimeException, io::NotConnectedException,
io::BufferSizeExceededException, io::IOException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xOutputStream.is() )
+ throw io::NotConnectedException();
+
+ m_xOutputStream->flush();
+};
+
+void SAL_CALL SequenceOutputStreamService::closeOutput() throw (
uno::RuntimeException, io::NotConnectedException,
io::BufferSizeExceededException, io::IOException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xOutputStream.is() )
+ throw io::NotConnectedException();
+
+ m_xOutputStream->closeOutput();
+ m_xOutputStream = uno::Reference< io::XOutputStream >();
+}
+
+// ::com::sun::star::lang::XInitialization:
+void SAL_CALL SequenceOutputStreamService::initialize( const uno::Sequence<
::com::sun::star::uno::Any > & aArguments )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_bInitialized )
+ throw frame::DoubleInitializationException();
+
+ if ( aArguments.getLength() != 1 )
+ throw lang::IllegalArgumentException(
::rtl::OUString::createFromAscii( "Wrong number of arguments!\n" ),
+ uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject*
>(this) ),
+ 1 );
+
+ uno::Sequence< sal_Int8 > aSeq;
+ if ( aArguments[0] >>= aSeq )
+ {
+ uno::Reference< io::XOutputStream > xOutputStream(
+ static_cast < ::cppu::OWeakObject* >( new
::comphelper::OSequenceOutputStream( aSeq ) ),
+ uno::UNO_QUERY_THROW );
+ m_xOutputStream = xOutputStream;
+ m_bInitialized = sal_True;
+ }
+ else
+ throw lang::IllegalArgumentException(
::rtl::OUString::createFromAscii( "Unexpected type of argument!\n" ),
+ uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject*
>(this) ),
+ 1 );
+}
+
+} // anonymous namespace
+
+::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName() {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.SequenceOutputStreamService" ) );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
SequenceOutputStreamService_getSupportedServiceNames()
+{
+ uno::Sequence< ::rtl::OUString > s( 1 );
+ s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.io.SequenceOutputStream" ) );
+ return s;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL
SequenceOutputStreamService_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & xFactory )
+ SAL_THROW( (uno::Exception ) )
+{
+ return static_cast< ::cppu::OWeakObject * >( new
SequenceOutputStreamService( xFactory ) );
+}
+
--- End Message ---