LibreOffice Module tools (master) 1
|
#include <stream.hxx>
Public Member Functions | |
SvStream () | |
SvStream (SvLockBytes *pLockBytes) | |
virtual | ~SvStream () |
SvLockBytes * | GetLockBytes () 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 |
SvStream & | ReadUInt16 (sal_uInt16 &rUInt16) |
SvStream & | ReadUInt32 (sal_uInt32 &rUInt32) |
SvStream & | ReadUInt64 (sal_uInt64 &rUInt64) |
SvStream & | ReadInt16 (sal_Int16 &rInt16) |
SvStream & | ReadInt32 (sal_Int32 &rInt32) |
SvStream & | ReadInt64 (sal_Int64 &rInt64) |
SvStream & | ReadSChar (signed char &rChar) |
SvStream & | ReadChar (char &rChar) |
SvStream & | ReadUChar (unsigned char &rChar) |
SvStream & | ReadUtf16 (sal_Unicode &rUtf16) |
SvStream & | ReadCharAsBool (bool &rBool) |
SvStream & | ReadFloat (float &rFloat) |
SvStream & | ReadDouble (double &rDouble) |
SvStream & | ReadStream (SvStream &rStream) |
SvStream & | WriteUInt16 (sal_uInt16 nUInt16) |
SvStream & | WriteUInt32 (sal_uInt32 nUInt32) |
SvStream & | WriteUInt64 (sal_uInt64 nuInt64) |
SvStream & | WriteInt16 (sal_Int16 nInt16) |
SvStream & | WriteInt32 (sal_Int32 nInt32) |
SvStream & | WriteInt64 (sal_Int64 nInt64) |
SvStream & | WriteUInt8 (sal_uInt8 nuInt8) |
SvStream & | WriteUnicode (sal_Unicode) |
SvStream & | WriteOString (std::string_view rStr) |
SvStream & | WriteStream (SvStream &rStream) |
sal_uInt64 | WriteStream (SvStream &rStream, sal_uInt64 nSize) |
SvStream & | WriteBool (bool b) |
SvStream & | WriteSChar (signed char nChar) |
SvStream & | WriteChar (char nChar) |
SvStream & | WriteUChar (unsigned char nChar) |
SvStream & | WriteFloat (float nFloat) |
SvStream & | WriteDouble (const double &rDouble) |
template<typename N > | |
SvStream & | WriteNumberAsString (N n) |
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... | |
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. 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 | |
SvStream & | operator= (const SvStream &rStream)=delete |
template<typename T > | |
SvStream & | ReadNumber (T &r) |
template<typename T > | |
SvStream & | WriteNumber (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_uInt8 * | m_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 |
SvStreamCompressFlags | m_nCompressMode |
LineEnd | m_eLineDelimiter |
rtl_TextEncoding | m_eStreamCharSet |
OString | m_aCryptMaskKey |
unsigned char | m_nCryptMask |
sal_Int32 | m_nVersion |
Friends | |
SvStream & | operator<< (SvStream &rStr, SvStrPtr f) |
Definition at line 141 of file stream.hxx.
|
privatedelete |
SvStream::SvStream | ( | ) |
Definition at line 296 of file stream.cxx.
References ClearError(), if(), LITTLE, NONE, and SetEndian().
SvStream::SvStream | ( | SvLockBytes * | pLockBytes | ) |
Definition at line 332 of file stream.cxx.
References GetErrorCode(), SvLockBytes::GetStream(), m_xLockBytes, SetBufferSize(), and SetError().
|
virtual |
Definition at line 344 of file stream.cxx.
References Flush(), and m_xLockBytes.
|
inline |
stream is broken
Definition at line 398 of file stream.hxx.
References ERRCODE_NONE, and GetError().
|
protected |
Definition at line 406 of file stream.cxx.
References m_isDirty, m_isEof, m_isIoRead, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFilePos, m_pBufPos, and m_pRWBuf.
Referenced by SvFileStream::Close().
|
protected |
Definition at line 350 of file stream.cxx.
References ERRCODE_NONE, m_isEof, and m_nError.
Referenced by SvFileStream::Close(), ResetError(), SvFileStream::ResetError(), SvMemoryStream::ResetError(), and SvStream().
|
protected |
Encrypt and write.
Definition at line 1359 of file stream.cxx.
References CRYPT_BUFSIZE, m_nCryptMask, nCount, PutData(), and swapNibbles().
Referenced by FlushBuffer(), and WriteBytes().
|
protected |
Definition at line 1390 of file stream.cxx.
References m_nCryptMask, n, and swapNibbles().
Referenced by ReadBytes(), and RefreshBuffer().
|
inline |
end of input seen during previous i/o operation
Definition at line 395 of file stream.hxx.
Referenced by ZCodec::InitDecompress().
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().
void SvStream::FlushBuffer | ( | ) |
If we have data in our internal buffers, write them out.
Definition at line 1101 of file stream.cxx.
References CryptAndWriteBuffer(), m_isDirty, m_nBufActualLen, m_nBufFilePos, m_nCryptMask, m_pRWBuf, PutData(), SeekPos(), SetError(), and SVSTREAM_WRITE_ERROR.
Referenced by SvFileStream::Close(), Flush(), SvMemoryStream::MakeReadOnly(), ReadBytes(), RefreshBuffer(), Seek(), SetBufferSize(), SvMemoryStream::SwitchBuffer(), TellEnd(), WriteBytes(), and SvMemoryStream::~SvMemoryStream().
|
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().
|
inline |
Definition at line 382 of file stream.hxx.
|
inline |
Definition at line 216 of file stream.hxx.
|
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().
SvStreamEndian SvStream::GetEndian | ( | ) | const |
Definition at line 371 of file stream.cxx.
|
inline |
Definition at line 204 of file stream.hxx.
References ErrCode::IgnoreWarning().
Referenced by ZCodec::AttemptDecompression(), FlushData(), GetData(), PutData(), SvMemoryStream::PutData(), read_zeroTerminated_uInt8s_ToOString(), ReadLine(), ReadUniStringLine(), SeekPos(), VersionCompatRead::VersionCompatRead(), and VersionCompatWrite::VersionCompatWrite().
|
inline |
Definition at line 205 of file stream.hxx.
Referenced by SvLockBytes::Flush(), SvLockBytes::ReadAt(), SvLockBytes::SetSize(), SvStream(), and SvLockBytes::WriteAt().
|
inline |
Definition at line 226 of file stream.hxx.
|
inline |
Definition at line 202 of file stream.hxx.
References m_xLockBytes.
|
inline |
Definition at line 222 of file stream.hxx.
Referenced by endlub().
|
inline |
Definition at line 387 of file stream.hxx.
|
inline |
Definition at line 389 of file stream.hxx.
Referenced by SetCryptMaskKey().
|
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 413 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().
|
inline |
returns status of endian swap flag
Definition at line 212 of file stream.hxx.
Referenced by read_uInt16s_ToOUString(), and write_uInt16s_FromOUString().
|
inline |
Definition at line 386 of file stream.hxx.
|
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().
std::size_t SvStream::ReadBytes | ( | void * | pData, |
std::size_t | nSize | ||
) |
Definition at line 1114 of file stream.cxx.
References EncryptBuffer(), ERRCODE_IO_PENDING, ERRCODE_NONE, FlushBuffer(), GetData(), m_isEof, m_isIoRead, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFilePos, m_nBufFree, m_nBufSize, m_nCryptMask, m_nError, m_pBufPos, m_pRWBuf, o3tl::make_unsigned(), nCount, pData, and SeekPos().
Referenced by ZCodec::Compress(), ZCodec::Decompress(), tools::Polygon::ImplRead(), tools::XmlWalker::open(), ZCodec::Read(), read_uInt16s_ToOUString(), read_uInt8s_ToOString(), read_zeroTerminated_uInt8s_ToOString(), SvLockBytes::ReadAt(), ReadChar(), ReadCharAsBool(), ReadLine(), readNumberWithoutSwap_(), ReadSChar(), ReadStream(), ReadUChar(), ReadUniStringLine(), and WriteStream().
bool SvStream::ReadByteStringLine | ( | OUString & | rStr, |
rtl_TextEncoding | eSrcCharSet, | ||
sal_Int32 | nMaxBytesToRead = 0xFFFE |
||
) |
Read a line of bytes.
nMaxBytesToRead | Maximum of bytes to read, if line is longer it will be truncated. |
Definition at line 423 of file stream.cxx.
References aStr, and ReadLine().
Referenced by ReadUniOrByteStringLine().
SvStream & SvStream::ReadChar | ( | char & | rChar | ) |
Definition at line 844 of file stream.cxx.
References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().
SvStream & SvStream::ReadCharAsBool | ( | bool & | rBool | ) |
Definition at line 874 of file stream.cxx.
References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, ReadBytes(), and SAL_WARN_IF.
SvStream & SvStream::ReadDouble | ( | double & | rDouble | ) |
Definition at line 912 of file stream.cxx.
References good(), m_isSwap, n, readNumberWithoutSwap(), and SwapDouble().
SvStream & SvStream::ReadFloat | ( | float & | rFloat | ) |
Definition at line 897 of file stream.cxx.
References good(), m_isSwap, n, readNumberWithoutSwap(), and SwapFloat().
SvStream & SvStream::ReadInt16 | ( | sal_Int16 & | rInt16 | ) |
Definition at line 824 of file stream.cxx.
References ReadNumber().
SvStream & SvStream::ReadInt32 | ( | sal_Int32 & | rInt32 | ) |
Definition at line 825 of file stream.cxx.
References ReadNumber().
Referenced by tools::GenericTypeSerializer::readFraction(), tools::GenericTypeSerializer::readPoint(), tools::GenericTypeSerializer::readRectangle(), and tools::GenericTypeSerializer::readSize().
SvStream & SvStream::ReadInt64 | ( | sal_Int64 & | rInt64 | ) |
Definition at line 826 of file stream.cxx.
References ReadNumber().
bool SvStream::ReadLine | ( | OString & | rStr, |
sal_Int32 | nMaxBytesToRead = 0xFFFE |
||
) |
Definition at line 432 of file stream.cxx.
References aBuf, and ReadLine().
bool SvStream::ReadLine | ( | OStringBuffer & | rStr, |
sal_Int32 | nMaxBytesToRead = 0xFFFE |
||
) |
Read a line of bytes.
nMaxBytesToRead | Maximum of bytes to read, if line is longer it will be truncated. |
Definition at line 440 of file stream.cxx.
References aBuf, GetError(), m_isEof, o3tl::make_unsigned(), n, ReadBytes(), Seek(), and Tell().
Referenced by ReadByteStringLine(), and ReadLine().
|
private |
Definition at line 808 of file stream.cxx.
References good(), m_isSwap, n, readNumberWithoutSwap(), and SwapNumber().
Referenced by ReadInt16(), ReadInt32(), ReadInt64(), ReadUInt16(), ReadUInt32(), ReadUInt64(), and ReadUtf16().
|
inlineprivate |
Definition at line 420 of file stream.hxx.
Referenced by ReadDouble(), ReadFloat(), and ReadNumber().
|
private |
Definition at line 120 of file stream.cxx.
References i, m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().
SvStream & SvStream::ReadSChar | ( | signed char & | rChar | ) |
Definition at line 828 of file stream.cxx.
References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().
Definition at line 927 of file stream.cxx.
References nCount, ReadBytes(), and WriteBytes().
SvStream & SvStream::ReadUChar | ( | unsigned char & | rChar | ) |
Definition at line 858 of file stream.cxx.
References m_isIoRead, m_nBufActualPos, m_nBufFree, m_pBufPos, and ReadBytes().
Referenced by tools::Polygon::ImplRead(), ZCodec::InitDecompress(), read_uInt8_lenPrefixed_uInt8s_ToOString(), and StartReadingUnicodeText().
SvStream & SvStream::ReadUInt16 | ( | sal_uInt16 & | rUInt16 | ) |
Definition at line 821 of file stream.cxx.
References ReadNumber().
Referenced by ZCodec::InitDecompress(), ZCodec::IsZCompressed(), tools::PolyPolygon::Read(), read_uInt16_lenPrefixed_uInt16s_ToOUString(), read_uInt16_lenPrefixed_uInt8s_ToOString(), tools::GenericTypeSerializer::readColor(), and VersionCompatRead::VersionCompatRead().
SvStream & SvStream::ReadUInt32 | ( | sal_uInt32 & | rUInt32 | ) |
Definition at line 822 of file stream.cxx.
References ReadNumber().
Referenced by read_uInt32_lenPrefixed_uInt16s_ToOUString(), read_uInt32_lenPrefixed_uInt8s_ToOString(), and VersionCompatRead::VersionCompatRead().
SvStream & SvStream::ReadUInt64 | ( | sal_uInt64 & | rUInt64 | ) |
Definition at line 823 of file stream.cxx.
References ReadNumber().
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().
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.
nMaxCodepointsToRead | Maximum of codepoints (2 bytes if Unicode, bytes if not Unicode) to read, if line is longer it will be truncated. |
Definition at line 599 of file stream.cxx.
References ReadByteStringLine(), and ReadUniStringLine().
bool SvStream::ReadUniStringLine | ( | OUString & | rStr, |
sal_Int32 | nMaxCodepointsToRead | ||
) |
Read a line of Unicode.
nMaxCodepointsToRead | Maximum of codepoints (UCS-2 or UTF-16 pairs, not bytes) to read, if line is longer it will be truncated. |
Definition at line 513 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().
SvStream & SvStream::ReadUtf16 | ( | sal_Unicode & | rUtf16 | ) |
Definition at line 872 of file stream.cxx.
References ReadNumber().
void SvStream::RefreshBuffer | ( | ) |
Definition at line 1344 of file stream.cxx.
References EncryptBuffer(), ERRCODE_IO_PENDING, ERRCODE_NONE, FlushBuffer(), GetData(), m_isIoRead, m_isIoWrite, m_nBufActualLen, m_nBufFilePos, m_nBufSize, m_nCryptMask, m_nError, m_pRWBuf, and SeekPos().
sal_uInt64 SvStream::remainingSize | ( | ) |
Definition at line 1320 of file stream.cxx.
References Tell(), and TellEnd().
Referenced by tools::isEmptyFileUrl(), tools::XmlWalker::open(), tools::PolyPolygon::Read(), read_uInt16s_ToOUString(), and read_uInt8s_ToOString().
|
virtual |
Reimplemented in SvFileStream, and SvMemoryStream.
Definition at line 418 of file stream.cxx.
References ClearError().
sal_uInt64 SvStream::Seek | ( | sal_uInt64 | nPos | ) |
Definition at line 1262 of file stream.cxx.
References DBG_ASSERT, FlushBuffer(), m_isEof, m_isIoRead, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFilePos, m_nBufFree, m_pBufPos, m_pRWBuf, SeekPos(), and Tell().
Referenced by ZCodec::AttemptDecompression(), checkSeek(), ZCodec::Compress(), ZCodec::EndCompression(), ZCodec::InitCompress(), ZCodec::InitDecompress(), ZCodec::IsZCompressed(), read_zeroTerminated_uInt8s_ToOString(), SvLockBytes::ReadAt(), ReadLine(), ReadUniStringLine(), SeekRel(), SvMemoryStream::SetBuffer(), StartReadingUnicodeText(), SvMemoryStream::SwitchBuffer(), TellEnd(), SvLockBytes::WriteAt(), and VersionCompatWrite::~VersionCompatWrite().
|
protectedvirtual |
Reimplemented in SvFileStream, and SvMemoryStream.
Definition at line 265 of file stream.cxx.
References DBG_ASSERT, GetError(), m_nActPos, m_xLockBytes, nPos, SvLockBytesStat::nSize, SAL_MAX_UINT32, and STREAM_SEEK_TO_END.
Referenced by FlushBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SetBufferSize(), and WriteBytes().
sal_uInt64 SvStream::SeekRel | ( | sal_Int64 | nPos | ) |
Definition at line 784 of file stream.cxx.
References m_pBufPos, m_pRWBuf, o3tl::make_unsigned(), nPos, SAL_MAX_UINT64, Seek(), and Tell().
Referenced by ZCodec::EndCompression(), ZCodec::InitDecompress(), VersionCompatWrite::VersionCompatWrite(), and VersionCompatRead::~VersionCompatRead().
void SvStream::SetBufferSize | ( | sal_uInt16 | m_nBufSize | ) |
Definition at line 380 of file stream.cxx.
References FlushBuffer(), m_isDirty, m_isIoRead, m_isIoWrite, m_isWritable, m_nBufActualLen, m_nBufActualPos, m_nBufFilePos, m_nBufSize, m_pBufPos, m_pRWBuf, SeekPos(), and Tell().
Referenced by SvMemoryStream::MakeReadOnly(), SvMemoryStream::SetBuffer(), SetStreamSize(), SvFileStream::SvFileStream(), SvMemoryStream::SvMemoryStream(), SvStream(), and SvMemoryStream::SwitchBuffer().
|
inline |
Definition at line 214 of file stream.hxx.
void SvStream::SetCryptMaskKey | ( | const OString & | rCryptMaskKey | ) |
Definition at line 1439 of file stream.cxx.
References GetVersion(), implGetCryptMask(), m_aCryptMaskKey, and m_nCryptMask.
void SvStream::SetEndian | ( | SvStreamEndian | SvStreamEndian | ) |
Definition at line 362 of file stream.cxx.
References BIG, LITTLE, and m_isSwap.
Referenced by StartReadingUnicodeText(), and SvStream().
void SvStream::SetError | ( | ErrCode | nErrorCode | ) |
Definition at line 356 of file stream.cxx.
References ERRCODE_NONE, and m_nError.
Referenced by FlushBuffer(), SvFileStream::FlushData(), SvFileStream::GetData(), SvFileStream::LockFile(), SvFileStream::Open(), SvFileStream::PutData(), SvMemoryStream::PutData(), SvFileStream::SeekPos(), SvFileStream::SetSize(), SvMemoryStream::SetSize(), SvStream(), and WriteBytes().
|
inline |
Definition at line 224 of file stream.hxx.
|
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().
|
inline |
Definition at line 220 of file stream.hxx.
bool SvStream::SetStreamSize | ( | sal_uInt64 | nSize | ) |
Definition at line 1446 of file stream.cxx.
References DBG_ASSERT, ERRCODE_NONE, m_nBufFilePos, m_nBufSize, m_nError, SetBufferSize(), SetSize(), and Tell().
Referenced by SvLockBytes::SetSize().
|
inline |
Definition at line 390 of file stream.hxx.
References n.
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 727 of file stream.cxx.
References BIG, LITTLE, ReadUChar(), Seek(), SetEndian(), and Tell().
void SvStream::StartWritingUnicodeText | ( | ) |
Switch to no endian swapping and write 0xfeff.
Definition at line 718 of file stream.cxx.
References m_isSwap, and WriteUInt16().
|
inline |
Definition at line 271 of file stream.hxx.
Referenced by ZCodec::AttemptDecompression(), ZCodec::IsZCompressed(), read_zeroTerminated_uInt8s_ToOString(), ReadLine(), ReadUniStringLine(), remainingSize(), Seek(), SeekRel(), SetBufferSize(), SetStreamSize(), StartReadingUnicodeText(), TellEnd(), VersionCompatRead::VersionCompatRead(), VersionCompatWrite::VersionCompatWrite(), VersionCompatRead::~VersionCompatRead(), and VersionCompatWrite::~VersionCompatWrite().
|
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().
|
inline |
Definition at line 256 of file stream.hxx.
Referenced by tools::Polygon::ImplWrite().
std::size_t SvStream::WriteBytes | ( | const void * | pData, |
std::size_t | nSize | ||
) |
Definition at line 1192 of file stream.cxx.
References CryptAndWriteBuffer(), ERRCODE_IO_CANTWRITE, FlushBuffer(), m_isDirty, m_isIoRead, m_isIoWrite, m_isWritable, m_nBufActualLen, m_nBufActualPos, m_nBufFilePos, m_nBufFree, m_nBufSize, m_nCryptMask, m_pBufPos, m_pRWBuf, o3tl::make_unsigned(), nCount, pData, PutData(), SeekPos(), and SetError().
Referenced by ZCodec::EndCompression(), tools::Polygon::ImplWrite(), ZCodec::ImplWriteBack(), ReadStream(), write_uInt16s_FromOUString(), write_uInt8s_FromOString(), SvLockBytes::WriteAt(), WriteChar(), WriteLine(), writeNumberWithoutSwap_(), WriteSChar(), WriteStream(), WriteUChar(), and WriteUniOrByteChar().
bool SvStream::WriteByteStringLine | ( | std::u16string_view | rStr, |
rtl_TextEncoding | eDestCharSet | ||
) |
Definition at line 694 of file stream.cxx.
References OUStringToOString(), and WriteLine().
SvStream & SvStream::WriteChar | ( | char | nChar | ) |
Definition at line 976 of file stream.cxx.
References m_isDirty, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFree, m_pBufPos, v, and WriteBytes().
Referenced by endl().
SvStream & SvStream::WriteDouble | ( | const double & | rDouble | ) |
Definition at line 1032 of file stream.cxx.
References m_isSwap, SwapDouble(), and writeNumberWithoutSwap().
SvStream & SvStream::WriteFloat | ( | float | nFloat | ) |
Definition at line 1022 of file stream.cxx.
References m_isSwap, SwapFloat(), v, and writeNumberWithoutSwap().
SvStream & SvStream::WriteInt16 | ( | sal_Int16 | nInt16 | ) |
Definition at line 952 of file stream.cxx.
References v, and WriteNumber().
SvStream & SvStream::WriteInt32 | ( | sal_Int32 | nInt32 | ) |
Definition at line 953 of file stream.cxx.
References v, and WriteNumber().
Referenced by tools::GenericTypeSerializer::writeFraction(), tools::GenericTypeSerializer::writePoint(), tools::GenericTypeSerializer::writeRectangle(), and tools::GenericTypeSerializer::writeSize().
SvStream & SvStream::WriteInt64 | ( | sal_Int64 | nInt64 | ) |
Definition at line 954 of file stream.cxx.
References v, and WriteNumber().
bool SvStream::WriteLine | ( | std::string_view | rStr | ) |
Definition at line 699 of file stream.cxx.
References endl(), ERRCODE_NONE, m_nError, and WriteBytes().
Referenced by WriteByteStringLine().
|
private |
Definition at line 941 of file stream.cxx.
References m_isSwap, n, SwapNumber(), and writeNumberWithoutSwap().
Referenced by WriteInt16(), WriteInt32(), WriteInt64(), WriteUInt16(), WriteUInt32(), and WriteUInt64().
Definition at line 265 of file stream.hxx.
References n.
|
inlineprivate |
Definition at line 426 of file stream.hxx.
Referenced by WriteDouble(), WriteFloat(), and WriteNumber().
|
private |
Definition at line 137 of file stream.cxx.
References i, m_isDirty, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFree, m_pBufPos, and WriteBytes().
|
inline |
Definition at line 251 of file stream.hxx.
SvStream & SvStream::WriteSChar | ( | signed char | nChar | ) |
Definition at line 956 of file stream.cxx.
References m_isDirty, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFree, m_pBufPos, v, and WriteBytes().
Definition at line 1050 of file stream.cxx.
References nCount, ReadBytes(), and WriteBytes().
sal_uInt64 SvStream::WriteStream | ( | SvStream & | rStream, |
sal_uInt64 | nSize | ||
) |
Definition at line 1063 of file stream.cxx.
References nCount, ReadBytes(), and WriteBytes().
SvStream & SvStream::WriteUChar | ( | unsigned char | nChar | ) |
Definition at line 994 of file stream.cxx.
References m_isDirty, m_isIoWrite, m_nBufActualLen, m_nBufActualPos, m_nBufFree, m_pBufPos, v, and WriteBytes().
Referenced by WriteUInt8().
SvStream & SvStream::WriteUInt16 | ( | sal_uInt16 | nUInt16 | ) |
Definition at line 949 of file stream.cxx.
References v, and WriteNumber().
Referenced by ZCodec::EndCompression(), StartWritingUnicodeText(), VersionCompatWrite::VersionCompatWrite(), tools::PolyPolygon::Write(), write_uInt16_lenPrefixed_uInt16s_FromOUString(), write_uInt16_lenPrefixed_uInt8s_FromOString(), tools::GenericTypeSerializer::writeColor(), and WriteUnicode().
SvStream & SvStream::WriteUInt32 | ( | sal_uInt32 | nUInt32 | ) |
Definition at line 950 of file stream.cxx.
References v, and WriteNumber().
Referenced by ZCodec::EndCompression(), write_uInt32_lenPrefixed_uInt16s_FromOUString(), and VersionCompatWrite::~VersionCompatWrite().
SvStream & SvStream::WriteUInt64 | ( | sal_uInt64 | nuInt64 | ) |
Definition at line 951 of file stream.cxx.
References v, and WriteNumber().
Definition at line 1012 of file stream.cxx.
References v, and WriteUChar().
Referenced by ZCodec::EndCompression().
SvStream & SvStream::WriteUnicode | ( | sal_Unicode | v | ) |
Definition at line 1017 of file stream.cxx.
References v, and WriteUInt16().
Referenced by endlu(), and WriteUniOrByteChar().
|
inline |
Definition at line 369 of file stream.hxx.
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 679 of file stream.cxx.
References aStr, ERRCODE_NONE, m_nError, OUStringToOString(), write_uInt16s_FromOUString(), and write_uInt8s_FromOString().
|
inline |
Definition at line 378 of file stream.hxx.
References ch.
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 706 of file stream.cxx.
References aStr, ch, ERRCODE_NONE, m_nError, WriteBytes(), and WriteUnicode().
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().
Definition at line 432 of file stream.hxx.
|
private |
Definition at line 170 of file stream.hxx.
Referenced by SetCryptMaskKey().
|
private |
Definition at line 166 of file stream.hxx.
|
private |
Definition at line 167 of file stream.hxx.
|
protected |
Definition at line 181 of file stream.hxx.
Referenced by SvFileStream::LockFile(), and SvFileStream::Open().
|
private |
true: Stream != buffer content
Definition at line 161 of file stream.hxx.
Referenced by ClearBuffer(), FlushBuffer(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().
|
private |
Definition at line 163 of file stream.hxx.
Referenced by ClearBuffer(), ClearError(), ReadBytes(), ReadLine(), ReadUniStringLine(), and Seek().
|
private |
Definition at line 157 of file stream.hxx.
Referenced by ClearBuffer(), ReadBytes(), ReadChar(), ReadCharAsBool(), readNumberWithoutSwap_(), ReadSChar(), ReadUChar(), RefreshBuffer(), Seek(), SetBufferSize(), and WriteBytes().
|
private |
Definition at line 158 of file stream.hxx.
Referenced by ClearBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().
|
private |
Definition at line 162 of file stream.hxx.
Referenced by GetEndian(), ReadDouble(), ReadFloat(), ReadNumber(), ReadUniStringLine(), SetEndian(), StartWritingUnicodeText(), WriteDouble(), WriteFloat(), and WriteNumber().
|
protected |
Definition at line 182 of file stream.hxx.
Referenced by SvFileStream::Close(), Flush(), SvFileStream::LockFile(), SvMemoryStream::MakeReadOnly(), SvFileStream::Open(), SvMemoryStream::ReAllocateMemory(), SetBufferSize(), SvMemoryStream::SetSize(), SvFileStream::SvFileStream(), SvMemoryStream::SvMemoryStream(), and WriteBytes().
|
private |
Definition at line 146 of file stream.hxx.
|
private |
Length of used segment of buffer.
= m_nBufSize, if EOF did not occur
Definition at line 153 of file stream.hxx.
Referenced by ClearBuffer(), FlushBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().
|
private |
current position in buffer (0..m_nBufSize-1)
Definition at line 155 of file stream.hxx.
Referenced by ClearBuffer(), ReadBytes(), ReadChar(), ReadCharAsBool(), readNumberWithoutSwap_(), ReadSChar(), ReadUChar(), Seek(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().
|
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().
|
private |
number of free slots in buffer to IO of type eIOMode
Definition at line 156 of file stream.hxx.
Referenced by ReadBytes(), ReadChar(), ReadCharAsBool(), readNumberWithoutSwap_(), ReadSChar(), ReadUChar(), Seek(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().
|
private |
Allocated size of buffer.
Definition at line 152 of file stream.hxx.
Referenced by ReadBytes(), RefreshBuffer(), SetBufferSize(), SetStreamSize(), and WriteBytes().
|
private |
Definition at line 165 of file stream.hxx.
|
private |
Definition at line 171 of file stream.hxx.
Referenced by CryptAndWriteBuffer(), EncryptBuffer(), FlushBuffer(), ReadBytes(), RefreshBuffer(), SetCryptMaskKey(), and WriteBytes().
|
private |
Definition at line 164 of file stream.hxx.
Referenced by ClearError(), FlushData(), GetData(), PutData(), ReadBytes(), RefreshBuffer(), SetError(), SetSize(), SetStreamSize(), WriteLine(), WriteUnicodeOrByteText(), and WriteUniOrByteChar().
|
private |
Definition at line 174 of file stream.hxx.
|
private |
m_pRWBuf + m_nBufActualPos
Definition at line 151 of file stream.hxx.
Referenced by ClearBuffer(), ReadBytes(), ReadChar(), ReadCharAsBool(), readNumberWithoutSwap_(), ReadSChar(), ReadUChar(), Seek(), SeekRel(), SetBufferSize(), WriteBytes(), WriteChar(), writeNumberWithoutSwap_(), WriteSChar(), and WriteUChar().
|
private |
Points to read/write buffer.
Definition at line 150 of file stream.hxx.
Referenced by ClearBuffer(), FlushBuffer(), ReadBytes(), RefreshBuffer(), Seek(), SeekRel(), SetBufferSize(), and WriteBytes().
|
private |
Default implementation.
Definition at line 145 of file stream.hxx.
Referenced by FlushData(), GetData(), PutData(), SeekPos(), SetSize(), SvStream(), and ~SvStream().