20#ifndef INCLUDED_OOX_HELPER_BINARYOUTPUTSTREAM_HXX
21#define INCLUDED_OOX_HELPER_BINARYOUTPUTSTREAM_HXX
26#include <com/sun/star/uno/Reference.hxx>
30#include <rtl/textenc.h>
31#include <rtl/ustring.hxx>
35 namespace io {
class XOutputStream; }
64 virtual void writeMemory(
const void* pMem, sal_Int32 nBytes,
size_t nAtomSize = 1 ) = 0;
66 template<
typename Type >
69 template<
typename Type >
75 template<
typename Type >
86 void writeCharArrayUC( std::u16string_view rString, rtl_TextEncoding eTextEnc );
100template<
typename Type >
103 sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0,
SAL_MAX_INT32 /
sizeof(
Type ) ) *
sizeof(
Type );
108template<
typename Type >
111 std::unique_ptr<Type[]> xArray(
new Type[nElemCount]);
112 std::uninitialized_copy(opnArray, opnArray + nElemCount, xArray.get());
116template<
typename Type >
142 const css::uno::Reference< css::io::XOutputStream >& rxOutStrm,
149 void close()
override;
152 virtual void writeData(
const StreamDataSequence& rData,
size_t nAtomSize = 1 )
override;
155 virtual void writeMemory(
const void* pMem, sal_Int32 nBytes,
size_t nAtomSize = 1 )
override;
159 css::uno::Reference< css::io::XOutputStream >
187 virtual void writeMemory(
const void* pMem, sal_Int32 nBytes,
size_t nAtomSize = 1 )
override;
190 virtual sal_Int64
size()
const override;
192 virtual sal_Int64
tell()
const override;
194 virtual void seek( sal_Int64
nPos )
override;
196 virtual void close()
override;
Interface for binary output stream classes.
void writeCharArrayUC(std::u16string_view rString, rtl_TextEncoding eTextEnc)
BinaryOutputStream & operator=(BinaryOutputStream const &)=delete
BinaryOutputStream(BinaryOutputStream const &)=delete
BinaryOutputStream()
This dummy default c'tor will never call the c'tor of the virtual base class BinaryStreamBase as this...
BinaryOutputStream & WriteUInt32(sal_uInt32 x)
virtual void writeMemory(const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1)=0
Derived classes implement writing the contents of the (preallocated!) memory buffer pMem.
BinaryOutputStream & WriteInt32(sal_Int32 x)
BinaryOutputStream & WriteInt16(sal_Int16 x)
BinaryOutputStream & WriteUInt16(sal_uInt16 x)
void writeCompressedUnicodeArray(const OUString &rString, bool bCompressed)
BinaryOutputStream & WriteInt64(sal_Int64 x)
virtual void writeData(const StreamDataSequence &rData, size_t nAtomSize=1)=0
Derived classes implement writing the contents of the passed data sequence.
void writeArray(Type *opnArray, sal_Int32 nElemCount)
void writeUnicodeArray(const OUString &rString)
void writeValue(Type nValue)
Writes a value to the stream and converts it to platform byte order.
Base class for binary stream classes.
Wraps a UNO output stream and provides convenient access functions.
StreamDataSequence maBuffer
Data buffer used in writeMemory() function.
css::uno::Reference< css::io::XOutputStream > mxOutStrm
Reference to the output stream.
bool mbAutoClose
True = automatically close stream on destruction.
Base class for binary input and output streams wrapping a UNO stream, seekable via the com....
static void convertLittleEndianArray(Type *, size_t)
static void convertLittleEndian(Type &)
Wraps a StreamDataSequence and provides convenient access functions.
virtual sal_Int64 tell() const override
Returns the current stream position.
StreamDataSequence * mpData
Wrapped data sequence.
virtual void close() override
Releases the reference to the data sequence.
SequenceOutputStream(StreamDataSequence &rData)
Constructs the wrapper object for the passed data sequence.
virtual sal_Int64 size() const override
Returns the size of the wrapped data sequence.
virtual void seek(sal_Int64 nPos) override
Seeks the stream to the passed position.
sal_Int32 mnPos
Current position in the sequence.
virtual void writeData(const StreamDataSequence &rData, size_t nAtomSize=1) override
Writes the passed data sequence.
virtual void writeMemory(const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1) override
Write nBytes bytes from the (preallocated!) buffer pMem.
css::uno::Sequence< sal_Int8 > StreamDataSequence