LibreOffice Module oox (master) 1
|
A wrapper for a binary input stream that supports aligned read operations. More...
#include <axbinaryreader.hxx>
Public Member Functions | |
AxAlignedInputStream (BinaryInputStream &rInStrm) | |
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 sal_Int32 | readData (StreamDataSequence &orData, sal_Int32 nBytes, size_t nAtomSize=1) override |
Reads nBytes bytes to the passed sequence. More... | |
virtual sal_Int32 | readMemory (void *opMem, sal_Int32 nBytes, size_t nAtomSize=1) override |
Reads nBytes bytes to the (existing) buffer opMem. More... | |
virtual void | skip (sal_Int32 nBytes, size_t nAtomSize=1) override |
Seeks the stream forward by the passed number of bytes. 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... | |
template<typename Type > | |
Type | readAligned () |
Aligns the stream according to the passed type and reads a value. More... | |
template<typename Type > | |
void | skipAligned () |
Aligns the stream according to the passed type and skips the size of the type. More... | |
Public Member Functions inherited from oox::BinaryInputStream | |
virtual sal_Int32 | readData (StreamDataSequence &orData, sal_Int32 nBytes, size_t nAtomSize=1)=0 |
Derived classes implement reading nBytes bytes to the passed sequence. More... | |
virtual sal_Int32 | readMemory (void *opMem, sal_Int32 nBytes, size_t nAtomSize=1)=0 |
Derived classes implement reading nBytes bytes to the (preallocated!) memory buffer opMem. More... | |
virtual void | skip (sal_Int32 nBytes, size_t nAtomSize=1)=0 |
Derived classes implement seeking the stream forward by the passed number of bytes. More... | |
template<typename Type > | |
Type | readValue () |
Reads a value from the stream and converts it to platform byte order. More... | |
sal_Int8 | readInt8 () |
sal_uInt8 | readuInt8 () |
sal_Int16 | readInt16 () |
sal_uInt16 | readuInt16 () |
sal_Int32 | readInt32 () |
sal_uInt32 | readuInt32 () |
sal_Int64 | readInt64 () |
float | readFloat () |
double | readDouble () |
unsigned char | readuChar () |
template<typename Type > | |
sal_Int32 | readArray (Type *opnArray, sal_Int32 nElemCount) |
Reads a (preallocated!) C array of values from the stream. More... | |
template<typename Type > | |
sal_Int32 | readArray (::std::vector< Type > &orVector, sal_Int32 nElemCount) |
Reads a vector of values from the stream. More... | |
OUString | readNulUnicodeArray () |
Reads a NUL-terminated Unicode character array and returns the string. More... | |
OString | readCharArray (sal_Int32 nChars) |
Reads a byte character array and returns the string. More... | |
OUString | readCharArrayUC (sal_Int32 nChars, rtl_TextEncoding eTextEnc) |
Reads a byte character array and returns a Unicode string. More... | |
OUString | readUnicodeArray (sal_Int32 nChars) |
Reads a Unicode character array and returns the string. More... | |
OUString | readCompressedUnicodeArray (sal_Int32 nChars, bool bCompressed) |
Reads a Unicode character array (may be compressed) and returns the string. More... | |
void | copyToStream (BinaryOutputStream &rOutStrm) |
Copies bytes from the current position to the passed output stream. More... | |
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 | |
BinaryInputStream * | mpInStrm |
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... | |
Additional Inherited Members | |
Protected Member Functions inherited from oox::BinaryInputStream | |
BinaryInputStream () | |
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 input stream that supports aligned read operations.
The implementation does not 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. It is possible to construct this wrapper with an unseekable input stream without losing any functionality.
Definition at line 46 of file axbinaryreader.hxx.
|
explicit |
Definition at line 36 of file axbinaryreader.cxx.
References oox::BinaryStreamBase::isEof(), and oox::BinaryStreamBase::mbEof.
void oox::ole::AxAlignedInputStream::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 102 of file axbinaryreader.cxx.
References mnStrmPos, and skip().
Referenced by oox::ole::AxBinaryPropertyReader::finalizeImport(), readAligned(), oox::ole::AxBinaryPropertyReader::ArrayStringProperty::readProperty(), and skipAligned().
|
overridevirtual |
Closes the input stream but not the wrapped stream.
Implements oox::BinaryStreamBase.
Definition at line 62 of file axbinaryreader.cxx.
References oox::BinaryStreamBase::mbEof, and mpInStrm.
Aligns the stream according to the passed type and reads a value.
Definition at line 79 of file axbinaryreader.hxx.
References align().
Referenced by oox::ole::AxBinaryPropertyReader::readArrayStringProperty(), oox::ole::AxBinaryPropertyReader::readFontProperty(), oox::ole::AxBinaryPropertyReader::readIntProperty(), oox::ole::AxBinaryPropertyReader::readPictureProperty(), and oox::ole::AxBinaryPropertyReader::readStringProperty().
|
overridevirtual |
Reads nBytes bytes to the passed sequence.
Implements oox::BinaryInputStream.
Definition at line 68 of file axbinaryreader.cxx.
References oox::BinaryStreamBase::isEof(), oox::BinaryStreamBase::mbEof, mnStrmPos, mpInStrm, and oox::BinaryInputStream::readData().
|
overridevirtual |
Reads nBytes bytes to the (existing) buffer opMem.
Implements oox::BinaryInputStream.
Definition at line 80 of file axbinaryreader.cxx.
References oox::BinaryStreamBase::isEof(), oox::BinaryStreamBase::mbEof, mnStrmPos, mpInStrm, and oox::BinaryInputStream::readMemory().
|
overridevirtual |
Seeks the stream to the passed relative position, if it is behind the current position.
Implements oox::BinaryStreamBase.
Definition at line 55 of file axbinaryreader.cxx.
References oox::BinaryStreamBase::mbEof, mnStrmPos, nPos, and skip().
Referenced by oox::ole::AxBinaryPropertyReader::finalizeImport().
|
overridevirtual |
Returns the size of the data this stream represents, if the wrapped stream supports the size() operation.
Implements oox::BinaryStreamBase.
Definition at line 45 of file axbinaryreader.cxx.
References mnStrmSize, and mpInStrm.
|
overridevirtual |
Seeks the stream forward by the passed number of bytes.
Implements oox::BinaryInputStream.
Definition at line 92 of file axbinaryreader.cxx.
References oox::BinaryStreamBase::isEof(), oox::BinaryStreamBase::mbEof, mnStrmPos, mpInStrm, and oox::BinaryInputStream::skip().
Referenced by align(), oox::ole::AxBinaryPropertyReader::AxBinaryPropertyReader(), seek(), and skipAligned().
|
inline |
Aligns the stream according to the passed type and skips the size of the type.
Definition at line 82 of file axbinaryreader.hxx.
References align(), and skip().
Referenced by oox::ole::AxBinaryPropertyReader::skipIntProperty().
|
overridevirtual |
Return the current relative stream position (relative to position of the wrapped stream at construction time).
Implements oox::BinaryStreamBase.
Definition at line 50 of file axbinaryreader.cxx.
References mnStrmPos, and mpInStrm.
Referenced by oox::ole::AxBinaryPropertyReader::AxBinaryPropertyReader(), and oox::ole::AxBinaryPropertyReader::ArrayStringProperty::readProperty().
|
private |
Tracks relative position in the stream.
Definition at line 86 of file axbinaryreader.hxx.
Referenced by align(), readData(), readMemory(), seek(), skip(), and tell().
|
private |
Size of the wrapped stream data.
Definition at line 87 of file axbinaryreader.hxx.
Referenced by size().
|
private |
The wrapped input stream.
Definition at line 85 of file axbinaryreader.hxx.
Referenced by close(), readData(), readMemory(), size(), skip(), and tell().