summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 09:30:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 11:12:54 +0200
commitfa88fd0fc8434a4a6077dd80afcd47464669d907 (patch)
treeeb50d71c22f0646fb717afa06c3ebe5810d262e5 /codemaker
parent3240820acaa2f87e4917d1fa387255c2101460a2 (diff)
Revert "use more string_view in codemaker"
This reverts commit 9463550eabd0455c374c1369bc72388108baccad. Reason for revert: The codemaker::UnoType::decompose was previously mostly returning the same OString it receives, so this change is likely a pessimisation Change-Id: Ie1b41889d0a6af9247b8683075d4edd1163fecc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133492 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker')
-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 2b8a2bfc6d1f..8c25ac8ae0dd 100644
--- a/codemaker/source/codemaker/unotype.cxx
+++ b/codemaker/source/codemaker/unotype.cxx
@@ -26,25 +26,25 @@
OString codemaker::UnoType::decompose(
- std::string_view type, sal_Int32 * rank,
+ OString const & type, sal_Int32 * rank,
std::vector< OString > * arguments)
{
- size_t len = type.size();
- size_t i = 0;
+ sal_Int32 len = type.getLength();
+ sal_Int32 i = 0;
while (len - i > 1 && type[i + 1] == ']') {
i += 2;
}
if (rank != nullptr) {
*rank = i / 2;
}
- 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 j = arguments == nullptr ? -1 : type.indexOf('<', i);
+ if (j < 0) {
+ return type.copy(i);
}
- size_t k = j;
+ sal_Int32 k = j;
do {
++k; // skip '<' or ','
- size_t l = k;
+ sal_Int32 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(OString(type.substr(k, l - k)));
+ arguments->push_back(type.copy(k, l - k));
k = l;
} while (k != len && type[k] != '>');
OSL_ASSERT(k == len - 1 && type[k] == '>');
- return OString(type.substr(i, j - i));
+ return type.copy(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 470d59ef3554..db7dae46bccc 100644
--- a/codemaker/source/cppumaker/includes.cxx
+++ b/codemaker/source/cppumaker/includes.cxx
@@ -68,7 +68,7 @@ Includes::Includes(
Includes::~Includes()
{}
-void Includes::add(std::string_view entityName) {
+void Includes::add(OString const & 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 00c784408077..0362c417ac2a 100644
--- a/codemaker/source/cppumaker/includes.hxx
+++ b/codemaker/source/cppumaker/includes.hxx
@@ -38,7 +38,7 @@ public:
~Includes();
- void add(std::string_view entityName);
+ void add(OString const & entityName);
void addCassert() { m_includeCassert = true; }
void addAny() { m_includeAny = true; }
void addReference() { m_includeReference = true; }