LibreOffice Module oox (master) 1
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
oox::BinaryInputStream Class Referenceabstract

Interface for binary input stream classes. More...

#include <binaryinputstream.hxx>

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

Public Member Functions

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...
 

Protected Member Functions

 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)
 

Private Member Functions

 BinaryInputStream (BinaryInputStream const &)=delete
 
BinaryInputStreamoperator= (BinaryInputStream const &)=delete
 

Additional Inherited Members

- Protected Attributes inherited from oox::BinaryStreamBase
bool mbEof
 End of stream flag. More...
 

Detailed Description

Interface for binary input stream classes.

The binary data in the stream is assumed to be in little-endian format.

Definition at line 49 of file binaryinputstream.hxx.

Constructor & Destructor Documentation

◆ BinaryInputStream() [1/2]

oox::BinaryInputStream::BinaryInputStream ( )
inlineprotected

This dummy default c'tor will never call the c'tor of the virtual base class BinaryStreamBase as this class cannot be instantiated directly.

Definition at line 193 of file binaryinputstream.hxx.

◆ BinaryInputStream() [2/2]

oox::BinaryInputStream::BinaryInputStream ( BinaryInputStream const &  )
privatedelete

Member Function Documentation

◆ copyToStream()

void oox::BinaryInputStream::copyToStream ( BinaryOutputStream rOutStrm)

Copies bytes from the current position to the passed output stream.

Definition at line 105 of file binaryinputstream.cxx.

References aBuffer, readData(), SAL_MAX_INT64, and oox::BinaryOutputStream::writeData().

Referenced by oox::StorageBase::copyToStorage(), oox::dump::StorageObjectBase::extractStream(), and oox::core::FilterBase::importBinaryData().

◆ operator=()

BinaryInputStream & oox::BinaryInputStream::operator= ( BinaryInputStream const &  )
privatedelete

◆ readArray() [1/2]

template<typename Type >
sal_Int32 oox::BinaryInputStream::readArray ( ::std::vector< Type > &  orVector,
sal_Int32  nElemCount 
)

Reads a vector of values from the stream.

The vector will be resized internally. Converts all values in the vector to platform byte order. All data types supported by the ByteOrderConverter class can be used.

Parameters
nElemCountNumber of elements to put into the vector (NOT byte count).
Returns
Number of vector elements really read (NOT byte count).

Definition at line 226 of file binaryinputstream.hxx.

References readArray().

◆ readArray() [2/2]

template<typename Type >
sal_Int32 oox::BinaryInputStream::readArray ( Type opnArray,
sal_Int32  nElemCount 
)

Reads a (preallocated!) C array of values from the stream.

Converts all values in the array to platform byte order. All data types supported by the ByteOrderConverter class can be used.

Parameters
nElemCountNumber of array elements to read (NOT byte count).
Returns
Number of array elements really read (NOT byte count).

Definition at line 213 of file binaryinputstream.hxx.

References oox::ByteOrderConverter::convertLittleEndianArray(), oox::BinaryStreamBase::mbEof, readMemory(), and SAL_MAX_INT32.

Referenced by readArray(), readCharArray(), oox::crypto::Standard2007Engine::readEncryptionInfo(), and readUnicodeArray().

◆ readCharArray()

OString oox::BinaryInputStream::readCharArray ( sal_Int32  nChars)

Reads a byte character array and returns the string.

NUL characters are replaced by question marks.

Parameters
nCharsNumber of characters (bytes) to read from the stream.

Definition at line 54 of file binaryinputstream.cxx.

References aBuffer, and readArray().

Referenced by readCharArrayUC().

◆ readCharArrayUC()

OUString oox::BinaryInputStream::readCharArrayUC ( sal_Int32  nChars,
rtl_TextEncoding  eTextEnc 
)

Reads a byte character array and returns a Unicode string.

NUL characters are replaced by question marks.

Parameters
nCharsNumber of characters (bytes) to read from the stream.
eTextEncThe text encoding used to create the Unicode string.

Definition at line 71 of file binaryinputstream.cxx.

References readCharArray().

Referenced by oox::ole::VbaModule::importDirRecords(), oox::ole::OleHelper::importStdFont(), readCompressedUnicodeArray(), and oox::ole::VbaProject::readVbaModules().

◆ readCompressedUnicodeArray()

OUString oox::BinaryInputStream::readCompressedUnicodeArray ( sal_Int32  nChars,
bool  bCompressed 
)

Reads a Unicode character array (may be compressed) and returns the string.

NUL characters are replaced by question marks (default).

Parameters
nCharsNumber of 8-bit or 16-bit characters to read from the stream.
bCompressedTrue = Character array is compressed (stored as 8-bit characters). False = Character array is not compressed (stored as 16-bit characters).

Definition at line 97 of file binaryinputstream.cxx.

References readCharArrayUC(), and readUnicodeArray().

◆ readData()

virtual sal_Int32 oox::BinaryInputStream::readData ( StreamDataSequence orData,
sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
pure virtual

Derived classes implement reading nBytes bytes to the passed sequence.

The sequence will be reallocated internally.

Parameters
nAtomSizeThe size of the elements in the memory block, if available. Derived classes may be interested in this information.
Returns
Number of bytes really read.

Implemented in oox::BinaryXInputStream, oox::SequenceInputStream, oox::RelativeInputStream, oox::ole::AxAlignedInputStream, and oox::ole::VbaInputStream.

Referenced by copyToStream(), oox::dump::SequenceRecordObjectBase::implStartRecord(), oox::ole::OleHelper::importStdPic(), oox::RelativeInputStream::readData(), oox::ole::AxAlignedInputStream::readData(), and oox::ole::VbaHelper::readDirRecord().

◆ readDouble()

double oox::BinaryInputStream::readDouble ( )
inline

Definition at line 109 of file binaryinputstream.hxx.

◆ readFloat()

float oox::BinaryInputStream::readFloat ( )
inline

◆ readInt16()

sal_Int16 oox::BinaryInputStream::readInt16 ( )
inline

Definition at line 97 of file binaryinputstream.hxx.

◆ readInt32()

sal_Int32 oox::BinaryInputStream::readInt32 ( )
inline

◆ readInt64()

sal_Int64 oox::BinaryInputStream::readInt64 ( )
inline

◆ readInt8()

sal_Int8 oox::BinaryInputStream::readInt8 ( )
inline

Definition at line 93 of file binaryinputstream.hxx.

◆ readMemory()

virtual sal_Int32 oox::BinaryInputStream::readMemory ( void *  opMem,
sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
pure virtual

Derived classes implement reading nBytes bytes to the (preallocated!) memory buffer opMem.

Parameters
nAtomSizeThe size of the elements in the memory block, if available. Derived classes may be interested in this information.
Returns
Number of bytes really read.

Implemented in oox::BinaryXInputStream, oox::SequenceInputStream, oox::RelativeInputStream, oox::ole::AxAlignedInputStream, and oox::ole::VbaInputStream.

Referenced by readArray(), oox::RelativeInputStream::readMemory(), oox::ole::AxAlignedInputStream::readMemory(), readValue(), and oox::ole::VbaInputStream::updateChunk().

◆ readNulUnicodeArray()

OUString oox::BinaryInputStream::readNulUnicodeArray ( )

Reads a NUL-terminated Unicode character array and returns the string.

Definition at line 42 of file binaryinputstream.cxx.

References aBuffer, oox::BinaryStreamBase::mbEof, and readuInt16().

Referenced by oox::ole::MSConvertOCXControls::ReadOCXStorage().

◆ readuChar()

unsigned char oox::BinaryInputStream::readuChar ( )
inline

◆ readuInt16()

sal_uInt16 oox::BinaryInputStream::readuInt16 ( )
inline

◆ readuInt32()

sal_uInt32 oox::BinaryInputStream::readuInt32 ( )
inline

◆ readuInt8()

sal_uInt8 oox::BinaryInputStream::readuInt8 ( )
inline

◆ readUnicodeArray()

OUString oox::BinaryInputStream::readUnicodeArray ( sal_Int32  nChars)

Reads a Unicode character array and returns the string.

NUL characters are replaced by question marks (default).

Parameters
nCharsNumber of 16-bit characters to read from the stream.

Definition at line 76 of file binaryinputstream.cxx.

References aBuffer, and readArray().

Referenced by oox::ole::HtmlSelectModel::importBinaryModel(), oox::ole::HtmlTextBoxModel::importBinaryModel(), readCompressedUnicodeArray(), and oox::crypto::DocumentDecryption::readEncryptionInfo().

◆ readValue()

template<typename Type >
Type oox::BinaryInputStream::readValue

Reads a value from the stream and converts it to platform byte order.

All data types supported by the ByteOrderConverter class can be used.

Definition at line 204 of file binaryinputstream.hxx.

References oox::ByteOrderConverter::convertLittleEndian(), and readMemory().

◆ skip()

virtual void oox::BinaryInputStream::skip ( sal_Int32  nBytes,
size_t  nAtomSize = 1 
)
pure virtual

Derived classes implement seeking the stream forward by the passed number of bytes.

This should work for non-seekable streams too.

Parameters
nAtomSizeThe size of the elements in the memory block, if available. Derived classes may be interested in this information.

Implemented in oox::BinaryXInputStream, oox::SequenceInputStream, oox::RelativeInputStream, oox::ole::AxAlignedInputStream, and oox::ole::VbaInputStream.

Referenced by oox::ole::ComCtlModelBase::importCommonPart(), oox::ole::VbaFormControl::importEmbeddedSiteModels(), oox::RelativeInputStream::skip(), and oox::ole::AxAlignedInputStream::skip().


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