summaryrefslogtreecommitdiff
path: root/tools/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-28 17:14:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-30 20:42:56 +0200
commit2e21240f23ac2191a3535d697a7308b29303c67c (patch)
tree89f6e634912c2d1d476cddb2550e7368b10427b9 /tools/source
parent6379f799704935a571a4b3af44cabd0671c48dbe (diff)
Goodbye O[U]StringView, welcome O[U]String::Concat
O[U]StringView had an odd mixture of uses. For one, it was used like std::[u16]string_view, for which directly using the latter std types is clearly the better alternative. For another, it was used in concatenation sequences, when neither of the two leading terms were of our rtl string-related types. For that second use case introduce O[U]String::Concat (as std::[u16]string_view can obviously not be used, those not being one of our rtl string-related types). Also, O[U]StringLiteral is occasionally used for this, but the planned changes outlined in the 33ecd0d5c4fff9511a8436513936a3f7044a775a "Change OUStringLiteral from char[] to char16_t[]" commit message will make that no longer work, so O[U]String::Concat will be the preferred solution in such use cases going forward, too. O[U]StringView was also occasionally used to include O[U]StringBuffer values in concatenation sequences, for which a more obvious alternative is to make O[U]StringBuffer participate directly in the ToStringHelper/O[U]StringConcat machinery. Change-Id: I1f0e8d836796c9ae01c45f32c518be5f52976622 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101586 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools/source')
-rw-r--r--tools/source/fsys/urlobj.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 2478a2bd5d55..d52edb1d2f2a 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -39,6 +39,7 @@
#include <cassert>
#include <limits>
#include <memory>
+#include <string_view>
#include <string.h>
@@ -4198,8 +4199,8 @@ bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash)
return true;
OUString aNewPath =
- rtl::OUStringView(pPathBegin, pExtension - pPathBegin) +
- rtl::OUStringView(p, pPathEnd - p);
+ OUString::Concat(std::u16string_view(pPathBegin, pExtension - pPathBegin)) +
+ std::u16string_view(p, pPathEnd - p);
return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8);
}
@@ -4226,7 +4227,8 @@ bool INetURLObject::setFinalSlash()
if (pPathEnd > pPathBegin && pPathEnd[-1] == '/')
return true;
- OUString aNewPath = rtl::OUStringView(pPathBegin, pPathEnd - pPathBegin) + "/";
+ OUString aNewPath
+ = OUString::Concat(std::u16string_view(pPathBegin, pPathEnd - pPathBegin)) + "/";
return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8);
}