diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-03 10:34:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-17 10:27:33 +0200 |
commit | 33bd16b344e273c427091ee68e946bf67b371dd7 (patch) | |
tree | 85fb383ea8e3d30f393bb197b5c74f73f6ca247f /unodevtools | |
parent | fe597a337914decd62480d3eba84258333116db9 (diff) |
loplugin:stringviewparam convert methods using copy()
which converts to std::string_view::substr()
Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unodevtools')
-rw-r--r-- | unodevtools/source/skeletonmaker/cpptypemaker.cxx | 12 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javacompskeleton.cxx | 8 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javatypemaker.cxx | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx index 59407c2c6b47..62f86056573f 100644 --- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx +++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx @@ -36,7 +36,7 @@ namespace skeletonmaker::cpp { static void printType( std::ostream & o, ProgramOptions const & options, rtl::Reference< TypeManager > const & manager, - codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank, + codemaker::UnoType::Sort sort, std::u16string_view nucleus, sal_Int32 rank, std::vector< OUString > const & arguments, rtl::Reference< unoidl::Entity > const & entity, short referenceType, bool defaultvalue) @@ -67,7 +67,7 @@ static void printType( if (sort == codemaker::UnoType::Sort::Enum) { auto pEnumTypeEntity(dynamic_cast<unoidl::EnumTypeEntity *>(entity.get())); assert(pEnumTypeEntity); - o << nucleus.copy(nucleus.lastIndexOf('.') + 1) << "_" + o << OUString(nucleus.substr(nucleus.rfind('.') + 1)) << "_" << pEnumTypeEntity->getMembers()[0].name; } return; @@ -261,10 +261,10 @@ static void printConstructor( 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) { - o << "public " << name.copy(name.lastIndexOf('.') + 1) << '('; + o << "public " << OUString(name.substr(name.rfind('.') + 1)) << '('; printConstructorParameters( o, options, manager, sort, entity, name, arguments); o << ");\n"; @@ -713,7 +713,7 @@ static void printServiceMembers( static void printMapsToCppType( std::ostream & o, ProgramOptions const & options, rtl::Reference< TypeManager > const & manager, - codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank, + codemaker::UnoType::Sort sort, std::u16string_view nucleus, sal_Int32 rank, std::vector< OUString > const & arguments, rtl::Reference< unoidl::Entity > const & entity, const char * cppTypeSort) { @@ -722,7 +722,7 @@ static void printMapsToCppType( o << cppTypeSort << ' '; o << "type \""; - if (rank == 0 && nucleus == "com.sun.star.uno.XInterface") { + if (rank == 0 && nucleus == u"com.sun.star.uno.XInterface") { o << "Reference< com::sun::star::uno::XInterface >"; } else { printType( diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx index c6576c40bfc8..e5f15a180d51 100644 --- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx @@ -32,11 +32,11 @@ using namespace ::codemaker::java; namespace skeletonmaker::java { -static void generatePackage(std::ostream & o, const OString & implname) +static void generatePackage(std::ostream & o, std::string_view implname) { - sal_Int32 index = implname.lastIndexOf('.'); - if (index != -1) - o << "package " << implname.copy(0, index) << ";\n\n"; + size_t index = implname.rfind('.'); + if (index != std::string_view::npos) + o << "package " << implname.substr(0, index) << ";\n\n"; } static void generateImports(std::ostream & o, ProgramOptions const & options, diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx index e724eb498838..d576f5a1dd12 100644 --- a/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -248,10 +248,10 @@ static void printConstructor( 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) { - o << "public " << name.copy(name.lastIndexOf('.') + 1) << '('; + o << "public " << OUString(name.substr(name.rfind('.') + 1)) << '('; printConstructorParameters( o, options, manager, sort, entity, name, arguments); o << ");\n"; |