summaryrefslogtreecommitdiff
path: root/include/codemaker
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-11 17:44:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-11 21:25:10 +0100
commit35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch)
treebb78f4f13f131f0cb206a9707cc3cfc495a3876a /include/codemaker
parent0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (diff)
Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/codemaker')
-rw-r--r--include/codemaker/commoncpp.hxx4
-rw-r--r--include/codemaker/global.hxx3
-rw-r--r--include/codemaker/typemanager.hxx5
3 files changed, 8 insertions, 4 deletions
diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx
index b7586e872426..dc1b61c6b32c 100644
--- a/include/codemaker/commoncpp.hxx
+++ b/include/codemaker/commoncpp.hxx
@@ -22,6 +22,8 @@
#include <sal/config.h>
+#include <string_view>
+
#include <codemaker/unotype.hxx>
namespace rtl {
@@ -43,7 +45,7 @@ namespace codemaker::cpp {
rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true);
rtl::OString translateUnoToCppType(
- codemaker::UnoType::Sort sort, rtl::OUString const & nucleus);
+ codemaker::UnoType::Sort sort, std::u16string_view nucleus);
enum class IdentifierTranslationMode {
Global,
diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx
index d865e5270aa4..60e0d1bf774b 100644
--- a/include/codemaker/global.hxx
+++ b/include/codemaker/global.hxx
@@ -23,6 +23,7 @@
#include <list>
#include <vector>
#include <set>
+#include <string_view>
#include <osl/file.hxx>
#include <rtl/ustring.hxx>
@@ -55,7 +56,7 @@ public:
friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer const * s);
friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
- friend FileStream & operator <<(FileStream & out, rtl::OUString const & s);
+ friend FileStream & operator <<(FileStream & out, std::u16string_view s);
private:
oslFileHandle m_file;
diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx
index 5a2d50ec0d90..f76fbb4ca7ea 100644
--- a/include/codemaker/typemanager.hxx
+++ b/include/codemaker/typemanager.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
+#include <string_view>
#include <vector>
#include <codemaker/unotype.hxx>
@@ -63,11 +64,11 @@ private:
};
-inline OString u2b(OUString const & s) {
+inline OString u2b(std::u16string_view s) {
return OUStringToOString(s, RTL_TEXTENCODING_UTF8);
}
-inline OUString b2u(OString const & s) {
+inline OUString b2u(std::string_view s) {
return OStringToOUString(s, RTL_TEXTENCODING_UTF8);
}