LibreOffice Module tools (master) 1
stream.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#pragma once
20
21#include <config_options.h>
22#include <tools/toolsdllapi.h>
23#include <tools/lineend.hxx>
24#include <tools/long.hxx>
25#include <tools/ref.hxx>
27#include <rtl/string.hxx>
28#include <rtl/strbuf.hxx>
30#include <memory>
31#include <string_view>
32
33class StreamData;
34
35inline rtl_TextEncoding GetStoreCharSet( rtl_TextEncoding eEncoding )
36{
37 if ( eEncoding == RTL_TEXTENCODING_ISO_8859_1 )
38 return RTL_TEXTENCODING_MS_1252;
39 else
40 return eEncoding;
41}
42
43// StreamTypes
44
45// read, write, create,... options
46enum class StreamMode {
47 NONE = 0x0000,
48 READ = 0x0001,
49 WRITE = 0x0002,
50// file i/o
51 NOCREATE = 0x0004,
52 TRUNC = 0x0008,
53 COPY_ON_SYMLINK = 0x0010,
54 TEMPORARY = 0x0020,
55 DELETE_ON_CLOSE = 0x0040,
56// sharing options
57 SHARE_DENYNONE = 0x0100,
58 SHARE_DENYREAD = 0x0200, // overrides denynone
59 SHARE_DENYWRITE = 0x0400, // overrides denynone
60 SHARE_DENYALL = 0x0800, // overrides denyread,write,none
61// masks
66};
67namespace o3tl
68{
69 template<> struct typed_flags<StreamMode> : is_typed_flags<StreamMode, 0x0f7f> {};
70}
71
72#define STREAM_SEEK_TO_BEGIN 0L
73#define STREAM_SEEK_TO_END SAL_MAX_UINT64
74
75enum class SvStreamEndian { BIG, LITTLE };
76
78 NONE = 0x0000,
79 ZBITMAP = 0x0001,
80 NATIVE = 0x0010,
81};
82namespace o3tl
83{
84 template<> struct typed_flags<SvStreamCompressFlags> : is_typed_flags<SvStreamCompressFlags, 0x0011> {};
85}
86
87class SvStream;
88
89typedef SvStream& (*SvStrPtr)( SvStream& );
90
91inline SvStream& operator<<( SvStream& rStr, SvStrPtr f );
92
93// SvLockBytes
94
96{
97 std::size_t nSize;
98
100};
101
103{
107
108protected:
109 void close();
110
111public:
112
113 SvLockBytes() : m_pStream(nullptr), m_bOwner(false), m_bSync(false) {}
114
115 SvLockBytes(SvStream * pTheStream, bool bTheOwner = false) :
116 m_pStream(pTheStream), m_bOwner(bTheOwner), m_bSync(false) {}
117
118 virtual ~SvLockBytes() override { close(); }
119
120 const SvStream * GetStream() const { return m_pStream; }
121
122 void SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; }
123 bool IsSynchronMode() const { return m_bSync; }
124
125 virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, std::size_t nCount,
126 std::size_t * pRead) const;
127 virtual ErrCode WriteAt(sal_uInt64 nPos, const void * pBuffer, std::size_t nCount,
128 std::size_t * pWritten);
129
130 virtual ErrCode Flush() const;
131
132 virtual ErrCode SetSize(sal_uInt64 nSize);
133
134 virtual ErrCode Stat(SvLockBytesStat * pStat) const;
135};
136
138
139// SvStream
140
142{
143private:
144 // LockBytes Interface
146 sal_uInt64 m_nActPos;
147
148 // buffer management
149 std::unique_ptr<sal_uInt8[]>
152 sal_uInt16 m_nBufSize;
153 sal_uInt16 m_nBufActualLen;
155 sal_uInt16 m_nBufActualPos;
156 sal_uInt16 m_nBufFree;
159
160 // Error codes, conversion, compression, ...
167 rtl_TextEncoding m_eStreamCharSet;
168
169 // Encryption
170 OString m_aCryptMaskKey;// aCryptMaskKey.getLength != 0 -> Encryption used
171 unsigned char m_nCryptMask;
172
173 // Userdata
174 sal_Int32 m_nVersion; // for external use
175
176 SvStream ( const SvStream& rStream ) = delete;
177 SvStream& operator=( const SvStream& rStream ) = delete;
178
179protected:
180 sal_uInt64 m_nBufFilePos;
183
184 virtual std::size_t GetData( void* pData, std::size_t nSize );
185 virtual std::size_t PutData( const void* pData, std::size_t nSize );
186 virtual sal_uInt64 SeekPos( sal_uInt64 nPos );
187 virtual void FlushData();
188 virtual void SetSize(sal_uInt64 nSize);
189
190 SAL_DLLPRIVATE void ClearError();
191 SAL_DLLPRIVATE void ClearBuffer();
192
193 // encrypt and write in blocks
194 SAL_DLLPRIVATE std::size_t CryptAndWriteBuffer( const void* pStart, std::size_t nLen );
195 SAL_DLLPRIVATE void EncryptBuffer( void* pStart, std::size_t nLen ) const;
196
197public:
198 SvStream();
199 SvStream( SvLockBytes *pLockBytes);
200 virtual ~SvStream();
201
202 SvLockBytes* GetLockBytes() const { return m_xLockBytes.get(); }
203
204 ErrCode GetError() const { return m_nError.IgnoreWarning(); }
205 ErrCode const & GetErrorCode() const { return m_nError; }
206 void SetError( ErrCode nErrorCode );
207 virtual void ResetError();
208
209 void SetEndian( SvStreamEndian SvStreamEndian );
210 SvStreamEndian GetEndian() const;
212 bool IsEndianSwap() const { return m_isSwap; }
213
215 { m_nCompressMode = nNewMode; }
216 SvStreamCompressFlags GetCompressMode() const { return m_nCompressMode; }
217
218 void SetCryptMaskKey(const OString& rCryptMaskKey);
219
220 void SetStreamCharSet( rtl_TextEncoding eCharSet )
221 { m_eStreamCharSet = eCharSet; }
222 rtl_TextEncoding GetStreamCharSet() const { return m_eStreamCharSet; }
223
224 void SetLineDelimiter( LineEnd eLineEnd )
225 { m_eLineDelimiter = eLineEnd; }
226 LineEnd GetLineDelimiter() const { return m_eLineDelimiter; }
227
228 SvStream& ReadUInt16( sal_uInt16& rUInt16 );
229 SvStream& ReadUInt32( sal_uInt32& rUInt32 );
230 SvStream& ReadUInt64( sal_uInt64& rUInt64 );
231 SvStream& ReadInt16( sal_Int16& rInt16 );
232 SvStream& ReadInt32( sal_Int32& rInt32 );
233 SvStream& ReadInt64(sal_Int64 & rInt64);
234 SvStream& ReadSChar( signed char& rChar );
235 SvStream& ReadChar( char& rChar );
236 SvStream& ReadUChar( unsigned char& rChar );
237 SvStream& ReadUtf16( sal_Unicode& rUtf16 );
238 SvStream& ReadCharAsBool( bool& rBool );
239 SvStream& ReadFloat( float& rFloat );
240 SvStream& ReadDouble( double& rDouble );
241 SvStream& ReadStream( SvStream& rStream );
242
243 SvStream& WriteUInt16( sal_uInt16 nUInt16 );
244 SvStream& WriteUInt32( sal_uInt32 nUInt32 );
245 SvStream& WriteUInt64( sal_uInt64 nuInt64 );
246 SvStream& WriteInt16( sal_Int16 nInt16 );
247 SvStream& WriteInt32( sal_Int32 nInt32 );
248 SvStream& WriteInt64( sal_Int64 nInt64 );
249 SvStream& WriteUInt8( sal_uInt8 nuInt8 );
250 SvStream& WriteUnicode( sal_Unicode );
251 SvStream& WriteOString(std::string_view rStr)
252 { WriteBytes(rStr.data(), rStr.size()); return *this; }
253 SvStream& WriteStream( SvStream& rStream );
254 sal_uInt64 WriteStream( SvStream& rStream, sal_uInt64 nSize );
255
257 { return WriteUChar(static_cast<unsigned char>(b)); }
258 SvStream& WriteSChar( signed char nChar );
259 SvStream& WriteChar( char nChar );
260 SvStream& WriteUChar( unsigned char nChar );
261 SvStream& WriteFloat( float nFloat );
262 SvStream& WriteDouble( const double& rDouble );
263
264 template <typename N>
265 SvStream& WriteNumberAsString( N n ) { return WriteOString(OString::number(n)); }
266
267 std::size_t ReadBytes( void* pData, std::size_t nSize );
268 std::size_t WriteBytes( const void* pData, std::size_t nSize );
269 sal_uInt64 Seek( sal_uInt64 nPos );
270 sal_uInt64 SeekRel( sal_Int64 nPos );
271 sal_uInt64 Tell() const { return m_nBufFilePos + m_nBufActualPos; }
272 virtual sal_uInt64 TellEnd();
273 // length between current (Tell()) pos and end of stream
274 sal_uInt64 remainingSize();
276 void FlushBuffer();
278 void Flush();
279 // next Tell() <= nSize
280 bool SetStreamSize( sal_uInt64 nSize );
281
296 bool ReadLine( OStringBuffer& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
297 bool ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
298 bool WriteLine( std::string_view rStr );
299
314 bool ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet,
315 sal_Int32 nMaxBytesToRead = 0xFFFE );
316 bool WriteByteStringLine( std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
317
319 void StartWritingUnicodeText();
320
330 void StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet );
331
338 SAL_DLLPRIVATE bool ReadUniStringLine(OUString& rStr, sal_Int32 nMaxCodepointsToRead);
342 OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet);
346 SvStream& WriteUniOrByteString( std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
347
363 bool ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet,
364 sal_Int32 nMaxCodepointsToRead = 0xFFFE );
368 bool WriteUnicodeOrByteText(std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
369 bool WriteUnicodeOrByteText(std::u16string_view rStr )
370 { return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); }
371
377 bool WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet );
379 { return WriteUniOrByteChar( ch, GetStreamCharSet() ); }
380
381 void SetBufferSize( sal_uInt16 m_nBufSize );
382 sal_uInt16 GetBufferSize() const { return m_nBufSize; }
383
384 void RefreshBuffer();
385
386 bool IsWritable() const { return m_isWritable; }
387 StreamMode GetStreamMode() const { return m_eStreamMode; }
388
389 sal_Int32 GetVersion() const { return m_nVersion; }
390 void SetVersion( sal_Int32 n ) { m_nVersion = n; }
391
392 friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // for Manips
393
395 bool eof() const { return m_isEof; }
396
398 bool bad() const { return GetError() != ERRCODE_NONE; }
399
413 bool good() const { return !(eof() || bad()); }
414
415private:
416 template <typename T> SvStream& ReadNumber(T& r);
417 template <typename T> SvStream& WriteNumber(T n);
418
419 template<typename T>
420 void readNumberWithoutSwap(T& rDataDest)
421 { readNumberWithoutSwap_(&rDataDest, sizeof(rDataDest)); }
422
423 SAL_DLLPRIVATE void readNumberWithoutSwap_(void * pDataDest, int nDataSize);
424
425 template<typename T>
426 void writeNumberWithoutSwap(T const & rDataSrc)
427 { writeNumberWithoutSwap_(&rDataSrc, sizeof(rDataSrc)); }
428
429 SAL_DLLPRIVATE void writeNumberWithoutSwap_(const void * pDataSrc, int nDataSize);
430};
431
433{
434 (*f)(rStr);
435 return rStr;
436}
437
443
447 std::size_t nUnits);
448
450inline OUString read_uInt8s_ToOUString(SvStream& rStrm,
451 std::size_t nUnits, rtl_TextEncoding eEnc)
452{
453 return OStringToOUString(read_uInt8s_ToOString(rStrm, nUnits), eEnc);
454}
455
459 std::size_t nUnits);
460
465{
466 sal_uInt16 nUnits = 0;
467 rStrm.ReadUInt16( nUnits );
468 return read_uInt16s_ToOUString(rStrm, nUnits);
469}
470
472{
473 sal_uInt32 nUnits = 0;
474 rStrm.ReadUInt32( nUnits );
475 return read_uInt16s_ToOUString(rStrm, nUnits);
476}
477
481 std::u16string_view rStr, std::size_t nUnits);
482
483inline std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
484 std::u16string_view rStr)
485{
486 return write_uInt16s_FromOUString(rStrm, rStr, rStr.size());
487}
488
493 std::u16string_view rStr);
494
499 std::u16string_view rStr);
500
506
510TOOLS_DLLPUBLIC OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc);
511
516{
517 sal_uInt32 nUnits = 0;
518 rStrm.ReadUInt32(nUnits);
519 return read_uInt8s_ToOString(rStrm, nUnits);
520}
522{
523 sal_uInt16 nUnits = 0;
524 rStrm.ReadUInt16(nUnits);
525 return read_uInt8s_ToOString(rStrm, nUnits);
526}
527
529{
530 sal_uInt8 nUnits = 0;
531 rStrm.ReadUChar(nUnits);
532 return read_uInt8s_ToOString(rStrm, nUnits);
533}
534
536 rtl_TextEncoding eEnc)
537{
538 return OStringToOUString(read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
539}
540
542 rtl_TextEncoding eEnc)
543{
544 return OStringToOUString(read_uInt8_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
545}
546
549inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view rStr,
550 std::size_t nUnits)
551{
552 return rStrm.WriteBytes(rStr.data(), nUnits);
553}
554
555inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view rStr)
556{
557 return write_uInt8s_FromOString(rStrm, rStr, rStr.size());
558}
559
564 std::string_view rStr);
565
570 std::u16string_view rStr,
571 rtl_TextEncoding eEnc)
572{
574}
575
576[[nodiscard]] TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset);
577
578namespace tools
579{
581TOOLS_DLLPUBLIC bool isEmptyFileUrl(const OUString& rUrl);
582}
583
584// FileStream
585
587{
588private:
589 void* mxFileHandle = nullptr; // on windows, it is a HANDLE, otherwise, it is a oslFileHandle
590#if defined(_WIN32)
591 sal_uInt16 nLockCounter;
592#endif
593 OUString aFilename;
595
596 SvFileStream (const SvFileStream&) = delete;
598
599 bool LockFile();
600 void UnlockFile();
601
602 virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
603 virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
604 virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
605 virtual void SetSize( sal_uInt64 nSize ) override;
606 virtual void FlushData() override;
607
608public:
609 // Switches to Read StreamMode on failed attempt of Write opening
610 SvFileStream( const OUString& rFileName, StreamMode eOpenMode );
611 SvFileStream();
612 virtual ~SvFileStream() override;
613
614 virtual void ResetError() override;
615
616 void Open( const OUString& rFileName, StreamMode eOpenMode );
617 void Close();
618 bool IsOpen() const { return bIsOpen; }
619
620 const OUString& GetFileName() const { return aFilename; }
621};
622
623// MemoryStream
624
626{
629
630protected:
631 std::size_t nSize;
632 std::size_t nResize;
633 std::size_t nPos;
634 std::size_t nEndOfData;
637
638 virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
639 virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
640 virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
641 virtual void SetSize( sal_uInt64 nSize ) override;
642 virtual void FlushData() override;
643
646 void AllocateMemory( std::size_t nSize );
647
654 bool ReAllocateMemory( tools::Long nDiff );
655
658 void FreeMemory();
659
660public:
661 SvMemoryStream( void* pBuf, std::size_t nSize, StreamMode eMode);
662 SvMemoryStream( std::size_t nInitSize=512, std::size_t nResize=64 );
663 virtual ~SvMemoryStream() override;
664
665 virtual void ResetError() override;
666
667 sal_uInt64 GetSize() { return TellEnd(); }
668 std::size_t GetEndOfData() const { return nEndOfData; }
669 const void* GetData() { FlushBuffer(); return pBuf; }
670
671 // return the buffer currently in use, and allocate a new buffer internally
672 void* SwitchBuffer();
673 // the buffer is not owned by this class
674 void SetBuffer( void* pBuf, std::size_t nSize, std::size_t nEOF );
675
676 void ObjectOwnsMemory( bool bOwn ) { bOwnsData = bOwn; }
680 void MakeReadOnly();
681 void SetResizeOffset( std::size_t nNewResize ) { nResize = nNewResize; }
682 virtual sal_uInt64 TellEnd() override { FlushBuffer(); return nEndOfData; }
683};
684
685/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ErrCode IgnoreWarning() const
bool IsOpen() const
Definition: stream.hxx:618
OUString aFilename
Definition: stream.hxx:593
const OUString & GetFileName() const
Definition: stream.hxx:620
bool bIsOpen
Definition: stream.hxx:594
SvFileStream(const SvFileStream &)=delete
void SetSynchronMode(bool bTheSync=true)
Definition: stream.hxx:122
SvLockBytes(SvStream *pTheStream, bool bTheOwner=false)
Definition: stream.hxx:115
bool m_bOwner
Definition: stream.hxx:105
bool IsSynchronMode() const
Definition: stream.hxx:123
const SvStream * GetStream() const
Definition: stream.hxx:120
SvStream * m_pStream
Definition: stream.hxx:104
virtual ~SvLockBytes() override
Definition: stream.hxx:118
bool m_bSync
Definition: stream.hxx:106
std::size_t nEndOfData
Definition: stream.hxx:634
const void * GetData()
Definition: stream.hxx:669
std::size_t nResize
Definition: stream.hxx:632
std::size_t GetEndOfData() const
Definition: stream.hxx:668
std::size_t nSize
Definition: stream.hxx:631
SvMemoryStream(const SvMemoryStream &)=delete
sal_uInt64 GetSize()
Definition: stream.hxx:667
virtual sal_uInt64 TellEnd() override
Definition: stream.hxx:682
void SetResizeOffset(std::size_t nNewResize)
Definition: stream.hxx:681
std::size_t nPos
Definition: stream.hxx:633
void ObjectOwnsMemory(bool bOwn)
Definition: stream.hxx:676
bool bOwnsData
Definition: stream.hxx:636
sal_uInt8 * pBuf
Definition: stream.hxx:635
Classes that want to be referenced-counted via SvRef<T>, should extend this base class.
Definition: ref.hxx:121
SvRefBase & operator=(const SvRefBase &)
Definition: ref.hxx:135
bool IsWritable() const
Definition: stream.hxx:386
sal_uInt64 Tell() const
Definition: stream.hxx:271
void SetCompressMode(SvStreamCompressFlags nNewMode)
Definition: stream.hxx:214
SvStream(const SvStream &rStream)=delete
bool good() const
Get state.
Definition: stream.hxx:413
sal_uInt16 m_nBufFree
number of free slots in buffer to IO of type eIOMode
Definition: stream.hxx:156
bool m_isWritable
Definition: stream.hxx:182
SvStream & WriteNumberAsString(N n)
Definition: stream.hxx:265
void readNumberWithoutSwap(T &rDataDest)
Definition: stream.hxx:420
bool WriteUniOrByteChar(sal_Unicode ch)
Definition: stream.hxx:378
SvStream & operator=(const SvStream &rStream)=delete
SvLockBytesRef m_xLockBytes
Default implementation.
Definition: stream.hxx:145
sal_uInt8 * m_pBufPos
m_pRWBuf + m_nBufActualPos
Definition: stream.hxx:151
sal_Int32 m_nVersion
Definition: stream.hxx:174
sal_uInt16 m_nBufActualPos
current position in buffer (0..m_nBufSize-1)
Definition: stream.hxx:155
sal_uInt16 GetBufferSize() const
Definition: stream.hxx:382
SvStreamCompressFlags GetCompressMode() const
Definition: stream.hxx:216
LineEnd GetLineDelimiter() const
Definition: stream.hxx:226
std::size_t WriteBytes(const void *pData, std::size_t nSize)
Definition: stream.cxx:1192
bool IsEndianSwap() const
returns status of endian swap flag
Definition: stream.hxx:212
SvStream & WriteBool(bool b)
Definition: stream.hxx:256
OString m_aCryptMaskKey
Definition: stream.hxx:170
bool eof() const
end of input seen during previous i/o operation
Definition: stream.hxx:395
bool bad() const
stream is broken
Definition: stream.hxx:398
void SetLineDelimiter(LineEnd eLineEnd)
Definition: stream.hxx:224
sal_uInt64 m_nBufFilePos
File position of pBuf[0].
Definition: stream.hxx:180
SvStream & WriteOString(std::string_view rStr)
Definition: stream.hxx:251
rtl_TextEncoding m_eStreamCharSet
Definition: stream.hxx:167
std::unique_ptr< sal_uInt8[]> m_pRWBuf
Points to read/write buffer.
Definition: stream.hxx:150
unsigned char m_nCryptMask
Definition: stream.hxx:171
sal_Int32 GetVersion() const
Definition: stream.hxx:389
bool m_isIoRead
Definition: stream.hxx:157
bool m_isDirty
true: Stream != buffer content
Definition: stream.hxx:161
StreamMode GetStreamMode() const
Definition: stream.hxx:387
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
Definition: stream.cxx:822
StreamMode m_eStreamMode
Definition: stream.hxx:181
sal_uInt16 m_nBufActualLen
Length of used segment of buffer.
Definition: stream.hxx:153
bool m_isEof
Definition: stream.hxx:163
ErrCode m_nError
Definition: stream.hxx:164
void writeNumberWithoutSwap(T const &rDataSrc)
Definition: stream.hxx:426
void SetVersion(sal_Int32 n)
Definition: stream.hxx:390
SvLockBytes * GetLockBytes() const
Definition: stream.hxx:202
bool WriteUnicodeOrByteText(std::u16string_view rStr)
Definition: stream.hxx:369
void SetStreamCharSet(rtl_TextEncoding eCharSet)
Definition: stream.hxx:220
sal_uInt64 m_nActPos
Definition: stream.hxx:146
rtl_TextEncoding GetStreamCharSet() const
Definition: stream.hxx:222
SvStreamCompressFlags m_nCompressMode
Definition: stream.hxx:165
ErrCode GetError() const
Definition: stream.hxx:204
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
Definition: stream.cxx:821
ErrCode const & GetErrorCode() const
Definition: stream.hxx:205
bool m_isSwap
Definition: stream.hxx:162
bool m_isIoWrite
Definition: stream.hxx:158
LineEnd m_eLineDelimiter
Definition: stream.hxx:166
sal_uInt16 m_nBufSize
Allocated size of buffer.
Definition: stream.hxx:152
SvStream & ReadUChar(unsigned char &rChar)
Definition: stream.cxx:858
bool close
#define ERRCODE_NONE
GtkMediaStream * m_pStream
class SAL_WARN_UNUSED UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) INetMIMEMessage
Definition: inetmsg.hxx:75
sal_Int64 n
LineEnd
Definition: lineend.hxx:17
NONE
Close
void SvStream & rStrm
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Note: this class is a true marvel of engineering: because the author could not decide whether it's be...
bool isEmptyFileUrl(const OUString &rUrl)
Is rUrl a file:// URL with no contents?
Definition: stream.cxx:1300
long Long
Definition: long.hxx:34
std::size_t write_uInt16_lenPrefixed_uInt16s_FromOUString(SvStream &rStrm, std::u16string_view rStr)
Definition: stream.cxx:1967
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 success...
Definition: stream.cxx:1791
OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream &rStrm)
Definition: stream.hxx:521
TOOLS_DLLPUBLIC SvStream & endlub(SvStream &rStr)
call endlu() if m_eStreamCharSet==RTL_TEXTECODING_UNICODE otherwise endl()
Definition: stream.cxx:1493
OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream &rStrm, rtl_TextEncoding eEnc)
Definition: stream.hxx:541
OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream &rStrm, rtl_TextEncoding eEnc)
Definition: stream.hxx:535
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 OUSt...
Definition: stream.cxx:608
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 succ...
Definition: stream.cxx:1823
SvStream & operator<<(SvStream &rStr, SvStrPtr f)
Definition: stream.hxx:432
StreamMode
Definition: stream.hxx:46
@ READ
allow read accesses
@ COPY_ON_SYMLINK
copy-on-write for symlinks (Unix-only)
@ TEMPORARY
temporary file attribute (Windows-only)
@ TRUNC
Truncate existing file to zero length.
@ NOCREATE
1 == Don't create file
@ DELETE_ON_CLOSE
only for temporary files (Windows-only)
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 OUStrin...
Definition: stream.hxx:464
SvStream &(* SvStrPtr)(SvStream &)
Definition: stream.hxx:89
rtl_TextEncoding GetStoreCharSet(rtl_TextEncoding eEncoding)
Definition: stream.hxx:35
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 en...
Definition: stream.cxx:644
OString read_uInt8_lenPrefixed_uInt8s_ToOString(SvStream &rStrm)
Definition: stream.hxx:528
OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream &rStrm)
Definition: stream.hxx:471
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 o...
Definition: stream.hxx:549
SvStreamEndian
Definition: stream.hxx:75
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,...
Definition: stream.hxx:515
tools::SvRef< SvLockBytes > SvLockBytesRef
Definition: stream.hxx:137
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)
Definition: stream.cxx:1465
SvStreamCompressFlags
Definition: stream.hxx:77
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...
Definition: stream.cxx:652
OUString read_uInt8s_ToOUString(SvStream &rStrm, std::size_t nUnits, rtl_TextEncoding eEnc)
Attempt to read nUnits 8bit units to an OUString.
Definition: stream.hxx:450
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...
Definition: stream.cxx:1984
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 OUStr...
Definition: stream.hxx:569
TOOLS_DLLPUBLIC bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
Definition: stream.cxx:1292
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 OUSt...
Definition: stream.cxx:1950
TOOLS_DLLPUBLIC SvStream & endlu(SvStream &rStr)
same as endl() but Unicode
Definition: stream.cxx:1477
std::size_t nSize
Definition: stream.hxx:97
WRITE
#define TOOLS_DLLPUBLIC
Definition: toolsdllapi.h:28
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
UcbLockBytesRef m_xLockBytes
int SetError()
int GetError()