LibreOffice Module tools (master) 1
|
#include <config_options.h>
#include <tools/toolsdllapi.h>
#include <tools/lineend.hxx>
#include <tools/long.hxx>
#include <tools/ref.hxx>
#include <comphelper/errcode.hxx>
#include <rtl/string.hxx>
#include <rtl/strbuf.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <memory>
#include <string_view>
Go to the source code of this file.
Classes | |
struct | o3tl::typed_flags< StreamMode > |
struct | o3tl::typed_flags< SvStreamCompressFlags > |
struct | SvLockBytesStat |
class | SvLockBytes |
class | SvStream |
class | SvFileStream |
class | SvMemoryStream |
Namespaces | |
namespace | o3tl |
namespace | tools |
Note: this class is a true marvel of engineering: because the author could not decide whether it's better to have a closed or half-open interval, they just implemented both in the same class! | |
Macros | |
#define | STREAM_SEEK_TO_BEGIN 0L |
#define | STREAM_SEEK_TO_END SAL_MAX_UINT64 |
Typedefs | |
typedef SvStream &(* | SvStrPtr) (SvStream &) |
typedef tools::SvRef< SvLockBytes > | SvLockBytesRef |
Enumerations | |
enum class | StreamMode { NONE = 0x0000 , READ = 0x0001 , WRITE = 0x0002 , NOCREATE = 0x0004 , TRUNC = 0x0008 , COPY_ON_SYMLINK = 0x0010 , TEMPORARY = 0x0020 , DELETE_ON_CLOSE = 0x0040 , SHARE_DENYNONE = 0x0100 , SHARE_DENYREAD = 0x0200 , SHARE_DENYWRITE = 0x0400 , SHARE_DENYALL = 0x0800 , READWRITE = READ | WRITE , STD_READ = READ | SHARE_DENYNONE | NOCREATE , STD_WRITE = WRITE | SHARE_DENYALL , STD_READWRITE = READWRITE | SHARE_DENYALL } |
enum class | SvStreamEndian { BIG , LITTLE } |
enum class | SvStreamCompressFlags { NONE = 0x0000 , ZBITMAP = 0x0001 , NATIVE = 0x0010 } |
Functions | |
rtl_TextEncoding | GetStoreCharSet (rtl_TextEncoding eEncoding) |
SvStream & | operator<< (SvStream &rStr, SvStrPtr f) |
TOOLS_DLLPUBLIC SvStream & | endl (SvStream &rStr) |
TOOLS_DLLPUBLIC SvStream & | endlu (SvStream &rStr) |
same as endl() but Unicode More... | |
TOOLS_DLLPUBLIC SvStream & | endlub (SvStream &rStr) |
call endlu() if m_eStreamCharSet==RTL_TEXTECODING_UNICODE otherwise endl() More... | |
TOOLS_DLLPUBLIC OString | read_uInt8s_ToOString (SvStream &rStrm, std::size_t nUnits) |
Attempt to read nUnits 8bit units to an OString, returned OString's length is number of units successfully read. More... | |
OUString | read_uInt8s_ToOUString (SvStream &rStrm, std::size_t nUnits, rtl_TextEncoding eEnc) |
Attempt to read nUnits 8bit units to an OUString. More... | |
TOOLS_DLLPUBLIC OUString | read_uInt16s_ToOUString (SvStream &rStrm, std::size_t nUnits) |
Attempt to read nUnits 16bit units to an OUString, returned OUString's length is number of units successfully read. More... | |
OUString | read_uInt16_lenPrefixed_uInt16s_ToOUString (SvStream &rStrm) |
Attempt to read a pascal-style length (of type prefix) prefixed sequence of 16bit units to an OUString, returned OString's length is number of units successfully read. More... | |
OUString | read_uInt32_lenPrefixed_uInt16s_ToOUString (SvStream &rStrm) |
TOOLS_DLLPUBLIC std::size_t | write_uInt16s_FromOUString (SvStream &rStrm, std::u16string_view rStr, std::size_t nUnits) |
Attempt to write a prefixed sequence of nUnits 16bit units from an OUString, returned value is number of bytes written. More... | |
std::size_t | write_uInt16s_FromOUString (SvStream &rStrm, std::u16string_view rStr) |
std::size_t | write_uInt32_lenPrefixed_uInt16s_FromOUString (SvStream &rStrm, std::u16string_view rStr) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of 16bit units from an OUString, returned value is number of bytes written (including byte-count of prefix) More... | |
UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) std TOOLS_DLLPUBLIC OString | read_zeroTerminated_uInt8s_ToOString (SvStream &rStrm) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of 16bit units from an OUString, returned value is number of bytes written (including byte-count of prefix) More... | |
TOOLS_DLLPUBLIC OUString | read_zeroTerminated_uInt8s_ToOUString (SvStream &rStrm, rtl_TextEncoding eEnc) |
Attempt to read 8bit units assuming source encoding eEnc to an OUString until a zero terminator is encountered. More... | |
OString | read_uInt32_lenPrefixed_uInt8s_ToOString (SvStream &rStrm) |
Attempt to read a pascal-style length (of type prefix) prefixed sequence of 8bit units to an OString, returned OString's length is number of units successfully read. More... | |
OString | read_uInt16_lenPrefixed_uInt8s_ToOString (SvStream &rStrm) |
OString | read_uInt8_lenPrefixed_uInt8s_ToOString (SvStream &rStrm) |
OUString | read_uInt16_lenPrefixed_uInt8s_ToOUString (SvStream &rStrm, rtl_TextEncoding eEnc) |
OUString | read_uInt8_lenPrefixed_uInt8s_ToOUString (SvStream &rStrm, rtl_TextEncoding eEnc) |
std::size_t | write_uInt8s_FromOString (SvStream &rStrm, std::string_view rStr, std::size_t nUnits) |
Attempt to write a prefixed sequence of nUnits 8bit units from an OString, returned value is number of bytes written. More... | |
std::size_t | write_uInt8s_FromOString (SvStream &rStrm, std::string_view rStr) |
TOOLS_DLLPUBLIC std::size_t | write_uInt16_lenPrefixed_uInt8s_FromOString (SvStream &rStrm, std::string_view rStr) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of units from a string-type, returned value is number of bytes written (including byte-count of prefix) More... | |
std::size_t | write_uInt16_lenPrefixed_uInt8s_FromOUString (SvStream &rStrm, std::u16string_view rStr, rtl_TextEncoding eEnc) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of 8bit units from an OUString, returned value is number of bytes written (including byte-count of prefix) More... | |
TOOLS_DLLPUBLIC bool | checkSeek (SvStream &rSt, sal_uInt64 nOffset) |
bool | tools::isEmptyFileUrl (const OUString &rUrl) |
Is rUrl a file:// URL with no contents? More... | |
#define STREAM_SEEK_TO_BEGIN 0L |
Definition at line 72 of file stream.hxx.
#define STREAM_SEEK_TO_END SAL_MAX_UINT64 |
Definition at line 73 of file stream.hxx.
typedef tools::SvRef<SvLockBytes> SvLockBytesRef |
Definition at line 137 of file stream.hxx.
Definition at line 89 of file stream.hxx.
|
strong |
Definition at line 46 of file stream.hxx.
|
strong |
Enumerator | |
---|---|
NONE | |
ZBITMAP | |
NATIVE |
Definition at line 77 of file stream.hxx.
|
strong |
Enumerator | |
---|---|
BIG | |
LITTLE |
Definition at line 75 of file stream.hxx.
TOOLS_DLLPUBLIC bool checkSeek | ( | SvStream & | rSt, |
sal_uInt64 | nOffset | ||
) |
Definition at line 1292 of file stream.cxx.
References SvStream::Seek(), and SvStream::TellEnd().
TOOLS_DLLPUBLIC SvStream & endl | ( | SvStream & | rStr | ) |
Definition at line 1465 of file stream.cxx.
References SvStream::GetLineDelimiter(), LINEEND_CR, LINEEND_LF, and SvStream::WriteChar().
Referenced by endlub(), and SvStream::WriteLine().
TOOLS_DLLPUBLIC SvStream & endlu | ( | SvStream & | rStr | ) |
same as endl() but Unicode
Definition at line 1477 of file stream.cxx.
References SvStream::GetLineDelimiter(), LINEEND_CR, LINEEND_LF, rStrm, and SvStream::WriteUnicode().
Referenced by endlub().
TOOLS_DLLPUBLIC SvStream & endlub | ( | SvStream & | rStr | ) |
call endlu() if m_eStreamCharSet==RTL_TEXTECODING_UNICODE otherwise endl()
Definition at line 1493 of file stream.cxx.
References endl(), endlu(), SvStream::GetStreamCharSet(), and rStrm.
|
inline |
Definition at line 35 of file stream.hxx.
Definition at line 432 of file stream.hxx.
|
inline |
Attempt to read a pascal-style length (of type prefix) prefixed sequence of 16bit units to an OUString, returned OString's length is number of units successfully read.
Definition at line 464 of file stream.hxx.
References read_uInt16s_ToOUString(), SvStream::ReadUInt16(), and rStrm.
|
inline |
Definition at line 521 of file stream.hxx.
References read_uInt8s_ToOString(), SvStream::ReadUInt16(), and rStrm.
Referenced by read_uInt16_lenPrefixed_uInt8s_ToOUString().
|
inline |
Definition at line 535 of file stream.hxx.
References read_uInt16_lenPrefixed_uInt8s_ToOString(), and rStrm.
Referenced by SvStream::ReadUniOrByteString().
TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString | ( | SvStream & | rStrm, |
std::size_t | nUnits | ||
) |
Attempt to read nUnits 16bit units to an OUString, returned OUString's length is number of units successfully read.
Definition at line 1823 of file stream.cxx.
References i, SvStream::IsEndianSwap(), SvStream::ReadBytes(), SvStream::remainingSize(), rStrm, SAL_MAX_INT32, and SAL_WARN_IF.
Referenced by read_uInt16_lenPrefixed_uInt16s_ToOUString(), and read_uInt32_lenPrefixed_uInt16s_ToOUString().
|
inline |
Definition at line 471 of file stream.hxx.
References read_uInt16s_ToOUString(), SvStream::ReadUInt32(), and rStrm.
Referenced by SvStream::ReadUniOrByteString().
|
inline |
Attempt to read a pascal-style length (of type prefix) prefixed sequence of 8bit units to an OString, returned OString's length is number of units successfully read.
Definition at line 515 of file stream.hxx.
References read_uInt8s_ToOString(), SvStream::ReadUInt32(), and rStrm.
|
inline |
Definition at line 528 of file stream.hxx.
References read_uInt8s_ToOString(), SvStream::ReadUChar(), and rStrm.
Referenced by read_uInt8_lenPrefixed_uInt8s_ToOUString().
|
inline |
Definition at line 541 of file stream.hxx.
References read_uInt8_lenPrefixed_uInt8s_ToOString(), and rStrm.
TOOLS_DLLPUBLIC OString read_uInt8s_ToOString | ( | SvStream & | rStrm, |
std::size_t | nUnits | ||
) |
Attempt to read nUnits 8bit units to an OString, returned OString's length is number of units successfully read.
Definition at line 1791 of file stream.cxx.
References SvStream::ReadBytes(), SvStream::remainingSize(), rStrm, SAL_MAX_INT32, and SAL_WARN_IF.
Referenced by read_uInt16_lenPrefixed_uInt8s_ToOString(), read_uInt32_lenPrefixed_uInt8s_ToOString(), read_uInt8_lenPrefixed_uInt8s_ToOString(), and read_uInt8s_ToOUString().
|
inline |
Attempt to read nUnits 8bit units to an OUString.
Definition at line 450 of file stream.hxx.
References read_uInt8s_ToOString(), and rStrm.
UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) std TOOLS_DLLPUBLIC OString read_zeroTerminated_uInt8s_ToOString | ( | SvStream & | rStrm | ) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of 16bit units from an OUString, returned value is number of bytes written (including byte-count of prefix)
Attempt to read 8bit units to an OString until a zero terminator is encountered, returned OString's length is number of units definitely successfully read, check SvStream::good() to see if null terminator was successfully read
Definition at line 608 of file stream.cxx.
References SvStream::GetError(), SvStream::ReadBytes(), SvStream::Seek(), and SvStream::Tell().
Referenced by read_zeroTerminated_uInt8s_ToOUString().
TOOLS_DLLPUBLIC OUString read_zeroTerminated_uInt8s_ToOUString | ( | SvStream & | rStrm, |
rtl_TextEncoding | eEnc | ||
) |
Attempt to read 8bit units assuming source encoding eEnc to an OUString until a zero terminator is encountered.
Check SvStream::good() to see if null terminator was successfully read
Definition at line 644 of file stream.cxx.
References read_zeroTerminated_uInt8s_ToOString().
TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString | ( | SvStream & | rStrm, |
std::string_view | rStr | ||
) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of units from a string-type, returned value is number of bytes written (including byte-count of prefix)
Definition at line 1984 of file stream.cxx.
References SvStream::good(), rStrm, SAL_WARN_IF, write_uInt8s_FromOString(), and SvStream::WriteUInt16().
Referenced by write_uInt16_lenPrefixed_uInt8s_FromOUString().
|
inline |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of 8bit units from an OUString, returned value is number of bytes written (including byte-count of prefix)
Definition at line 569 of file stream.hxx.
References OUStringToOString(), rStrm, and write_uInt16_lenPrefixed_uInt8s_FromOString().
Referenced by SvStream::WriteUniOrByteString().
|
inline |
Definition at line 483 of file stream.hxx.
References rStrm, and write_uInt16s_FromOUString().
TOOLS_DLLPUBLIC std::size_t write_uInt16s_FromOUString | ( | SvStream & | rStrm, |
std::u16string_view | rStr, | ||
std::size_t | nUnits | ||
) |
Attempt to write a prefixed sequence of nUnits 16bit units from an OUString, returned value is number of bytes written.
Definition at line 652 of file stream.cxx.
References aBuf, DBG_ASSERT, SvStream::IsEndianSwap(), p, rStrm, SwapNumber(), and SvStream::WriteBytes().
Referenced by write_uInt16_lenPrefixed_uInt16s_FromOUString(), write_uInt16s_FromOUString(), write_uInt32_lenPrefixed_uInt16s_FromOUString(), and SvStream::WriteUnicodeOrByteText().
std::size_t write_uInt32_lenPrefixed_uInt16s_FromOUString | ( | SvStream & | rStrm, |
std::u16string_view | rStr | ||
) |
Attempt to write a pascal-style length (of type prefix) prefixed sequence of 16bit units from an OUString, returned value is number of bytes written (including byte-count of prefix)
Definition at line 1950 of file stream.cxx.
References SvStream::good(), rStrm, SAL_WARN_IF, write_uInt16s_FromOUString(), and SvStream::WriteUInt32().
Referenced by SvStream::WriteUniOrByteString().
|
inline |
Definition at line 555 of file stream.hxx.
References rStrm, and write_uInt8s_FromOString().
|
inline |
Attempt to write a prefixed sequence of nUnits 8bit units from an OString, returned value is number of bytes written.
Definition at line 549 of file stream.hxx.
References rStrm, and SvStream::WriteBytes().
Referenced by write_uInt16_lenPrefixed_uInt8s_FromOString(), write_uInt8s_FromOString(), and SvStream::WriteUnicodeOrByteText().