diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-03 10:34:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-17 10:27:33 +0200 |
commit | 33bd16b344e273c427091ee68e946bf67b371dd7 (patch) | |
tree | 85fb383ea8e3d30f393bb197b5c74f73f6ca247f /codemaker/source | |
parent | fe597a337914decd62480d3eba84258333116db9 (diff) |
loplugin:stringviewparam convert methods using copy()
which converts to std::string_view::substr()
Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker/source')
-rw-r--r-- | codemaker/source/javamaker/javatype.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index 99a07339f821..563506221721 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -44,6 +44,7 @@ #include <rtl/ustring.hxx> #include <sal/types.h> #include <unoidl/unoidl.hxx> +#include <o3tl/string_view.hxx> #include "classfile.hxx" #include "javaoptions.hxx" @@ -108,14 +109,18 @@ bool isSpecialType(SpecialType special) { } OString translateUnoidlEntityNameToJavaFullyQualifiedName( - OUString const & name, std::string_view prefix) + std::u16string_view name, std::string_view prefix) { - assert(!name.startsWith("[]")); - assert(name.indexOf('<') == -1); - sal_Int32 i = name.lastIndexOf('.') + 1; - return codemaker::convertString(name.copy(0, i)).replace('.', '/') + assert(!o3tl::starts_with(name, u"[]")); + assert(name.find('<') == std::string_view::npos); + size_t i = name.rfind('.'); + if (i == std::string_view::npos) + i = 0; + else + ++i; + return codemaker::convertString(OUString(name.substr(0, i))).replace('.', '/') + codemaker::java::translateUnoToJavaIdentifier( - codemaker::convertString(name.copy(i)), prefix); + codemaker::convertString(OUString(name.substr(i))), prefix); } struct PolymorphicUnoType { |