summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-01 17:42:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-02 13:31:19 +0200
commit1927b51993fb68907a75765676179b08ab195196 (patch)
tree1b7d09c1b5e7ea945fb6ea618a4c100e8630ebb4 /codemaker
parent0dfa444f393a5766d36fe7d2480d0c8ec832e329 (diff)
loplugin:stringviewparam convert methods using indexOf
.. and lastIndexOf, which convert to find and rfind Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/cppumaker/dumputils.cxx14
-rw-r--r--codemaker/source/cppumaker/dumputils.hxx5
2 files changed, 10 insertions, 9 deletions
diff --git a/codemaker/source/cppumaker/dumputils.cxx b/codemaker/source/cppumaker/dumputils.cxx
index 15b62e04a407..8524b1962ce2 100644
--- a/codemaker/source/cppumaker/dumputils.cxx
+++ b/codemaker/source/cppumaker/dumputils.cxx
@@ -48,16 +48,16 @@ bool dumpNamespaceOpen(
}
bool dumpNamespaceClose(
- FileStream & out, OUString const & entityName, bool fullModuleType)
+ FileStream & out, std::u16string_view entityName, bool fullModuleType)
{
bool bOutput = false;
bool bFirst = true;
- for (sal_Int32 i = 0; i >= 0;) {
- i = entityName.indexOf('.', i);
- if (i >= 0) {
+ for (size_t i = 0; i != std::u16string_view::npos;) {
+ i = entityName.find('.', i);
+ if (i != std::u16string_view::npos) {
++i;
}
- if (fullModuleType || i >= 0) {
+ if (fullModuleType || i != std::u16string_view::npos) {
if (!bFirst) {
out << " ";
}
@@ -69,8 +69,8 @@ bool dumpNamespaceClose(
return bOutput;
}
-void dumpTypeIdentifier(FileStream & out, OUString const & entityName) {
- out << entityName.subView(entityName.lastIndexOf('.') + 1);
+void dumpTypeIdentifier(FileStream & out, std::u16string_view entityName) {
+ out << entityName.substr(entityName.rfind('.') + 1);
}
}
diff --git a/codemaker/source/cppumaker/dumputils.hxx b/codemaker/source/cppumaker/dumputils.hxx
index 58ccdc93fac5..2fcd708c43fb 100644
--- a/codemaker/source/cppumaker/dumputils.hxx
+++ b/codemaker/source/cppumaker/dumputils.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <sal/config.h>
+#include <string_view>
namespace rtl
{
@@ -31,9 +32,9 @@ namespace codemaker::cppumaker
{
bool dumpNamespaceOpen(FileStream& out, rtl::OUString const& entityName, bool fullModuleType);
-bool dumpNamespaceClose(FileStream& out, rtl::OUString const& entityName, bool fullModuleType);
+bool dumpNamespaceClose(FileStream& out, std::u16string_view entityName, bool fullModuleType);
-void dumpTypeIdentifier(FileStream& out, rtl::OUString const& entityName);
+void dumpTypeIdentifier(FileStream& out, std::u16string_view entityName);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */