summaryrefslogtreecommitdiff
path: root/unodevtools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-28 17:56:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-29 16:42:33 +0100
commit042033f1e6da22616cb76c8d950c20c9efecbad5 (patch)
tree26b3f1f42d067506f44550b410f3fb9640616a5b /unodevtools
parentccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff)
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'unodevtools')
-rw-r--r--unodevtools/source/skeletonmaker/cppcompskeleton.cxx15
-rw-r--r--unodevtools/source/skeletonmaker/cpptypemaker.cxx7
-rw-r--r--unodevtools/source/skeletonmaker/javatypemaker.cxx6
-rw-r--r--unodevtools/source/skeletonmaker/skeletoncommon.cxx13
-rw-r--r--unodevtools/source/skeletonmaker/skeletoncpp.hxx3
-rw-r--r--unodevtools/source/skeletonmaker/skeletonjava.hxx3
6 files changed, 26 insertions, 21 deletions
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index 3bbcee31dbf7..a2460ff28dd1 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -26,6 +26,7 @@
#include "skeletoncpp.hxx"
#include <iostream>
+#include <string_view>
using namespace ::codemaker::cpp;
@@ -856,11 +857,11 @@ static void generateMethodBodies(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
std::set< OUString > const & interfaces,
- OString const & classname,
+ std::string_view classname,
OString const & comphelpernamespace,
OUString const & propertyhelper)
{
- OString name = classname + "::";
+ OString name = OString::Concat(classname) + "::";
codemaker::GeneratedTypeSet generated;
for (const auto& rIface : interfaces) {
if ( rIface == "com.sun.star.lang.XServiceInfo" ) {
@@ -879,16 +880,16 @@ static void generateQueryInterface(std::ostream& o,
const std::set< OUString >& interfaces,
OString const & parentname,
OString const & classname,
- OUString const & propertyhelper)
+ std::u16string_view propertyhelper)
{
- if (propertyhelper.isEmpty())
+ if (propertyhelper.empty())
return;
o << "css::uno::Any " << classname
<< "::queryInterface(css::uno::Type const & type) throw ("
"css::uno::RuntimeException)\n{\n ";
- if (!propertyhelper.isEmpty())
+ if (!propertyhelper.empty())
o << "return ";
else
o << "css::uno::Any a(";
@@ -905,12 +906,12 @@ static void generateQueryInterface(std::ostream& o,
o << ">";
}
- if (!propertyhelper.isEmpty()) {
+ if (!propertyhelper.empty()) {
o << "::queryInterface(type);\n";
} else {
o << "::queryInterface(type));\n";
o << " return a.hasValue() ? a\n : (";
- if (propertyhelper == "_") {
+ if (propertyhelper == u"_") {
o << "::cppu::OPropertySetHelper::queryInterface(type));\n";
} else {
o << "::cppu::PropertySetMixin<\n ";
diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
index b7b4f4a7c0ec..59407c2c6b47 100644
--- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
@@ -27,6 +27,7 @@
#include "skeletoncpp.hxx"
#include <algorithm>
+#include <string_view>
using namespace ::codemaker::cpp;
@@ -123,7 +124,7 @@ static void printType(
void printType(
std::ostream & o, ProgramOptions const & options,
- rtl::Reference< TypeManager > const & manager, OUString const & name,
+ rtl::Reference< TypeManager > const & manager, std::u16string_view name,
short referenceType, bool defaultvalue)
{
OUString nucleus;
@@ -141,7 +142,7 @@ static bool printConstructorParameters(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort,
- rtl::Reference< unoidl::Entity > const & entity, OUString const & name,
+ rtl::Reference< unoidl::Entity > const & entity, std::u16string_view name,
std::vector< OUString > const & arguments)
{
bool previous = false;
@@ -250,7 +251,7 @@ static bool printConstructorParameters(
}
default:
throw CannotDumpException(
- "unexpected entity \"" + name
+ OUString::Concat("unexpected entity \"") + name
+ "\" in call to skeletonmaker::cpp::printConstructorParameters");
}
return previous;
diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx
index a82a1fd1b610..e724eb498838 100644
--- a/unodevtools/source/skeletonmaker/javatypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx
@@ -112,7 +112,7 @@ static void printType(
void printType(
std::ostream & o, ProgramOptions const & options,
- rtl::Reference< TypeManager > const & manager, OUString const & name,
+ rtl::Reference< TypeManager > const & manager, std::u16string_view name,
bool referenceType, bool defaultvalue)
{
OUString nucleus;
@@ -129,7 +129,7 @@ static bool printConstructorParameters(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort,
- rtl::Reference< unoidl::Entity > const & entity, OUString const & name,
+ rtl::Reference< unoidl::Entity > const & entity, std::u16string_view name,
std::vector< OUString > const & arguments)
{
bool previous = false;
@@ -238,7 +238,7 @@ static bool printConstructorParameters(
}
default:
throw CannotDumpException(
- "unexpected entity \"" + name
+ OUString::Concat("unexpected entity \"") + name
+ "\" in call to skeletonmaker::cpp::printConstructorParameters");
}
return previous;
diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/unodevtools/source/skeletonmaker/skeletoncommon.cxx
index 21a174b69e1a..e2ecdb35a824 100644
--- a/unodevtools/source/skeletonmaker/skeletoncommon.cxx
+++ b/unodevtools/source/skeletonmaker/skeletoncommon.cxx
@@ -30,6 +30,7 @@
#include <algorithm>
#include <cassert>
#include <iostream>
+#include <string_view>
using namespace ::codemaker::cpp;
@@ -402,7 +403,7 @@ checkAdditionalPropertyFlags(
// types are allowed add-in types, for more info see the com.sun.star.sheet.AddIn
// service description
static bool checkAddinType(rtl::Reference< TypeManager > const & manager,
- OUString const & type, bool & bLastAny,
+ std::u16string_view type, bool & bLastAny,
bool & bHasXPropertySet, bool bIsReturn)
{
assert(manager.is());
@@ -431,11 +432,11 @@ static bool checkAddinType(rtl::Reference< TypeManager > const & manager,
}
if ( sort == codemaker::UnoType::Sort::Interface )
{
- if ( bIsReturn && type == "com.sun.star.sheet.XVolatileResult" )
+ if ( bIsReturn && type == u"com.sun.star.sheet.XVolatileResult" )
return true;
- if ( !bIsReturn && type == "com.sun.star.table.XCellRange" )
+ if ( !bIsReturn && type == u"com.sun.star.table.XCellRange" )
return true;
- if ( !bIsReturn && type == "com.sun.star.beans.XPropertySet" )
+ if ( !bIsReturn && type == u"com.sun.star.beans.XPropertySet" )
{
if ( bHasXPropertySet ) {
return false;
@@ -449,7 +450,7 @@ static bool checkAddinType(rtl::Reference< TypeManager > const & manager,
}
static void checkAddInTypes(
- rtl::Reference< TypeManager > const & manager, OUString const & name,
+ rtl::Reference< TypeManager > const & manager, std::u16string_view name,
rtl::Reference< unoidl::InterfaceTypeEntity > const & entity)
{
assert(entity.is());
@@ -461,7 +462,7 @@ static void checkAddInTypes(
manager, rMethod.returnType, bLastAny, bHasXPropertySet, true) )
{
throw CannotDumpException(
- "the return type of the calc add-in function '" + name
+ OUString::Concat("the return type of the calc add-in function '") + name
+ ":" + rMethod.name
+ "' is invalid. Please check your IDL definition.");
}
diff --git a/unodevtools/source/skeletonmaker/skeletoncpp.hxx b/unodevtools/source/skeletonmaker/skeletoncpp.hxx
index 569280c5daa3..9599c97d8246 100644
--- a/unodevtools/source/skeletonmaker/skeletoncpp.hxx
+++ b/unodevtools/source/skeletonmaker/skeletoncpp.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONCPP_HXX
#include <fstream>
+#include <string_view>
#include <codemaker/generatedtypeset.hxx>
#include "skeletoncommon.hxx"
@@ -35,7 +36,7 @@ namespace skeletonmaker::cpp {
// 16 = default member initialization in a constructor
void printType(
std::ostream & o, ProgramOptions const & options,
- rtl::Reference< TypeManager > const & manager, OUString const & name,
+ rtl::Reference< TypeManager > const & manager, std::u16string_view name,
short referenceType, bool defaultvalue = false);
void printMethods(std::ostream & o,
diff --git a/unodevtools/source/skeletonmaker/skeletonjava.hxx b/unodevtools/source/skeletonmaker/skeletonjava.hxx
index bc31b5dced70..be389487f399 100644
--- a/unodevtools/source/skeletonmaker/skeletonjava.hxx
+++ b/unodevtools/source/skeletonmaker/skeletonjava.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_UNODEVTOOLS_SOURCE_SKELETONMAKER_SKELETONJAVA_HXX
#include <fstream>
+#include <string_view>
#include <codemaker/generatedtypeset.hxx>
#include "skeletoncommon.hxx"
@@ -28,7 +29,7 @@ namespace skeletonmaker::java {
void printType(
std::ostream & o, ProgramOptions const & options,
- rtl::Reference< TypeManager > const & manager, OUString const & name,
+ rtl::Reference< TypeManager > const & manager, std::u16string_view name,
bool referenceType, bool defaultvalue = false);
void printMethods(std::ostream & o,