configmgr/source/writemodfile.cxx | 10 +++++----- include/rtl/stringconcat.hxx | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-)
New commits: commit 9c9b1e95ae4c407cf0f462c4e1a64fcc303399d6 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Sep 27 19:18:58 2019 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Sep 27 23:41:23 2019 +0200 Add conversion from rtl::OStringNumber to std::string_view ...and revert the relevant part of 2f5f45921b05904a4be1ff633be09c62cb44ff08 "support O(U)String::number() for fast string concatenation", as discussed in the comments of that Gerrit change, now that 89bb0b0dcd8dc4656d0047cd10702d1c471c0fa1 "Deduplicate O(U)StringNumber definitions; add toAsciiUpperCase" paved the way. For consistency, also add conversion from rtl::OUStringNumber to std::u16string_view, even if that remains unused as of now. Change-Id: Ieb64bff0b59c22f3dec05c99fca5676b27a46e9a Reviewed-on: https://gerrit.libreoffice.org/79750 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index d7fba8264b80..017e925dee48 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -155,19 +155,19 @@ void writeValueContent_(TempFile &handle, sal_Bool value) { } void writeValueContent_(TempFile &handle, sal_Int16 value) { - handle.writeString(OString(OString::number(value))); + handle.writeString(OString::number(value)); } void writeValueContent_(TempFile &handle, sal_Int32 value) { - handle.writeString(OString(OString::number(value))); + handle.writeString(OString::number(value)); } void writeValueContent_(TempFile &handle, sal_Int64 value) { - handle.writeString(OString(OString::number(value))); + handle.writeString(OString::number(value)); } void writeValueContent_(TempFile &handle, double value) { - handle.writeString(OString(OString::number(value))); + handle.writeString(OString::number(value)); } void writeValueContent_(TempFile &handle, const OUString& value) { @@ -530,7 +530,7 @@ void writeValueContent(TempFile &handle, std::u16string_view value) { { handle.writeString(convertToUtf8(value.substr(i, j - i))); handle.writeString("<unicode oor:scalar=\""); - handle.writeString(OString(OString::number(c))); + handle.writeString(OString::number(c)); handle.writeString("\"/>"); i = j + 1; } else if (c == '\x0D') { diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx index 7bbcb1cf680f..ae2048e80233 100644 --- a/include/rtl/stringconcat.hxx +++ b/include/rtl/stringconcat.hxx @@ -15,6 +15,7 @@ #include "rtl/ustring.h" #include <cstddef> +#include <string_view> #include <utility> #include <string.h> @@ -334,6 +335,7 @@ template <class Derived, int nBufSize> struct OStringNumberBase rtl_str_toAsciiUpperCase_WithLength(buf, length); return std::move(*static_cast<Derived*>(this)); } + operator std::string_view() const { return std::string_view(buf, length); } char buf[nBufSize]; sal_Int32 length; }; @@ -402,6 +404,7 @@ template <class Derived, int nBufSize> struct OUStringNumberBase rtl_ustr_toAsciiUpperCase_WithLength(buf, length); return std::move(*static_cast<Derived*>(this)); } + operator std::u16string_view() const { return std::u16string_view(buf, length); } sal_Unicode buf[nBufSize]; sal_Int32 length; }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits