summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-26 12:06:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-27 09:27:44 +0200
commit62f6d6ee8bca918e17ae167582095f4302203bed (patch)
tree976279a87d1aca3b24cb37dcf6c4b6378f6d6fdd /include
parentbde131ad18620dea03531c59893c99be09e3ce4e (diff)
use more string_view in tools/stream
Change-Id: I2a957cd72d71fea717734488cdb3670e0bcdd6f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/svtools/HtmlWriter.hxx12
-rw-r--r--include/svtools/htmlout.hxx4
-rw-r--r--include/tools/stream.hxx32
3 files changed, 24 insertions, 24 deletions
diff --git a/include/svtools/HtmlWriter.hxx b/include/svtools/HtmlWriter.hxx
index 61bebed54bae..1821336fb678 100644
--- a/include/svtools/HtmlWriter.hxx
+++ b/include/svtools/HtmlWriter.hxx
@@ -42,18 +42,18 @@ public:
void flushStack();
- void attribute(const OString& aAttribute, const char* aValue);
- void attribute(const OString& aAttribute, sal_Int32 aValue);
- void attribute(const OString& aAttribute, const OString& aValue);
- void attribute(const OString& aAttribute, std::u16string_view aValue);
+ void attribute(std::string_view aAttribute, const char* aValue);
+ void attribute(std::string_view aAttribute, sal_Int32 aValue);
+ void attribute(std::string_view aAttribute, std::string_view aValue);
+ void attribute(std::string_view aAttribute, std::u16string_view aValue);
// boolean attribute e.g. <img ismap>
- void attribute(const OString& aAttribute);
+ void attribute(std::string_view aAttribute);
void single(const OString& aContent);
void endAttribute();
/// Writes character data.
- void characters(const OString& rChars);
+ void characters(std::string_view rChars);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx
index a3b3c36bd217..14065fe4c801 100644
--- a/include/svtools/htmlout.hxx
+++ b/include/svtools/htmlout.hxx
@@ -58,7 +58,7 @@ struct HTMLOutFuncs
rtl_TextEncoding eDestEnc,
OUString *pNonConvertableChars );
- SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, const OString& rStr,
+ SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, std::string_view rStr,
bool bOn = true);
SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_uInt32 cChar,
HTMLOutContext& rContext,
@@ -107,7 +107,7 @@ struct HTMLOutFuncs
struct HtmlWriterHelper
{
- SVT_DLLPUBLIC static void applyColor( HtmlWriter& rHtmlWriter, const OString &aAttributeName, const Color& rColor);
+ SVT_DLLPUBLIC static void applyColor( HtmlWriter& rHtmlWriter, std::string_view aAttributeName, const Color& rColor);
SVT_DLLPUBLIC static void applyEvents(HtmlWriter& rHtmlWriter, const SvxMacroTableDtor& rMacroTable, const HTMLOutEvent* pEventTable, bool bOutStarBasic);
};
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index fab4b005b40b..b55a45ff3022 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -247,8 +247,8 @@ public:
SvStream& WriteInt64( sal_Int64 nInt64 );
SvStream& WriteUInt8( sal_uInt8 nuInt8 );
SvStream& WriteUnicode( sal_Unicode );
- SvStream& WriteOString(const OString& rStr)
- { WriteBytes(rStr.getStr(), rStr.getLength()); return *this; }
+ SvStream& WriteOString(std::string_view rStr)
+ { WriteBytes(rStr.data(), rStr.size()); return *this; }
SvStream& WriteStream( SvStream& rStream );
sal_uInt64 WriteStream( SvStream& rStream, sal_uInt64 nSize );
@@ -291,7 +291,7 @@ public:
causing endless loops ...
*/
bool ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
- bool WriteLine( const OString& rStr );
+ bool WriteLine( std::string_view rStr );
/** Read a line of bytes.
@@ -339,7 +339,7 @@ public:
/** 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 */
- SvStream& WriteUniOrByteString( const OUString& rStr, rtl_TextEncoding eDestCharSet );
+ SvStream& WriteUniOrByteString( std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
/** Read a line of Unicode if eSrcCharSet==RTL_TEXTENCODING_UNICODE,
otherwise read a line of Bytecode and convert from eSrcCharSet
@@ -361,8 +361,8 @@ public:
/** Write a sequence of Unicode characters if
eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of
Bytecodes converted to eDestCharSet */
- bool WriteUnicodeOrByteText( const OUString& rStr, rtl_TextEncoding eDestCharSet );
- bool WriteUnicodeOrByteText( const OUString& rStr )
+ bool WriteUnicodeOrByteText(std::u16string_view rStr, rtl_TextEncoding eDestCharSet );
+ bool WriteUnicodeOrByteText(std::u16string_view rStr )
{ return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); }
/** Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE,
@@ -471,25 +471,25 @@ inline OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
/// Attempt to write a prefixed sequence of nUnits 16bit units from an OUString,
/// returned value is number of bytes written
TOOLS_DLLPUBLIC std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
- const OUString& rStr, std::size_t nUnits);
+ std::u16string_view rStr, std::size_t nUnits);
inline std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
- const OUString& rStr)
+ std::u16string_view rStr)
{
- return write_uInt16s_FromOUString(rStrm, rStr, rStr.getLength());
+ return write_uInt16s_FromOUString(rStrm, rStr, rStr.size());
}
/// 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)
std::size_t write_uInt32_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm,
- const OUString &rStr);
+ 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)
TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm,
- const OUString &rStr);
+ std::u16string_view rStr);
/// Attempt to read 8bit units to an OString until a zero terminator is
/// encountered, returned OString's length is number of units *definitely*
@@ -539,22 +539,22 @@ inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
/// Attempt to write a prefixed sequence of nUnits 8bit units from an OString,
/// returned value is number of bytes written
-inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr,
+inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view rStr,
std::size_t nUnits)
{
- return rStrm.WriteBytes(rStr.getStr(), nUnits);
+ return rStrm.WriteBytes(rStr.data(), nUnits);
}
-inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr)
+inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view rStr)
{
- return write_uInt8s_FromOString(rStrm, rStr, rStr.getLength());
+ return write_uInt8s_FromOString(rStrm, rStr, rStr.size());
}
/// 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)
TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,
- const OString &rStr);
+ std::string_view rStr);
/// 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