LibreOffice Module tools (master) 1
|
#include <stream.hxx>
Public Member Functions | |
SvFileStream (const OUString &rFileName, StreamMode eOpenMode) | |
SvFileStream () | |
virtual | ~SvFileStream () override |
virtual void | ResetError () override |
set filepointer to beginning of file More... | |
void | Open (const OUString &rFileName, StreamMode eOpenMode) |
void | Close () |
bool | IsOpen () const |
const OUString & | GetFileName () const |
Public Member Functions inherited from SvStream | |
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... | |
Private Member Functions | |
SvFileStream (const SvFileStream &)=delete | |
SvFileStream & | operator= (const SvFileStream &)=delete |
bool | LockFile () |
void | UnlockFile () |
virtual std::size_t | GetData (void *pData, std::size_t nSize) override |
Does not check for EOF, makes isEof callable. More... | |
virtual std::size_t | PutData (const void *pData, std::size_t nSize) override |
virtual sal_uInt64 | SeekPos (sal_uInt64 nPos) override |
virtual void | SetSize (sal_uInt64 nSize) override |
virtual void | FlushData () override |
Private Attributes | |
void * | mxFileHandle = nullptr |
OUString | aFilename |
bool | bIsOpen |
Additional Inherited Members | |
Protected Member Functions inherited from SvStream | |
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 inherited from SvStream | |
sal_uInt64 | m_nBufFilePos |
File position of pBuf[0]. More... | |
StreamMode | m_eStreamMode |
bool | m_isWritable |
Definition at line 586 of file stream.hxx.
|
privatedelete |
SvFileStream::SvFileStream | ( | const OUString & | rFileName, |
StreamMode | eOpenMode | ||
) |
Definition at line 187 of file strmunx.cxx.
References bIsOpen, SvStream::m_isWritable, Open(), and SvStream::SetBufferSize().
SvFileStream::SvFileStream | ( | ) |
Definition at line 203 of file strmunx.cxx.
References bIsOpen, SvStream::m_isWritable, and SvStream::SetBufferSize().
|
overridevirtual |
Definition at line 210 of file strmunx.cxx.
References Close().
void SvFileStream::Close | ( | ) |
Definition at line 448 of file strmunx.cxx.
References aFilename, bIsOpen, SvStream::ClearBuffer(), SvStream::ClearError(), SvStream::FlushBuffer(), IsOpen(), SvStream::m_isWritable, mxFileHandle, SAL_INFO, and UnlockFile().
Referenced by Open(), and ~SvFileStream().
|
overrideprivatevirtual |
Reimplemented from SvStream.
Definition at line 278 of file strmunx.cxx.
References GetSvError(), mxFileHandle, and SvStream::SetError().
|
overrideprivatevirtual |
Does not check for EOF, makes isEof callable.
Reimplemented from SvStream.
Definition at line 215 of file strmunx.cxx.
References aFilename, GetSvError(), IsOpen(), mxFileHandle, pData, SAL_INFO, and SvStream::SetError().
|
inline |
Definition at line 620 of file stream.hxx.
|
inline |
Definition at line 618 of file stream.hxx.
Referenced by Close(), GetData(), tools::isEmptyFileUrl(), LockFile(), PutData(), SeekPos(), SetSize(), and UnlockFile().
|
private |
Definition at line 285 of file strmunx.cxx.
References aFilename, IsOpen(), SvStream::m_eStreamMode, SvStream::m_isWritable, OUStringToOString(), SvStream::SetError(), SHARE_DENYALL, SHARE_DENYREAD, SHARE_DENYWRITE, and SVSTREAM_LOCKING_VIOLATION.
Referenced by Open().
void SvFileStream::Open | ( | const OUString & | rFileName, |
StreamMode | eOpenMode | ||
) |
Definition at line 342 of file strmunx.cxx.
References aFilename, bIsOpen, Close(), COPY_ON_SYMLINK, GetSvError(), LockFile(), SvStream::m_eStreamMode, SvStream::m_isWritable, mxFileHandle, NOCREATE, OUStringToOString(), READ, SAL_INFO, SvStream::SetError(), TEMPORARY, TRUNC, and WRITE.
Referenced by SvFileStream().
|
privatedelete |
|
overrideprivatevirtual |
Reimplemented from SvStream.
Definition at line 232 of file strmunx.cxx.
References aFilename, GetSvError(), IsOpen(), mxFileHandle, pData, SAL_INFO, SvStream::SetError(), and SVSTREAM_DISK_FULL.
|
overridevirtual |
set filepointer to beginning of file
Reset filepointer to beginning of file.
Reimplemented from SvStream.
Definition at line 467 of file strmunx.cxx.
References SvStream::ClearError().
|
overrideprivatevirtual |
Reimplemented from SvStream.
Definition at line 251 of file strmunx.cxx.
References IsOpen(), mxFileHandle, nPos, SvStream::SetError(), STREAM_SEEK_TO_END, SVSTREAM_GENERALERROR, and SVSTREAM_SEEK_ERROR.
|
overrideprivatevirtual |
Reimplemented from SvStream.
Definition at line 472 of file strmunx.cxx.
References GetSvError(), IsOpen(), mxFileHandle, and SvStream::SetError().
|
private |
|
private |
Definition at line 593 of file stream.hxx.
Referenced by Close(), GetData(), LockFile(), Open(), and PutData().
|
private |
Definition at line 594 of file stream.hxx.
Referenced by Close(), Open(), and SvFileStream().
|
private |
Definition at line 589 of file stream.hxx.
Referenced by Close(), FlushData(), GetData(), Open(), PutData(), SeekPos(), and SetSize().