summaryrefslogtreecommitdiff
path: root/unodevtools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-27 16:08:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-28 11:45:30 +0200
commit7e3c2e46c61c4ff29b4f4e62aa7a7660042d091e (patch)
tree7d30698e5c097e1039769017c5815f9753a7f710 /unodevtools
parent2b418c16cd6dfc4b9bdd86b03c941f236bb4945f (diff)
use more string_view in unodevtools
Change-Id: I60e090381e6e56d531b9727604b4755b96c608c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133516 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unodevtools')
-rw-r--r--unodevtools/inc/options.hxx2
-rw-r--r--unodevtools/source/skeletonmaker/cppcompskeleton.cxx6
-rw-r--r--unodevtools/source/unodevtools/options.cxx13
3 files changed, 11 insertions, 10 deletions
diff --git a/unodevtools/inc/options.hxx b/unodevtools/inc/options.hxx
index 8cbaf50e190b..2ec56abeffaf 100644
--- a/unodevtools/inc/options.hxx
+++ b/unodevtools/inc/options.hxx
@@ -29,7 +29,7 @@ namespace unodevtools {
bool readOption( OUString * pValue, const char * pOpt,
- sal_uInt32 * pnIndex, const OUString & aArg);
+ sal_uInt32 * pnIndex, std::u16string_view aArg);
// throws CannotDumpException
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index 301aebff8906..0e57d1132921 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -34,7 +34,7 @@ namespace skeletonmaker::cpp {
static void generateIncludes(std::ostream & o,
const std::set< OUString >& interfaces,
- const OUString & propertyhelper, const bool serviceobject,
+ std::u16string_view propertyhelper, const bool serviceobject,
const bool supportxcomponent)
{
o << "#include \"sal/config.h\"\n";
@@ -51,8 +51,8 @@ static void generateIncludes(std::ostream & o,
o << "#include \"cppuhelper/implbase" << interfaces.size() << ".hxx\"\n";
}
- if (propertyhelper.getLength() > 1) {
- if (propertyhelper == "_")
+ if (propertyhelper.size() > 1) {
+ if (propertyhelper == u"_")
o << "#include \"cppuhelper/rpopshlp.hxx\"\n";
else
o << "#include \"cppuhelper/propertysetmixin.hxx\"\n";
diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx
index 290f70ce06ce..bf465af09f51 100644
--- a/unodevtools/source/unodevtools/options.cxx
+++ b/unodevtools/source/unodevtools/options.cxx
@@ -18,6 +18,7 @@
*/
#include <codemaker/global.hxx>
+#include <o3tl/safeint.hxx>
#include <o3tl/string_view.hxx>
#include <rtl/ustring.hxx>
#include <rtl/process.h>
@@ -28,18 +29,18 @@ namespace unodevtools {
bool readOption( OUString * pValue, const char * pOpt,
- sal_uInt32 * pnIndex, const OUString & aArg)
+ sal_uInt32 * pnIndex, std::u16string_view aArg)
{
static const OUStringLiteral dash = u"-";
- if(aArg.indexOf(dash) != 0)
+ if(aArg.find(dash) != 0)
return false;
OUString aOpt = OUString::createFromAscii( pOpt );
- if (aArg.getLength() < aOpt.getLength())
+ if (aArg.size() < o3tl::make_unsigned(aOpt.getLength()))
return false;
- if (aOpt.equalsIgnoreAsciiCase( aArg.subView(1) )) {
+ if (aOpt.equalsIgnoreAsciiCase( aArg.substr(1) )) {
// take next argument
++(*pnIndex);
@@ -53,8 +54,8 @@ bool readOption( OUString * pValue, const char * pOpt,
SAL_INFO("unodevtools", "identified option -" << pOpt << " = " << *pValue);
++(*pnIndex);
return true;
- } else if (aArg.indexOf(aOpt) == 1) {
- *pValue = aArg.copy(1 + aOpt.getLength());
+ } else if (aArg.find(aOpt) == 1) {
+ *pValue = aArg.substr(1 + aOpt.getLength());
SAL_INFO("unodevtools", "identified option -" << pOpt << " = " << *pValue);
++(*pnIndex);