LibreOffice Module oox (master) 1
Public Member Functions | Private Attributes | List of all members
oox::SequenceOutputStream Class Referencefinal

Wraps a StreamDataSequence and provides convenient access functions. More...

#include <binaryoutputstream.hxx>

Inheritance diagram for oox::SequenceOutputStream:
[legend]
Collaboration diagram for oox::SequenceOutputStream:
[legend]

Public Member Functions

 SequenceOutputStream (StreamDataSequence &rData)
 Constructs the wrapper object for the passed data sequence. More...
 
virtual void writeData (const StreamDataSequence &rData, size_t nAtomSize=1) override
 Writes the passed data sequence. More...
 
virtual void writeMemory (const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1) override
 Write nBytes bytes from the (preallocated!) buffer pMem. More...
 
virtual sal_Int64 size () const override
 Returns the size of the wrapped data sequence. More...
 
virtual sal_Int64 tell () const override
 Returns the current stream position. More...
 
virtual void seek (sal_Int64 nPos) override
 Seeks the stream to the passed position. More...
 
virtual void close () override
 Releases the reference to the data sequence. More...
 
- Public Member Functions inherited from oox::BinaryOutputStream
virtual void writeData (const StreamDataSequence &rData, size_t nAtomSize=1)=0
 Derived classes implement writing the contents of the passed data sequence. More...
 
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. More...
 
template<typename Type >
void writeArray (Type *opnArray, sal_Int32 nElemCount)
 
template<typename Type >
void writeArray (const Type *opnArray, sal_Int32 nElemCount)
 
template<typename Type >
void writeValue (Type nValue)
 Writes a value to the stream and converts it to platform byte order. More...
 
BinaryOutputStreamWriteInt16 (sal_Int16 x)
 
BinaryOutputStreamWriteUInt16 (sal_uInt16 x)
 
BinaryOutputStreamWriteInt32 (sal_Int32 x)
 
BinaryOutputStreamWriteUInt32 (sal_uInt32 x)
 
BinaryOutputStreamWriteInt64 (sal_Int64 x)
 
void writeCompressedUnicodeArray (const OUString &rString, bool bCompressed)
 
void writeCharArrayUC (std::u16string_view rString, rtl_TextEncoding eTextEnc)
 
void writeUnicodeArray (const OUString &rString)
 
- Public Member Functions inherited from oox::BinaryStreamBase
virtual ~BinaryStreamBase ()
 
virtual sal_Int64 size () const =0
 Implementations return the size of the stream, if possible. More...
 
virtual sal_Int64 tell () const =0
 Implementations return the current stream position, if possible. More...
 
virtual void seek (sal_Int64 nPos)=0
 Implementations seek the stream to the passed position, if the stream is seekable. More...
 
virtual void close ()=0
 Implementations close the stream. More...
 
bool isSeekable () const
 Returns true, if the implementation supports the seek() operation. More...
 
bool isEof () const
 Returns true, if the stream position is invalid (EOF). More...
 
sal_Int64 getRemaining () const
 Returns the size of the remaining data available in the stream, if stream supports size() and tell(), otherwise -1. More...
 
void seekToStart ()
 Seeks the stream to the beginning, if stream is seekable. More...
 
void alignToBlock (sal_Int32 nBlockSize, sal_Int64 nAnchorPos)
 Seeks the stream forward to a position that is a multiple of the passed block size, if stream is seekable. More...
 

Private Attributes

StreamDataSequencempData
 Wrapped data sequence. More...
 
sal_Int32 mnPos
 Current position in the sequence. More...
 

Additional Inherited Members

- Protected Member Functions inherited from oox::BinaryOutputStream
 BinaryOutputStream ()
 This dummy default c'tor will never call the c'tor of the virtual base class BinaryStreamBase as this class cannot be instantiated directly. More...
 
- Protected Member Functions inherited from oox::BinaryStreamBase
 BinaryStreamBase (bool bSeekable)
 
- Protected Attributes inherited from oox::BinaryStreamBase
bool mbEof
 End of stream flag. More...
 

Detailed Description

Wraps a StreamDataSequence and provides convenient access functions.

The binary data in the stream is written in little-endian format. After construction, the stream points to the beginning of the passed data sequence. The data sequence is expanded automatically while writing to it.

Definition at line 171 of file binaryoutputstream.hxx.

Constructor & Destructor Documentation

◆ SequenceOutputStream()

oox::SequenceOutputStream::SequenceOutputStream ( StreamDataSequence rData)
explicit

Constructs the wrapper object for the passed data sequence.

Attention: \n
The passed data sequence MUST live at least as long as this stream wrapper. The data sequence MUST NOT be changed from outside as long as this stream wrapper is used to write to it.

Definition at line 132 of file binaryoutputstream.cxx.

Member Function Documentation

◆ close()

void oox::SequenceOutputStream::close ( )
overridevirtual

Releases the reference to the data sequence.

Implements oox::BinaryStreamBase.

Definition at line 175 of file binaryoutputstream.cxx.

References oox::BinaryStreamBase::mbEof, and mpData.

◆ seek()

void oox::SequenceOutputStream::seek ( sal_Int64  nPos)
overridevirtual

Seeks the stream to the passed position.

Implements oox::BinaryStreamBase.

Definition at line 166 of file binaryoutputstream.cxx.

References oox::BinaryStreamBase::mbEof, mnPos, mpData, and nPos.

◆ size()

sal_Int64 oox::SequenceOutputStream::size ( ) const
overridevirtual

Returns the size of the wrapped data sequence.

Implements oox::BinaryStreamBase.

Definition at line 156 of file binaryoutputstream.cxx.

References mpData.

◆ tell()

sal_Int64 oox::SequenceOutputStream::tell ( ) const
overridevirtual

Returns the current stream position.

Implements oox::BinaryStreamBase.

Definition at line 161 of file binaryoutputstream.cxx.

References mnPos, and mpData.

◆ writeData()

void oox::SequenceOutputStream::writeData ( const StreamDataSequence rData,
size_t  nAtomSize = 1 
)
overridevirtual

Writes the passed data sequence.

Implements oox::BinaryOutputStream.

Definition at line 139 of file binaryoutputstream.cxx.

References mpData, and writeMemory().

◆ writeMemory()

void oox::SequenceOutputStream::writeMemory ( const void *  pMem,
sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
overridevirtual

Write nBytes bytes from the (preallocated!) buffer pMem.

Implements oox::BinaryOutputStream.

Definition at line 145 of file binaryoutputstream.cxx.

References mnPos, and mpData.

Referenced by writeData().

Member Data Documentation

◆ mnPos

sal_Int32 oox::SequenceOutputStream::mnPos
private

Current position in the sequence.

Definition at line 200 of file binaryoutputstream.hxx.

Referenced by seek(), tell(), and writeMemory().

◆ mpData

StreamDataSequence* oox::SequenceOutputStream::mpData
private

Wrapped data sequence.

Definition at line 199 of file binaryoutputstream.hxx.

Referenced by close(), seek(), size(), tell(), writeData(), and writeMemory().


The documentation for this class was generated from the following files: