summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-08 13:49:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-09 09:08:56 +0200
commit2bf56582475179faa9d71573532a0d416cb64bfc (patch)
tree90fceed9ba89b865e713a6f8ab998c79d757abd7 /codemaker
parent7a16002ede5fd31ae8f3358136ad49de40465ac1 (diff)
add a more complete o3tl::getToken
so we avoid OUString copying (mostly when doing stuff like parsing numbers of out of strings) Change-Id: I4ef6ac23671c0b40807a22158e655e92dfad4af6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/cppumaker/cppumaker.cxx13
-rw-r--r--codemaker/source/cppumaker/dumputils.cxx5
-rw-r--r--codemaker/source/cppumaker/dumputils.hxx2
-rw-r--r--codemaker/source/javamaker/javamaker.cxx13
4 files changed, 18 insertions, 15 deletions
diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx
index 384e2b5aa079..b2556655b361 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -32,6 +32,7 @@
#include <sal/main.h>
#include <sal/types.h>
#include <unoidl/unoidl.hxx>
+#include <o3tl/string_view.hxx>
#include "cppuoptions.hxx"
#include "cpputype.hxx"
@@ -57,13 +58,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
if (options.isValid("-T")) {
OUString names(b2u(options.getOption("-T")));
for (sal_Int32 i = 0; i != -1;) {
- OUString name(names.getToken(0, ';', i));
- if (!name.isEmpty()) {
+ std::u16string_view name(o3tl::getToken(names, 0, ';', i));
+ if (!name.empty()) {
produce(
- (name == "*"
- ? ""
- : name.endsWith(".*")
- ? name.copy(0, name.getLength() - std::strlen(".*"))
+ OUString(name == u"*"
+ ? u""
+ : o3tl::ends_with(name, u".*")
+ ? name.substr(0, name.size() - std::strlen(".*"))
: name),
typeMgr, generated, options);
}
diff --git a/codemaker/source/cppumaker/dumputils.cxx b/codemaker/source/cppumaker/dumputils.cxx
index 8524b1962ce2..2a3e809e70f3 100644
--- a/codemaker/source/cppumaker/dumputils.cxx
+++ b/codemaker/source/cppumaker/dumputils.cxx
@@ -24,17 +24,18 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
+#include <o3tl/string_view.hxx>
namespace codemaker::cppumaker {
bool dumpNamespaceOpen(
- 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;) {
- OUString id(entityName.getToken(0, '.', i));
+ std::u16string_view id(o3tl::getToken(entityName, 0, '.', i));
if (fullModuleType || i >= 0) {
if (!bFirst) {
out << " ";
diff --git a/codemaker/source/cppumaker/dumputils.hxx b/codemaker/source/cppumaker/dumputils.hxx
index 2fcd708c43fb..24e5bae3bede 100644
--- a/codemaker/source/cppumaker/dumputils.hxx
+++ b/codemaker/source/cppumaker/dumputils.hxx
@@ -30,7 +30,7 @@ class FileStream;
namespace codemaker::cppumaker
{
-bool dumpNamespaceOpen(FileStream& out, rtl::OUString const& entityName, bool fullModuleType);
+bool dumpNamespaceOpen(FileStream& out, std::u16string_view entityName, bool fullModuleType);
bool dumpNamespaceClose(FileStream& out, std::u16string_view entityName, bool fullModuleType);
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index 044292bf6b8f..ee376c8cc484 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -32,6 +32,7 @@
#include <sal/main.h>
#include <sal/types.h>
#include <unoidl/unoidl.hxx>
+#include <o3tl/string_view.hxx>
#include "javaoptions.hxx"
#include "javatype.hxx"
@@ -57,13 +58,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
if (options.isValid("-T")) {
OUString names(b2u(options.getOption("-T")));
for (sal_Int32 i = 0; i != -1;) {
- OUString name(names.getToken(0, ';', i));
- if (!name.isEmpty()) {
+ std::u16string_view name(o3tl::getToken(names, 0, ';', i));
+ if (!name.empty()) {
produce(
- (name == "*"
- ? ""
- : name.endsWith(".*")
- ? name.copy(0, name.getLength() - std::strlen(".*"))
+ OUString(name == u"*"
+ ? u""
+ : o3tl::ends_with(name, u".*")
+ ? name.substr(0, name.size() - std::strlen(".*"))
: name),
typeMgr, generated, options);
}