summaryrefslogtreecommitdiff
path: root/tools/inc/tools/stream.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'tools/inc/tools/stream.hxx')
-rw-r--r--tools/inc/tools/stream.hxx59
1 files changed, 6 insertions, 53 deletions
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index e6e939bbbd1b..66312b76faaf 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -28,7 +28,6 @@
#ifndef _STREAM_HXX
#define _STREAM_HXX
-#include <limits>
#include "tools/toolsdllapi.h"
#include <tools/solar.h>
#include <tools/string.hxx>
@@ -365,8 +364,10 @@ public:
SvStream& ReadByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet );
SvStream& ReadByteString( UniString& rStr ) { return ReadByteString( rStr, GetStreamCharSet() ); }
+ SvStream& ReadByteString( ByteString& rStr );
SvStream& WriteByteString( const UniString& rStr, rtl_TextEncoding eDestCharSet );
SvStream& WriteByteString( const UniString& rStr ) { return WriteByteString( rStr, GetStreamCharSet() ); }
+ SvStream& WriteByteString( const ByteString& rStr );
SvStream& WriteNumber( sal_uInt32 nUInt32 );
SvStream& WriteNumber( sal_Int32 nInt32 );
@@ -545,70 +546,22 @@ TOOLS_DLLPUBLIC SvStream& endlub( SvStream& rStr );
//Attempt to read nLen 8bit units to an OString, returned rtl::OString's length
//is number of units successfully read
-TOOLS_DLLPUBLIC rtl::OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen);
+TOOLS_DLLPUBLIC rtl::OString read_uInt8s_AsOString(SvStream& rStr, sal_Size nLen);
//Attempt to read nLen little endian 16bit units to an OUString, returned
//rtl::OUString's length is number of units successfully read
-TOOLS_DLLPUBLIC rtl::OUString read_LEuInt16s_ToOUString(SvStream& rStrm, sal_Size nLen);
+TOOLS_DLLPUBLIC rtl::OUString read_LEuInt16s_AsOUString(SvStream& rStr, sal_Size nLen);
//Attempt to read 8bit units to an OString until a zero terminator is
//encountered, returned rtl::OString's length is number of units *definitely*
//successfully read, check SvStream::good() to see if null terminator was
//sucessfully read
-TOOLS_DLLPUBLIC rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm);
+TOOLS_DLLPUBLIC rtl::OString read_zeroTerminated_uInt8s_AsOString(SvStream& rStr);
//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 sucessfully read
-TOOLS_DLLPUBLIC rtl::OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc);
-
-//Attempt to read a pascal-style length (of type prefix) prefixed sequence of
-//8bit units to an OString, returned rtl::OString's length is number of units
-//successfully read.
-template<typename prefix=sal_uInt16> rtl::OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
-{
- prefix nLen = 0;
- rStrm >> nLen;
- return read_uInt8s_ToOString(rStrm, nLen);
-}
-
-//Attempt to read a pascal-style length (of type prefix) prefixed sequence of
-//8bit units to an OUString
-template<typename prefix=sal_uInt16> rtl::OUString read_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
- rtl_TextEncoding eEnc)
-{
- return rtl::OStringToOUString(read_lenPrefixed_uInt8s_ToOString<prefix>(rStrm), eEnc);
-}
-
-//Attempt to write a pascal-style length (of type prefix) prefixed sequence of
-//8bit units from an OString, returned value is number of bytes written (including
-//byte-count of prefix)
-template<typename prefix=sal_uInt16> sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,
- const rtl::OString &rStr)
-{
- SAL_WARN_IF(rStr.getLength() > std::numeric_limits<prefix>::max(),
- "tools.stream",
- "string too long for prefix count to fit in output type");
-
- sal_Size nWritten = 0;
- prefix nLen = std::min<sal_Size>(rStr.getLength(), std::numeric_limits<prefix>::max());
- rStrm << nLen;
- if (rStrm.good())
- {
- nWritten += sizeof(prefix);
- nWritten += rStrm.Write(rStr.getStr(), nLen);
- }
- return nWritten;
-}
-
-//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)
-template<typename prefix=sal_uInt16> sal_Size write_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm,
- const rtl::OUString &rStr, rtl_TextEncoding eEnc)
-{
- return write_lenPrefixed_uInt8s_FromOString<prefix>(rStrm, rtl::OUStringToOString(rStr, eEnc));
-}
+TOOLS_DLLPUBLIC rtl::OUString read_zeroTerminated_uInt8s_AsOUString(SvStream& rStr, rtl_TextEncoding eEnc);
// --------------
// - FileStream -