LibreOffice Module tools (master) 1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
SvStream Class Reference

#include <stream.hxx>

Inheritance diagram for SvStream:
[legend]
Collaboration diagram for SvStream:
[legend]

Public Member Functions

 SvStream ()
 
 SvStream (SvLockBytes *pLockBytes)
 
virtual ~SvStream ()
 
SvLockBytesGetLockBytes () const
 
ErrCode GetError () const
 
ErrCode const & GetErrorCode () const
 
void SetError (ErrCode nErrorCode)
 
virtual void ResetError ()
 
void SetEndian (SvStreamEndian SvStreamEndian)
 
SvStreamEndian GetEndian () const
 
bool IsEndianSwap () const
 returns status of endian swap flag More...
 
void SetCompressMode (SvStreamCompressFlags nNewMode)
 
SvStreamCompressFlags GetCompressMode () const
 
void SetCryptMaskKey (const OString &rCryptMaskKey)
 
void SetStreamCharSet (rtl_TextEncoding eCharSet)
 
rtl_TextEncoding GetStreamCharSet () const
 
void SetLineDelimiter (LineEnd eLineEnd)
 
LineEnd GetLineDelimiter () const
 
SvStreamReadUInt16 (sal_uInt16 &rUInt16)
 
SvStreamReadUInt32 (sal_uInt32 &rUInt32)
 
SvStreamReadUInt64 (sal_uInt64 &rUInt64)
 
SvStreamReadInt16 (sal_Int16 &rInt16)
 
SvStreamReadInt32 (sal_Int32 &rInt32)
 
SvStreamReadInt64 (sal_Int64 &rInt64)
 
SvStreamReadSChar (signed char &rChar)
 
SvStreamReadChar (char &rChar)
 
SvStreamReadUChar (unsigned char &rChar)
 
SvStreamReadUtf16 (sal_Unicode &rUtf16)
 
SvStreamReadCharAsBool (bool &rBool)
 
SvStreamReadFloat (float &rFloat)
 
SvStreamReadDouble (double &rDouble)
 
SvStreamReadStream (SvStream &rStream)
 
SvStreamWriteUInt16 (sal_uInt16 nUInt16)
 
SvStreamWriteUInt32 (sal_uInt32 nUInt32)
 
SvStreamWriteUInt64 (sal_uInt64 nuInt64)
 
SvStreamWriteInt16 (sal_Int16 nInt16)
 
SvStreamWriteInt32 (sal_Int32 nInt32)
 
SvStreamWriteInt64 (sal_Int64 nInt64)
 
SvStreamWriteUInt8 (sal_uInt8 nuInt8)
 
SvStreamWriteUnicode (sal_Unicode)
 
SvStreamWriteOString (std::string_view rStr)
 
SvStreamWriteStream (SvStream &rStream)
 
sal_uInt64 WriteStream (SvStream &rStream, sal_uInt64 nSize)
 
SvStreamWriteBool (bool b)
 
SvStreamWriteSChar (signed char nChar)
 
SvStreamWriteChar (char nChar)
 
SvStreamWriteUChar (unsigned char nChar)
 
SvStreamWriteFloat (float nFloat)
 
SvStreamWriteDouble (const double &rDouble)
 
SvStreamWriteCharPtr (const char *pBuf)
 
SvStreamWriteUInt32AsString (sal_uInt32 nUInt32)
 
SvStreamWriteInt32AsString (sal_Int32 nInt32)
 
std::size_t ReadBytes (void *pData, std::size_t nSize)
 
std::size_t WriteBytes (const void *pData, std::size_t nSize)
 
sal_uInt64 Seek (sal_uInt64 nPos)
 
sal_uInt64 SeekRel (sal_Int64 nPos)
 
sal_uInt64 Tell () const
 
virtual sal_uInt64 TellEnd ()
 
sal_uInt64 remainingSize ()
 
void FlushBuffer ()
 If we have data in our internal buffers, write them out. More...
 
void Flush ()
 Call FlushBuffer() and then call flush on the underlying OS stream. More...
 
bool SetStreamSize (sal_uInt64 nSize)
 
bool ReadLine (OStringBuffer &rStr, sal_Int32 nMaxBytesToRead=0xFFFE)
 Read a line of bytes. More...
 
bool ReadLine (OString &rStr, sal_Int32 nMaxBytesToRead=0xFFFE)
 
bool WriteLine (std::string_view rStr)
 
bool ReadByteStringLine (OUString &rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxBytesToRead=0xFFFE)
 Read a line of bytes. More...
 
bool WriteByteStringLine (std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
 
void StartWritingUnicodeText ()
 Switch to no endian swapping and write 0xfeff. More...
 
void StartReadingUnicodeText (rtl_TextEncoding eReadBomCharSet)
 If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit, if 0xfeff do nothing (UTF-16), if 0xfffe switch endian swapping (UTF-16), if 0xefbb or 0xbbef read another byte and check for UTF-8. More...
 
SAL_DLLPRIVATE bool ReadUniStringLine (OUString &rStr, sal_Int32 nMaxCodepointsToRead)
 Read a line of Unicode. More...
 
OUString ReadUniOrByteString (rtl_TextEncoding eSrcCharSet)
 Read a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a 16bit length prefixed sequence of bytes and convert from eSrcCharSet. More...
 
SvStreamWriteUniOrByteString (std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
 Write a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise convert to eSrcCharSet and write a 16bit length prefixed sequence of bytes. More...
 
bool ReadUniOrByteStringLine (OUString &rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxCodepointsToRead=0xFFFE)
 Read a line of Unicode if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a line of Bytecode and convert from eSrcCharSet. More...
 
bool WriteUnicodeOrByteText (std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
 Write a sequence of Unicode characters if eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of Bytecodes converted to eDestCharSet. More...
 
bool WriteUnicodeOrByteText (std::u16string_view rStr)
 
bool WriteUniOrByteChar (sal_Unicode ch, rtl_TextEncoding eDestCharSet)
 Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write as Bytecode converted to eDestCharSet. More...
 
bool WriteUniOrByteChar (sal_Unicode ch)
 
void SetBufferSize (sal_uInt16 m_nBufSize)
 
sal_uInt16 GetBufferSize () const
 
void RefreshBuffer ()
 
bool IsWritable () const
 
StreamMode GetStreamMode () const
 
sal_Int32 GetVersion () const
 
void SetVersion (sal_Int32 n)
 
bool eof () const
 end of input seen during previous i/o operation More...
 
bool bad () const
 stream is broken More...
 
bool good () const
 Get state. More...
 

Protected Member Functions

virtual std::size_t GetData (void *pData, std::size_t nSize)
 
virtual std::size_t PutData (const void *pData, std::size_t nSize)
 
virtual sal_uInt64 SeekPos (sal_uInt64 nPos)
 
virtual void FlushData ()
 
virtual void SetSize (sal_uInt64 nSize)
 
SAL_DLLPRIVATE void ClearError ()
 
SAL_DLLPRIVATE void ClearBuffer ()
 
SAL_DLLPRIVATE std::size_t CryptAndWriteBuffer (const void *pStart, std::size_t nLen)
 Encrypt and write. More...
 
SAL_DLLPRIVATE void EncryptBuffer (void *pStart, std::size_t nLen) const
 

Protected Attributes

sal_uInt64 m_nBufFilePos
 File position of pBuf[0]. More...
 
StreamMode m_eStreamMode
 
bool m_isWritable
 

Private Member Functions

 SvStream (const SvStream &rStream)=delete
 
SvStreamoperator= (const SvStream &rStream)=delete
 
template<typename T >
SvStreamReadNumber (T &r)
 
template<typename T >
SvStreamWriteNumber (T n)
 
template<typename T >
void readNumberWithoutSwap (T &rDataDest)
 
SAL_DLLPRIVATE void readNumberWithoutSwap_ (void *pDataDest, int nDataSize)
 
template<typename T >
void writeNumberWithoutSwap (T const &rDataSrc)
 
SAL_DLLPRIVATE void writeNumberWithoutSwap_ (const void *pDataSrc, int nDataSize)
 

Private Attributes

SvLockBytesRef m_xLockBytes
 Default implementation. More...
 
sal_uInt64 m_nActPos
 
std::unique_ptr< sal_uInt8[]> m_pRWBuf
 Points to read/write buffer. More...
 
sal_uInt8m_pBufPos
 m_pRWBuf + m_nBufActualPos More...
 
sal_uInt16 m_nBufSize
 Allocated size of buffer. More...
 
sal_uInt16 m_nBufActualLen
 Length of used segment of buffer. More...
 
sal_uInt16 m_nBufActualPos
 current position in buffer (0..m_nBufSize-1) More...
 
sal_uInt16 m_nBufFree
 number of free slots in buffer to IO of type eIOMode More...
 
bool m_isIoRead
 
bool m_isIoWrite
 
bool m_isDirty
 true: Stream != buffer content More...
 
bool m_isSwap
 
bool m_isEof
 
ErrCode m_nError
 
SvStreamEndian m_nEndian
 
SvStreamCompressFlags m_nCompressMode
 
LineEnd m_eLineDelimiter
 
rtl_TextEncoding m_eStreamCharSet
 
OString m_aCryptMaskKey
 
unsigned char m_nCryptMask
 
sal_Int32 m_nVersion
 

Friends

SvStreamoperator<< (SvStream &rStr, SvStrPtr f)
 

Detailed Description

Definition at line 140 of file stream.hxx.

Constructor & Destructor Documentation

◆ SvStream() [1/3]

SvStream::SvStream ( const SvStream rStream)
privatedelete

◆ SvStream() [2/3]

SvStream::SvStream ( )

Definition at line 296 of file stream.cxx.

References ClearError(), if(), LITTLE, NONE, and SetEndian().

◆ SvStream() [3/3]

SvStream::SvStream ( SvLockBytes pLockBytes)

◆ ~SvStream()

SvStream::~SvStream ( )
virtual

Definition at line 344 of file stream.cxx.

References Flush(), and m_xLockBytes.

Member Function Documentation

◆ bad()

bool SvStream::bad ( ) const
inline

stream is broken

Definition at line 399 of file stream.hxx.

References ERRCODE_NONE, and GetError().

◆ ClearBuffer()

void SvStream::ClearBuffer ( )
protected

◆ ClearError()

void SvStream::ClearError ( )
protected

◆ CryptAndWriteBuffer()

std::size_t SvStream::CryptAndWriteBuffer ( const void *  pStart,
std::size_t  nLen 
)
protected

Encrypt and write.

Definition at line 1375 of file stream.cxx.

References CRYPT_BUFSIZE, m_nCryptMask, nCount, PutData(), and swapNibbles().

Referenced by FlushBuffer(), and WriteBytes().

◆ EncryptBuffer()

void SvStream::EncryptBuffer ( void *  pStart,
std::size_t  nLen 
) const
protected

Definition at line 1406 of file stream.cxx.

References m_nCryptMask, n, and swapNibbles().

Referenced by ReadBytes(), and RefreshBuffer().

◆ eof()

bool SvStream::eof ( ) const
inline

end of input seen during previous i/o operation

Definition at line 396 of file stream.hxx.

Referenced by ZCodec::InitDecompress().

◆ Flush()

void SvStream::Flush ( void  )

Call FlushBuffer() and then call flush on the underlying OS stream.

Definition at line 1337 of file stream.cxx.

References FlushBuffer(), FlushData(), and m_isWritable.

Referenced by SvLockBytes::Flush(), and ~SvStream().

◆ FlushBuffer()

void SvStream::FlushBuffer ( )

◆ FlushData()

void SvStream::FlushData ( )
protectedvirtual

Reimplemented in SvFileStream, and SvMemoryStream.

Definition at line 281 of file stream.cxx.

References DBG_ASSERT, GetError(), m_nError, and m_xLockBytes.

Referenced by Flush().

◆ GetBufferSize()

sal_uInt16 SvStream::GetBufferSize ( ) const
inline

Definition at line 383 of file stream.hxx.

◆ GetCompressMode()

SvStreamCompressFlags SvStream::GetCompressMode ( ) const
inline

Definition at line 216 of file stream.hxx.

◆ GetData()

std::size_t SvStream::GetData ( void *  pData,
std::size_t  nSize 
)
protectedvirtual

Reimplemented in SvFileStream, and SvMemoryStream.

Definition at line 239 of file stream.cxx.

References DBG_ASSERT, GetError(), m_nActPos, m_nError, m_xLockBytes, and pData.

Referenced by ReadBytes(), and RefreshBuffer().

◆ GetEndian()

SvStreamEndian SvStream::GetEndian ( ) const
inline

Definition at line 210 of file stream.hxx.

◆ GetError()

ErrCode SvStream::GetError ( ) const
inline

◆ GetErrorCode()

ErrCode const & SvStream::GetErrorCode ( ) const
inline

◆ GetLineDelimiter()

LineEnd SvStream::GetLineDelimiter ( ) const
inline

Definition at line 226 of file stream.hxx.

Referenced by endl(), and endlu().

◆ GetLockBytes()

SvLockBytes * SvStream::GetLockBytes ( ) const
inline

Definition at line 202 of file stream.hxx.

References m_xLockBytes.

◆ GetStreamCharSet()

rtl_TextEncoding SvStream::GetStreamCharSet ( ) const
inline

Definition at line 222 of file stream.hxx.

Referenced by endlub().

◆ GetStreamMode()

StreamMode SvStream::GetStreamMode ( ) const
inline

Definition at line 388 of file stream.hxx.

◆ GetVersion()

sal_Int32 SvStream::GetVersion ( ) const
inline

Definition at line 390 of file stream.hxx.

Referenced by SetCryptMaskKey().

◆ good()

bool SvStream::good ( ) const
inline

Get state.

If the state is good() the previous i/o operation succeeded.

If the state is good(), the next input operation might succeed; otherwise, it will fail.

Applying an input operation to a stream that is not in the good() state is a null operation as far as the variable being read into is concerned.

If we try to read into a variable v and the operation fails, the value of v should be unchanged,

Definition at line 414 of file stream.hxx.

Referenced by ReadDouble(), ReadFloat(), ReadNumber(), write_uInt16_lenPrefixed_uInt16s_FromOUString(), write_uInt16_lenPrefixed_uInt8s_FromOString(), and write_uInt32_lenPrefixed_uInt16s_FromOUString().

◆ IsEndianSwap()

bool SvStream::IsEndianSwap ( ) const
inline

returns status of endian swap flag

Definition at line 212 of file stream.hxx.

Referenced by read_uInt16s_ToOUString(), and write_uInt16s_FromOUString().

◆ IsWritable()

bool SvStream::IsWritable ( ) const
inline

Definition at line 387 of file stream.hxx.

◆ operator=()

SvStream & SvStream::operator= ( const SvStream rStream)
privatedelete

◆ PutData()

std::size_t SvStream::PutData ( const void *  pData,
std::size_t  nSize 
)
protectedvirtual

Reimplemented in SvFileStream, and SvMemoryStream.

Definition at line 252 of file stream.cxx.

References DBG_ASSERT, GetError(), m_nActPos, m_nError, m_xLockBytes, and pData.

Referenced by CryptAndWriteBuffer(), FlushBuffer(), and WriteBytes().

◆ ReadBytes()

std::size_t SvStream::ReadBytes ( void *  pData,
std::size_t  nSize 
)

◆ ReadByteStringLine()

bool SvStream::ReadByteStringLine ( OUString &  rStr,
rtl_TextEncoding  eSrcCharSet,
sal_Int32  nMaxBytesToRead = 0xFFFE 
)

Read a line of bytes.

Parameters
nMaxBytesToReadMaximum of bytes to read, if line is longer it will be truncated.
Note
NOTE that the default is one character less than STRING_MAXLEN to prevent problems after conversion to String that may be lurking in various places doing something like
for (sal_uInt16 i=0; i < aString.Len(); ++i)
int i
causing endless loops ...

Definition at line 418 of file stream.cxx.

References aStr, and ReadLine().

Referenced by ReadUniOrByteStringLine().

◆ ReadChar()

SvStream & SvStream::ReadChar ( char &  rChar)

Definition at line 838 of file stream.cxx.

References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().

◆ ReadCharAsBool()

SvStream & SvStream::ReadCharAsBool ( bool &  rBool)

Definition at line 868 of file stream.cxx.

References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, ReadBytes(), and SAL_WARN_IF.

◆ ReadDouble()

SvStream & SvStream::ReadDouble ( double &  rDouble)

Definition at line 906 of file stream.cxx.

References good(), m_isSwap, n, readNumberWithoutSwap(), and SwapDouble().

◆ ReadFloat()

SvStream & SvStream::ReadFloat ( float &  rFloat)

Definition at line 891 of file stream.cxx.

References good(), m_isSwap, n, readNumberWithoutSwap(), and SwapFloat().

◆ ReadInt16()

SvStream & SvStream::ReadInt16 ( sal_Int16 &  rInt16)

Definition at line 818 of file stream.cxx.

References ReadNumber().

◆ ReadInt32()

SvStream & SvStream::ReadInt32 ( sal_Int32 &  rInt32)

◆ ReadInt64()

SvStream & SvStream::ReadInt64 ( sal_Int64 &  rInt64)

Definition at line 820 of file stream.cxx.

References ReadNumber().

◆ ReadLine() [1/2]

bool SvStream::ReadLine ( OString &  rStr,
sal_Int32  nMaxBytesToRead = 0xFFFE 
)

Definition at line 427 of file stream.cxx.

References aBuf, and ReadLine().

◆ ReadLine() [2/2]

bool SvStream::ReadLine ( OStringBuffer &  rStr,
sal_Int32  nMaxBytesToRead = 0xFFFE 
)

Read a line of bytes.

Parameters
nMaxBytesToReadMaximum of bytes to read, if line is longer it will be truncated.
Note
NOTE that the default is one character less than STRING_MAXLEN to prevent problems after conversion to String that may be lurking in various places doing something like
for (sal_uInt16 i=0; i < aString.Len(); ++i)
causing endless loops ...

Definition at line 435 of file stream.cxx.

References aBuf, GetError(), m_isEof, o3tl::make_unsigned(), n, ReadBytes(), Seek(), and Tell().

Referenced by ReadByteStringLine(), and ReadLine().

◆ ReadNumber()

template<typename T >
SvStream & SvStream::ReadNumber ( T &  r)
private

◆ readNumberWithoutSwap()

template<typename T >
void SvStream::readNumberWithoutSwap ( T &  rDataDest)
inlineprivate

Definition at line 421 of file stream.hxx.

Referenced by ReadDouble(), ReadFloat(), and ReadNumber().

◆ readNumberWithoutSwap_()

void SvStream::readNumberWithoutSwap_ ( void *  pDataDest,
int  nDataSize 
)
private

Definition at line 120 of file stream.cxx.

References i, m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().

◆ ReadSChar()

SvStream & SvStream::ReadSChar ( signed char &  rChar)

Definition at line 822 of file stream.cxx.

References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().

◆ ReadStream()

SvStream & SvStream::ReadStream ( SvStream rStream)

Definition at line 921 of file stream.cxx.

References nCount, ReadBytes(), and WriteBytes().

◆ ReadUChar()

SvStream & SvStream::ReadUChar ( unsigned char &  rChar)

◆ ReadUInt16()

SvStream & SvStream::ReadUInt16 ( sal_uInt16 &  rUInt16)

◆ ReadUInt32()

SvStream & SvStream::ReadUInt32 ( sal_uInt32 &  rUInt32)

◆ ReadUInt64()

SvStream & SvStream::ReadUInt64 ( sal_uInt64 &  rUInt64)

Definition at line 817 of file stream.cxx.

References ReadNumber().

◆ ReadUniOrByteString()

OUString SvStream::ReadUniOrByteString ( rtl_TextEncoding  eSrcCharSet)

Read a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a 16bit length prefixed sequence of bytes and convert from eSrcCharSet.

Definition at line 1083 of file stream.cxx.

References read_uInt16_lenPrefixed_uInt8s_ToOUString(), and read_uInt32_lenPrefixed_uInt16s_ToOUString().

◆ ReadUniOrByteStringLine()

bool SvStream::ReadUniOrByteStringLine ( OUString &  rStr,
rtl_TextEncoding  eSrcCharSet,
sal_Int32  nMaxCodepointsToRead = 0xFFFE 
)

Read a line of Unicode if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a line of Bytecode and convert from eSrcCharSet.

Parameters
nMaxCodepointsToReadMaximum of codepoints (2 bytes if Unicode, bytes if not Unicode) to read, if line is longer it will be truncated.
Note
NOTE that the default is one character less than STRING_MAXLEN to prevent problems after conversion to String that may be lurking in various places doing something like
for (sal_uInt16 i=0; i < aString.Len(); ++i)
causing endless loops ...

Definition at line 594 of file stream.cxx.

References ReadByteStringLine(), and ReadUniStringLine().

◆ ReadUniStringLine()

bool SvStream::ReadUniStringLine ( OUString &  rStr,
sal_Int32  nMaxCodepointsToRead 
)

Read a line of Unicode.

Parameters
nMaxCodepointsToReadMaximum of codepoints (UCS-2 or UTF-16 pairs, not bytes) to read, if line is longer it will be truncated.

Definition at line 508 of file stream.cxx.

References aBuf, DBG_ASSERT, GetError(), m_isEof, m_isSwap, o3tl::make_unsigned(), n, ReadBytes(), Seek(), SwapNumber(), and Tell().

Referenced by ReadUniOrByteStringLine().

◆ ReadUtf16()

SvStream & SvStream::ReadUtf16 ( sal_Unicode rUtf16)

Definition at line 866 of file stream.cxx.

References ReadNumber().

◆ RefreshBuffer()

void SvStream::RefreshBuffer ( )

◆ remainingSize()

sal_uInt64 SvStream::remainingSize ( )

◆ ResetError()

void SvStream::ResetError ( )
virtual

Reimplemented in SvFileStream, and SvMemoryStream.

Definition at line 413 of file stream.cxx.

References ClearError().

◆ Seek()

sal_uInt64 SvStream::Seek ( sal_uInt64  nPos)

◆ SeekPos()

sal_uInt64 SvStream::SeekPos ( sal_uInt64  nPos)
protectedvirtual

◆ SeekRel()

sal_uInt64 SvStream::SeekRel ( sal_Int64  nPos)

◆ SetBufferSize()

void SvStream::SetBufferSize ( sal_uInt16  m_nBufSize)

◆ SetCompressMode()

void SvStream::SetCompressMode ( SvStreamCompressFlags  nNewMode)
inline

Definition at line 214 of file stream.hxx.

◆ SetCryptMaskKey()

void SvStream::SetCryptMaskKey ( const OString &  rCryptMaskKey)

Definition at line 1455 of file stream.cxx.

References GetVersion(), implGetCryptMask(), m_aCryptMaskKey, and m_nCryptMask.

◆ SetEndian()

void SvStream::SetEndian ( SvStreamEndian  SvStreamEndian)

Definition at line 362 of file stream.cxx.

References BIG, LITTLE, m_isSwap, and m_nEndian.

Referenced by StartReadingUnicodeText(), and SvStream().

◆ SetError()

void SvStream::SetError ( ErrCode  nErrorCode)

◆ SetLineDelimiter()

void SvStream::SetLineDelimiter ( LineEnd  eLineEnd)
inline

Definition at line 224 of file stream.hxx.

◆ SetSize()

void SvStream::SetSize ( sal_uInt64  nSize)
protectedvirtual

Reimplemented in SvFileStream, and SvMemoryStream.

Definition at line 290 of file stream.cxx.

References DBG_ASSERT, m_nError, and m_xLockBytes.

Referenced by SetStreamSize().

◆ SetStreamCharSet()

void SvStream::SetStreamCharSet ( rtl_TextEncoding  eCharSet)
inline

Definition at line 220 of file stream.hxx.

◆ SetStreamSize()

bool SvStream::SetStreamSize ( sal_uInt64  nSize)

◆ SetVersion()

void SvStream::SetVersion ( sal_Int32  n)
inline

Definition at line 391 of file stream.hxx.

References n.

◆ StartReadingUnicodeText()

void SvStream::StartReadingUnicodeText ( rtl_TextEncoding  eReadBomCharSet)

If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit, if 0xfeff do nothing (UTF-16), if 0xfffe switch endian swapping (UTF-16), if 0xefbb or 0xbbef read another byte and check for UTF-8.

If no UTF-* BOM was detected put all read bytes back. This means that if 2 bytes were read it was an UTF-16 BOM, if 3 bytes were read it was an UTF-8 BOM. There is no UTF-7, UTF-32 or UTF-EBCDIC BOM detection!

If eReadBomCharSet!=RTL_TEXTENCODING_DONTKNOW: only read a BOM of that encoding and switch endian swapping if UTF-16 and 0xfffe.

Definition at line 721 of file stream.cxx.

References BIG, LITTLE, ReadUChar(), Seek(), SetEndian(), and Tell().

◆ StartWritingUnicodeText()

void SvStream::StartWritingUnicodeText ( )

Switch to no endian swapping and write 0xfeff.

Definition at line 713 of file stream.cxx.

References writeNumberWithoutSwap().

◆ Tell()

sal_uInt64 SvStream::Tell ( ) const
inline

◆ TellEnd()

sal_uInt64 SvStream::TellEnd ( )
virtual

Reimplemented in SvMemoryStream.

Definition at line 1328 of file stream.cxx.

References FlushBuffer(), Seek(), STREAM_SEEK_TO_END, and Tell().

Referenced by checkSeek(), ZCodec::Compress(), remainingSize(), and SvLockBytes::Stat().

◆ WriteBool()

SvStream & SvStream::WriteBool ( bool  b)
inline

Definition at line 256 of file stream.hxx.

Referenced by tools::Polygon::ImplWrite().

◆ WriteBytes()

std::size_t SvStream::WriteBytes ( const void *  pData,
std::size_t  nSize 
)

◆ WriteByteStringLine()

bool SvStream::WriteByteStringLine ( std::u16string_view  rStr,
rtl_TextEncoding  eDestCharSet 
)

Definition at line 689 of file stream.cxx.

References OUStringToOString(), and WriteLine().

◆ WriteChar()

SvStream & SvStream::WriteChar ( char  nChar)

Definition at line 970 of file stream.cxx.

References m_isDirty, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFree, m_pBufPos, v, and WriteBytes().

Referenced by endl().

◆ WriteCharPtr()

SvStream & SvStream::WriteCharPtr ( const char *  pBuf)

Definition at line 1044 of file stream.cxx.

References WriteBytes().

◆ WriteDouble()

SvStream & SvStream::WriteDouble ( const double &  rDouble)

Definition at line 1026 of file stream.cxx.

References m_isSwap, SwapDouble(), and writeNumberWithoutSwap().

◆ WriteFloat()

SvStream & SvStream::WriteFloat ( float  nFloat)

Definition at line 1016 of file stream.cxx.

References m_isSwap, SwapFloat(), v, and writeNumberWithoutSwap().

◆ WriteInt16()

SvStream & SvStream::WriteInt16 ( sal_Int16  nInt16)

Definition at line 946 of file stream.cxx.

References v, and WriteNumber().

◆ WriteInt32()

SvStream & SvStream::WriteInt32 ( sal_Int32  nInt32)

◆ WriteInt32AsString()

SvStream & SvStream::WriteInt32AsString ( sal_Int32  nInt32)

Definition at line 1356 of file stream.cxx.

References WriteBytes().

◆ WriteInt64()

SvStream & SvStream::WriteInt64 ( sal_Int64  nInt64)

Definition at line 948 of file stream.cxx.

References v, and WriteNumber().

◆ WriteLine()

bool SvStream::WriteLine ( std::string_view  rStr)

Definition at line 694 of file stream.cxx.

References endl(), ERRCODE_NONE, m_nError, and WriteBytes().

Referenced by WriteByteStringLine().

◆ WriteNumber()

template<typename T >
SvStream & SvStream::WriteNumber ( n)
private

◆ writeNumberWithoutSwap()

template<typename T >
void SvStream::writeNumberWithoutSwap ( T const &  rDataSrc)
inlineprivate

Definition at line 427 of file stream.hxx.

Referenced by StartWritingUnicodeText(), WriteDouble(), WriteFloat(), and WriteNumber().

◆ writeNumberWithoutSwap_()

void SvStream::writeNumberWithoutSwap_ ( const void *  pDataSrc,
int  nDataSize 
)
private

◆ WriteOString()

SvStream & SvStream::WriteOString ( std::string_view  rStr)
inline

Definition at line 251 of file stream.hxx.

◆ WriteSChar()

SvStream & SvStream::WriteSChar ( signed char  nChar)

◆ WriteStream() [1/2]

SvStream & SvStream::WriteStream ( SvStream rStream)

Definition at line 1050 of file stream.cxx.

References nCount, ReadBytes(), and WriteBytes().

◆ WriteStream() [2/2]

sal_uInt64 SvStream::WriteStream ( SvStream rStream,
sal_uInt64  nSize 
)

Definition at line 1063 of file stream.cxx.

References nCount, ReadBytes(), and WriteBytes().

◆ WriteUChar()

SvStream & SvStream::WriteUChar ( unsigned char  nChar)

Definition at line 988 of file stream.cxx.

References m_isDirty, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFree, m_pBufPos, v, and WriteBytes().

Referenced by WriteUInt8().

◆ WriteUInt16()

SvStream & SvStream::WriteUInt16 ( sal_uInt16  nUInt16)

◆ WriteUInt32()

SvStream & SvStream::WriteUInt32 ( sal_uInt32  nUInt32)

◆ WriteUInt32AsString()

SvStream & SvStream::WriteUInt32AsString ( sal_uInt32  nUInt32)

Definition at line 1364 of file stream.cxx.

References WriteBytes().

◆ WriteUInt64()

SvStream & SvStream::WriteUInt64 ( sal_uInt64  nuInt64)

Definition at line 945 of file stream.cxx.

References v, and WriteNumber().

◆ WriteUInt8()

SvStream & SvStream::WriteUInt8 ( sal_uInt8  nuInt8)

Definition at line 1006 of file stream.cxx.

References v, and WriteUChar().

Referenced by ZCodec::EndCompression().

◆ WriteUnicode()

SvStream & SvStream::WriteUnicode ( sal_Unicode  v)

Definition at line 1011 of file stream.cxx.

References v, and WriteUInt16().

Referenced by endlu(), and WriteUniOrByteChar().

◆ WriteUnicodeOrByteText() [1/2]

bool SvStream::WriteUnicodeOrByteText ( std::u16string_view  rStr)
inline

Definition at line 370 of file stream.hxx.

◆ WriteUnicodeOrByteText() [2/2]

bool SvStream::WriteUnicodeOrByteText ( std::u16string_view  rStr,
rtl_TextEncoding  eDestCharSet 
)

Write a sequence of Unicode characters if eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of Bytecodes converted to eDestCharSet.

Definition at line 674 of file stream.cxx.

References aStr, ERRCODE_NONE, m_nError, OUStringToOString(), write_uInt16s_FromOUString(), and write_uInt8s_FromOString().

◆ WriteUniOrByteChar() [1/2]

bool SvStream::WriteUniOrByteChar ( sal_Unicode  ch)
inline

Definition at line 379 of file stream.hxx.

References ch.

◆ WriteUniOrByteChar() [2/2]

bool SvStream::WriteUniOrByteChar ( sal_Unicode  ch,
rtl_TextEncoding  eDestCharSet 
)

Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write as Bytecode converted to eDestCharSet.

This may result in more than one byte being written if a multi byte encoding (e.g. UTF7, UTF8) is chosen.

Definition at line 701 of file stream.cxx.

References aStr, ch, ERRCODE_NONE, m_nError, WriteBytes(), and WriteUnicode().

◆ WriteUniOrByteString()

SvStream & SvStream::WriteUniOrByteString ( std::u16string_view  rStr,
rtl_TextEncoding  eDestCharSet 
)

Write a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise convert to eSrcCharSet and write a 16bit length prefixed sequence of bytes.

Definition at line 1091 of file stream.cxx.

References write_uInt16_lenPrefixed_uInt8s_FromOUString(), and write_uInt32_lenPrefixed_uInt16s_FromOUString().

Friends And Related Function Documentation

◆ operator<<

SvStream & operator<< ( SvStream rStr,
SvStrPtr  f 
)
friend

Definition at line 433 of file stream.hxx.

Member Data Documentation

◆ m_aCryptMaskKey

OString SvStream::m_aCryptMaskKey
private

Definition at line 170 of file stream.hxx.

Referenced by SetCryptMaskKey().

◆ m_eLineDelimiter

LineEnd SvStream::m_eLineDelimiter
private

Definition at line 166 of file stream.hxx.

◆ m_eStreamCharSet

rtl_TextEncoding SvStream::m_eStreamCharSet
private

Definition at line 167 of file stream.hxx.

◆ m_eStreamMode

StreamMode SvStream::m_eStreamMode
protected

Definition at line 181 of file stream.hxx.

Referenced by SvFileStream::LockFile(), and SvFileStream::Open().

◆ m_isDirty

bool SvStream::m_isDirty
private

true: Stream != buffer content

Definition at line 160 of file stream.hxx.

Referenced by ClearBuffer(), FlushBuffer(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().

◆ m_isEof

bool SvStream::m_isEof
private

Definition at line 162 of file stream.hxx.

Referenced by ClearBuffer(), ClearError(), ReadBytes(), ReadLine(), ReadUniStringLine(), and Seek().

◆ m_isIoRead

bool SvStream::m_isIoRead
private

◆ m_isIoWrite

bool SvStream::m_isIoWrite
private

◆ m_isSwap

bool SvStream::m_isSwap
private

◆ m_isWritable

bool SvStream::m_isWritable
protected

◆ m_nActPos

sal_uInt64 SvStream::m_nActPos
private

Definition at line 145 of file stream.hxx.

Referenced by GetData(), PutData(), and SeekPos().

◆ m_nBufActualLen

sal_uInt16 SvStream::m_nBufActualLen
private

Length of used segment of buffer.

= m_nBufSize, if EOF did not occur

Definition at line 152 of file stream.hxx.

Referenced by ClearBuffer(), FlushBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().

◆ m_nBufActualPos

sal_uInt16 SvStream::m_nBufActualPos
private

◆ m_nBufFilePos

sal_uInt64 SvStream::m_nBufFilePos
protected

File position of pBuf[0].

Definition at line 180 of file stream.hxx.

Referenced by ClearBuffer(), FlushBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SetBufferSize(), SetStreamSize(), and WriteBytes().

◆ m_nBufFree

sal_uInt16 SvStream::m_nBufFree
private

number of free slots in buffer to IO of type eIOMode

Definition at line 155 of file stream.hxx.

Referenced by ReadBytes(), ReadChar(), ReadCharAsBool(), readNumberWithoutSwap_(), ReadSChar(), ReadUChar(), Seek(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().

◆ m_nBufSize

sal_uInt16 SvStream::m_nBufSize
private

Allocated size of buffer.

Definition at line 151 of file stream.hxx.

Referenced by ReadBytes(), RefreshBuffer(), SetBufferSize(), SetStreamSize(), and WriteBytes().

◆ m_nCompressMode

SvStreamCompressFlags SvStream::m_nCompressMode
private

Definition at line 165 of file stream.hxx.

◆ m_nCryptMask

unsigned char SvStream::m_nCryptMask
private

◆ m_nEndian

SvStreamEndian SvStream::m_nEndian
private

Definition at line 164 of file stream.hxx.

Referenced by SetEndian().

◆ m_nError

ErrCode SvStream::m_nError
private

◆ m_nVersion

sal_Int32 SvStream::m_nVersion
private

Definition at line 174 of file stream.hxx.

◆ m_pBufPos

sal_uInt8* SvStream::m_pBufPos
private

◆ m_pRWBuf

std::unique_ptr<sal_uInt8[]> SvStream::m_pRWBuf
private

Points to read/write buffer.

Definition at line 149 of file stream.hxx.

Referenced by ClearBuffer(), FlushBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SeekRel(), SetBufferSize(), and WriteBytes().

◆ m_xLockBytes

SvLockBytesRef SvStream::m_xLockBytes
private

Default implementation.

Definition at line 144 of file stream.hxx.

Referenced by FlushData(), GetData(), PutData(), SeekPos(), SetSize(), SvStream(), and ~SvStream().


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