LibreOffice Module oox (master) 1
|
A wrapper for a binary output stream that supports aligned write operations. More...
#include <axbinarywriter.hxx>
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... | |
BinaryOutputStream & | WriteInt16 (sal_Int16 x) |
BinaryOutputStream & | WriteUInt16 (sal_uInt16 x) |
BinaryOutputStream & | WriteInt32 (sal_Int32 x) |
BinaryOutputStream & | WriteUInt32 (sal_uInt32 x) |
BinaryOutputStream & | WriteInt64 (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 | |
BinaryOutputStream * | mpOutStrm |
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... | |
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.
|
explicit |
Definition at line 19 of file axbinarywriter.cxx.
References oox::BinaryStreamBase::isEof(), and oox::BinaryStreamBase::mbEof.
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().
|
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.
void oox::ole::AxAlignedOutputStream::pad | ( | sal_Int32 | nBytes | ) |
Definition at line 67 of file axbinarywriter.cxx.
References aData, mnStrmPos, mnWrappedBeginPos, mpOutStrm, oox::BinaryStreamBase::tell(), and oox::BinaryOutputStream::writeData().
Referenced by align().
|
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().
|
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.
|
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().
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().
|
overridevirtual |
Reads nBytes bytes to the passed sequence.
Implements oox::BinaryOutputStream.
Definition at line 55 of file axbinarywriter.cxx.
References mnStrmPos, mnWrappedBeginPos, mpOutStrm, oox::BinaryStreamBase::tell(), and oox::BinaryOutputStream::writeData().
|
overridevirtual |
Reads nBytes bytes to the (existing) buffer opMem.
Implements oox::BinaryOutputStream.
Definition at line 61 of file axbinarywriter.cxx.
References mnStrmPos, mnWrappedBeginPos, mpOutStrm, oox::BinaryStreamBase::tell(), and oox::BinaryOutputStream::writeMemory().
|
private |
Tracks relative position in the stream.
Definition at line 69 of file axbinarywriter.hxx.
Referenced by align(), pad(), seek(), tell(), writeData(), and writeMemory().
|
private |
Size of the wrapped stream data.
Definition at line 70 of file axbinarywriter.hxx.
Referenced by size().
|
private |
starting pos or wrapped stream
Definition at line 71 of file axbinarywriter.hxx.
Referenced by pad(), seek(), writeData(), and writeMemory().
|
private |
The wrapped input stream.
Definition at line 68 of file axbinarywriter.hxx.
Referenced by close(), pad(), seek(), size(), tell(), writeData(), and writeMemory().