summaryrefslogtreecommitdiff
path: root/codemaker/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-27 14:26:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-27 16:45:41 +0200
commit9463550eabd0455c374c1369bc72388108baccad (patch)
treea2df208a79aec4b4d7cbdff185a3bcfaa952c07e /codemaker/source
parenta3e540304269772595439de22b54269011721bb2 (diff)
use more string_view in codemaker
Change-Id: If311f5600bd61387cc709065978306c21360dea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133509 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker/source')
-rw-r--r--codemaker/source/codemaker/unotype.cxx20
-rw-r--r--codemaker/source/cppumaker/includes.cxx2
-rw-r--r--codemaker/source/cppumaker/includes.hxx2
3 files changed, 12 insertions, 12 deletions
diff --git a/codemaker/source/codemaker/unotype.cxx b/codemaker/source/codemaker/unotype.cxx
index 8c25ac8ae0dd..2b8a2bfc6d1f 100644
--- a/codemaker/source/codemaker/unotype.cxx
+++ b/codemaker/source/codemaker/unotype.cxx
@@ -26,25 +26,25 @@
OString codemaker::UnoType::decompose(
- OString const & type, sal_Int32 * rank,
+ std::string_view type, sal_Int32 * rank,
std::vector< OString > * arguments)
{
- sal_Int32 len = type.getLength();
- sal_Int32 i = 0;
+ size_t len = type.size();
+ size_t i = 0;
while (len - i > 1 && type[i + 1] == ']') {
i += 2;
}
if (rank != nullptr) {
*rank = i / 2;
}
- sal_Int32 j = arguments == nullptr ? -1 : type.indexOf('<', i);
- if (j < 0) {
- return type.copy(i);
+ size_t j = arguments == nullptr ? std::string_view::npos : type.find('<', i);
+ if (j == std::string_view::npos) {
+ return OString(type.substr(i));
}
- sal_Int32 k = j;
+ size_t k = j;
do {
++k; // skip '<' or ','
- sal_Int32 l = k;
+ size_t l = k;
for (sal_Int32 level = 0; l != len; ++l) {
char c = type[l];
if (c == ',') {
@@ -60,11 +60,11 @@ OString codemaker::UnoType::decompose(
--level;
}
}
- arguments->push_back(type.copy(k, l - k));
+ arguments->push_back(OString(type.substr(k, l - k)));
k = l;
} while (k != len && type[k] != '>');
OSL_ASSERT(k == len - 1 && type[k] == '>');
- return type.copy(i, j - i);
+ return OString(type.substr(i, j - i));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx
index db7dae46bccc..470d59ef3554 100644
--- a/codemaker/source/cppumaker/includes.cxx
+++ b/codemaker/source/cppumaker/includes.cxx
@@ -68,7 +68,7 @@ Includes::Includes(
Includes::~Includes()
{}
-void Includes::add(OString const & entityName) {
+void Includes::add(std::string_view entityName) {
sal_Int32 k;
std::vector< OString > args;
OUString n(b2u(codemaker::UnoType::decompose(entityName, &k, &args)));
diff --git a/codemaker/source/cppumaker/includes.hxx b/codemaker/source/cppumaker/includes.hxx
index 0362c417ac2a..00c784408077 100644
--- a/codemaker/source/cppumaker/includes.hxx
+++ b/codemaker/source/cppumaker/includes.hxx
@@ -38,7 +38,7 @@ public:
~Includes();
- void add(OString const & entityName);
+ void add(std::string_view entityName);
void addCassert() { m_includeCassert = true; }
void addAny() { m_includeAny = true; }
void addReference() { m_includeReference = true; }