diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-26 12:06:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-27 09:27:44 +0200 |
commit | 62f6d6ee8bca918e17ae167582095f4302203bed (patch) | |
tree | 976279a87d1aca3b24cb37dcf6c4b6378f6d6fdd /svtools | |
parent | bde131ad18620dea03531c59893c99be09e3ce4e (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 'svtools')
-rw-r--r-- | svtools/qa/unit/testHtmlWriter.cxx | 2 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 2 | ||||
-rw-r--r-- | svtools/source/svhtml/HtmlWriter.cxx | 22 | ||||
-rw-r--r-- | svtools/source/svhtml/htmlout.cxx | 4 |
4 files changed, 15 insertions, 15 deletions
diff --git a/svtools/qa/unit/testHtmlWriter.cxx b/svtools/qa/unit/testHtmlWriter.cxx index 601287342c4b..7154b770a682 100644 --- a/svtools/qa/unit/testHtmlWriter.cxx +++ b/svtools/qa/unit/testHtmlWriter.cxx @@ -156,7 +156,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAttributeValues) HtmlWriter aHtml(aStream); aHtml.prettyPrint(false); aHtml.start("abc"); - aHtml.attribute("one", OString("one")); + aHtml.attribute("one", "one"); aHtml.attribute("two", u"two"); aHtml.attribute("three", sal_Int32(12)); aHtml.end(); diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 7e39f8eab8c2..8d5f8836a0c3 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -414,7 +414,7 @@ void FontNameBox::SaveMRUEntries(const OUString& aFontMRUEntriesFile) const aStream.SetLineDelimiter( LINEEND_LF ); aStream.WriteLine( aEntries ); - aStream.WriteLine( OString() ); + aStream.WriteLine( "" ); } void FontNameBox::LoadMRUEntries( const OUString& aFontMRUEntriesFile ) diff --git a/svtools/source/svhtml/HtmlWriter.cxx b/svtools/source/svhtml/HtmlWriter.cxx index dd2f40c6d16f..a4d1b0e3b5ea 100644 --- a/svtools/source/svhtml/HtmlWriter.cxx +++ b/svtools/source/svhtml/HtmlWriter.cxx @@ -51,7 +51,7 @@ void HtmlWriter::start(const OString& aElement) } mrStream.WriteChar('<'); - mrStream.WriteOString(maNamespace + aElement); + mrStream.WriteOString(OString(maNamespace + aElement)); mbElementOpen = true; } @@ -98,7 +98,7 @@ void HtmlWriter::end() } } mrStream.WriteCharPtr("</"); - mrStream.WriteOString(maNamespace + maElementStack.back()); + mrStream.WriteOString(OString(maNamespace + maElementStack.back())); mrStream.WriteCharPtr(">"); if (mbPrettyPrint) mrStream.WriteCharPtr("\n"); @@ -108,9 +108,9 @@ void HtmlWriter::end() mbCharactersWritten = false; } -void HtmlWriter::attribute(const OString &aAttribute, const OString& aValue) +void HtmlWriter::attribute(std::string_view aAttribute, std::string_view aValue) { - if (mbElementOpen && !aAttribute.isEmpty() && !aValue.isEmpty()) + if (mbElementOpen && !aAttribute.empty() && !aValue.empty()) { mrStream.WriteChar(' '); mrStream.WriteOString(aAttribute); @@ -121,31 +121,31 @@ void HtmlWriter::attribute(const OString &aAttribute, const OString& aValue) } } -void HtmlWriter::attribute(const OString& aAttribute, const sal_Int32 aValue) +void HtmlWriter::attribute(std::string_view aAttribute, const sal_Int32 aValue) { attribute(aAttribute, OString::number(aValue)); } -void HtmlWriter::attribute(const OString& aAttribute, const char* pValue) +void HtmlWriter::attribute(std::string_view aAttribute, const char* pValue) { - attribute(aAttribute, OString(pValue)); + attribute(aAttribute, std::string_view(pValue)); } -void HtmlWriter::attribute(const OString& aAttribute, std::u16string_view aValue) +void HtmlWriter::attribute(std::string_view aAttribute, std::u16string_view aValue) { attribute(aAttribute, OUStringToOString(aValue, RTL_TEXTENCODING_UTF8)); } -void HtmlWriter::attribute(const OString& aAttribute) +void HtmlWriter::attribute(std::string_view aAttribute) { - if (mbElementOpen && !aAttribute.isEmpty()) + if (mbElementOpen && !aAttribute.empty()) { mrStream.WriteChar(' '); mrStream.WriteOString(aAttribute); } } -void HtmlWriter::characters(const OString& rChars) +void HtmlWriter::characters(std::string_view rChars) { if (!mbCharactersWritten) mrStream.WriteCharPtr(">"); diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index c148f49dc92f..48beab0039cd 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -516,7 +516,7 @@ OString HTMLOutFuncs::ConvertStringToHTML( const OUString& rSrc, return aDest.makeStringAndClear(); } -SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, const OString& rStr, +SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, std::string_view rStr, bool bOn ) { if(bOn) @@ -993,7 +993,7 @@ bool HTMLOutFuncs::PrivateURLToInternalImg( OUString& rURL ) return false; } -void HtmlWriterHelper::applyColor(HtmlWriter& rHtmlWriter, const OString &aAttributeName, const Color& rColor) +void HtmlWriterHelper::applyColor(HtmlWriter& rHtmlWriter, std::string_view aAttributeName, const Color& rColor) { OStringBuffer sBuffer; |