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

A wrapper for a binary output stream that supports aligned write operations. More...

#include <axbinarywriter.hxx>

Inheritance diagram for oox::ole::AxAlignedOutputStream:
[legend]
Collaboration diagram for oox::ole::AxAlignedOutputStream:
[legend]

Public Member Functions

 AxAlignedOutputStream (BinaryOutputStream &rOutStrm)
 
virtual sal_Int64 size () const override
 Returns the size of the data this stream represents, if the wrapped stream supports the size() operation. More...
 
virtual sal_Int64 tell () const override
 Return the current relative stream position (relative to position of the wrapped stream at construction time). More...
 
virtual void seek (sal_Int64 nPos) override
 Seeks the stream to the passed relative position, if it is behind the current position. More...
 
virtual void close () override
 Closes the input stream but not the wrapped stream. More...
 
virtual void writeData (const StreamDataSequence &orData, size_t nAtomSize=1) override
 Reads nBytes bytes to the passed sequence. More...
 
virtual void writeMemory (const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1) override
 Reads nBytes bytes to the (existing) buffer opMem. More...
 
void align (size_t nSize)
 Aligns the stream to a multiple of the passed size (relative to the position of the wrapped stream at construction time). More...
 
void pad (sal_Int32 nBytes)
 
template<typename Type >
void writeAligned (Type nVal)
 Aligns the stream according to the passed type and reads a value. 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

BinaryOutputStreammpOutStrm
 The wrapped input stream. More...
 
sal_Int64 mnStrmPos
 Tracks relative position in the stream. More...
 
sal_Int64 mnStrmSize
 Size of the wrapped stream data. More...
 
sal_Int64 mnWrappedBeginPos
 starting pos or wrapped stream 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

A wrapper for a binary output stream that supports aligned write operations.

The implementation does support seeking back the wrapped stream. All seeking operations (tell, seekTo, align) are performed relative to the position of the wrapped stream at construction time of this wrapper. Unlike it's reader class counterpart it is NOT possible to construct this wrapper with an unseekable output stream.

Definition at line 33 of file axbinarywriter.hxx.

Constructor & Destructor Documentation

◆ AxAlignedOutputStream()

oox::ole::AxAlignedOutputStream::AxAlignedOutputStream ( BinaryOutputStream rOutStrm)
explicit

Member Function Documentation

◆ align()

void oox::ole::AxAlignedOutputStream::align ( size_t  nSize)

Aligns the stream to a multiple of the passed size (relative to the position of the wrapped stream at construction time).

Definition at line 79 of file axbinarywriter.cxx.

References mnStrmPos, and pad().

Referenced by oox::ole::AxBinaryPropertyWriter::finalizeExport(), and writeAligned().

◆ close()

void oox::ole::AxAlignedOutputStream::close ( )
overridevirtual

Closes the input stream but not the wrapped stream.

Implements oox::BinaryStreamBase.

Definition at line 49 of file axbinarywriter.cxx.

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

◆ pad()

void oox::ole::AxAlignedOutputStream::pad ( sal_Int32  nBytes)

◆ seek()

void oox::ole::AxAlignedOutputStream::seek ( sal_Int64  nPos)
overridevirtual

Seeks the stream to the passed relative position, if it is behind the current position.

Implements oox::BinaryStreamBase.

Definition at line 39 of file axbinarywriter.cxx.

References oox::BinaryStreamBase::mbEof, mnStrmPos, mnWrappedBeginPos, mpOutStrm, nPos, oox::BinaryStreamBase::seek(), and oox::BinaryStreamBase::tell().

Referenced by oox::ole::AxBinaryPropertyWriter::finalizeExport().

◆ size()

sal_Int64 oox::ole::AxAlignedOutputStream::size ( ) const
overridevirtual

Returns the size of the data this stream represents, if the wrapped stream supports the size() operation.

Implements oox::BinaryStreamBase.

Definition at line 29 of file axbinarywriter.cxx.

References mnStrmSize, and mpOutStrm.

◆ tell()

sal_Int64 oox::ole::AxAlignedOutputStream::tell ( ) const
overridevirtual

Return the current relative stream position (relative to position of the wrapped stream at construction time).

Implements oox::BinaryStreamBase.

Definition at line 34 of file axbinarywriter.cxx.

References mnStrmPos, and mpOutStrm.

Referenced by oox::ole::AxBinaryPropertyWriter::AxBinaryPropertyWriter(), and oox::ole::AxBinaryPropertyWriter::finalizeExport().

◆ writeAligned()

template<typename Type >
void oox::ole::AxAlignedOutputStream::writeAligned ( Type  nVal)
inline

Aligns the stream according to the passed type and reads a value.

Definition at line 65 of file axbinarywriter.hxx.

References align(), and oox::BinaryOutputStream::writeValue().

Referenced by oox::ole::AxBinaryPropertyWriter::writeIntProperty(), and oox::ole::AxBinaryPropertyWriter::writeStringProperty().

◆ writeData()

void oox::ole::AxAlignedOutputStream::writeData ( const StreamDataSequence orData,
size_t  nAtomSize = 1 
)
overridevirtual

Reads nBytes bytes to the passed sequence.

Returns
Number of bytes really read.

Implements oox::BinaryOutputStream.

Definition at line 55 of file axbinarywriter.cxx.

References mnStrmPos, mnWrappedBeginPos, mpOutStrm, oox::BinaryStreamBase::tell(), and oox::BinaryOutputStream::writeData().

◆ writeMemory()

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

Reads nBytes bytes to the (existing) buffer opMem.

Returns
Number of bytes really read.

Implements oox::BinaryOutputStream.

Definition at line 61 of file axbinarywriter.cxx.

References mnStrmPos, mnWrappedBeginPos, mpOutStrm, oox::BinaryStreamBase::tell(), and oox::BinaryOutputStream::writeMemory().

Member Data Documentation

◆ mnStrmPos

sal_Int64 oox::ole::AxAlignedOutputStream::mnStrmPos
private

Tracks relative position in the stream.

Definition at line 69 of file axbinarywriter.hxx.

Referenced by align(), pad(), seek(), tell(), writeData(), and writeMemory().

◆ mnStrmSize

sal_Int64 oox::ole::AxAlignedOutputStream::mnStrmSize
private

Size of the wrapped stream data.

Definition at line 70 of file axbinarywriter.hxx.

Referenced by size().

◆ mnWrappedBeginPos

sal_Int64 oox::ole::AxAlignedOutputStream::mnWrappedBeginPos
private

starting pos or wrapped stream

Definition at line 71 of file axbinarywriter.hxx.

Referenced by pad(), seek(), writeData(), and writeMemory().

◆ mpOutStrm

BinaryOutputStream* oox::ole::AxAlignedOutputStream::mpOutStrm
private

The wrapped input stream.

Definition at line 68 of file axbinarywriter.hxx.

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


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