diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-11-12 08:13:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-11-12 16:53:30 +0100 |
commit | f34ac579fac16fff37bf00fe85d43ad6b938eca7 (patch) | |
tree | 0747c4d86bbf40a5093fb7a3215dd52a8e8586b2 /basegfx | |
parent | c45753847dfc2b4645dc2f7500a18ec2c5d438df (diff) |
New loplugin:stringviewparam
...to "Find functions that take rtl::O[U]String parameters that can be
generalized to take std::[u16]string_view instead." (Which in turn can avoid
costly O[U]String constructions, see e.g. loplugin:stringview and subView.)
Some of those functions' call sites, passing plain char string literals, needed
to be adapted when converting them.
Change-Id: I644ab546d7a0ce9e470ab9b3196e3e60d1e812bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105622
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/inc/stringconversiontools.hxx | 10 | ||||
-rw-r--r-- | basegfx/source/tools/stringconversiontools.cxx | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/basegfx/source/inc/stringconversiontools.hxx b/basegfx/source/inc/stringconversiontools.hxx index 9b788bf3421e..fdf2f83e0f4e 100644 --- a/basegfx/source/inc/stringconversiontools.hxx +++ b/basegfx/source/inc/stringconversiontools.hxx @@ -19,13 +19,17 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <sal/types.h> #include <rtl/ustring.hxx> namespace basegfx::internal { void skipSpaces(sal_Int32& io_rPos, - const OUString& rStr, + std::u16string_view rStr, const sal_Int32 nLen); inline bool isOnNumberChar(const sal_Unicode aChar, @@ -39,7 +43,7 @@ namespace basegfx::internal return bPredicate; } - inline bool isOnNumberChar(const OUString& rStr, + inline bool isOnNumberChar(std::u16string_view rStr, const sal_Int32 nPos) { return isOnNumberChar(rStr[nPos], true/*bSignAllowed*/); @@ -52,7 +56,7 @@ namespace basegfx::internal bool importFlagAndSpaces(sal_Int32& o_nRetval, sal_Int32& io_rPos, - const OUString& rStr, + std::u16string_view rStr, const sal_Int32 nLen); } // namespace basegfx::internal diff --git a/basegfx/source/tools/stringconversiontools.cxx b/basegfx/source/tools/stringconversiontools.cxx index 079966b27557..d9f7df14cf50 100644 --- a/basegfx/source/tools/stringconversiontools.cxx +++ b/basegfx/source/tools/stringconversiontools.cxx @@ -23,7 +23,7 @@ namespace basegfx::internal { void skipSpaces(sal_Int32& io_rPos, - const OUString& rStr, + std::u16string_view rStr, const sal_Int32 nLen) { while( io_rPos < nLen && @@ -34,7 +34,7 @@ namespace basegfx::internal } static void skipSpacesAndCommas(sal_Int32& io_rPos, - const OUString& rStr, + std::u16string_view rStr, const sal_Int32 nLen) { while(io_rPos < nLen @@ -134,7 +134,7 @@ namespace basegfx::internal bool importFlagAndSpaces(sal_Int32& o_nRetval, sal_Int32& io_rPos, - const OUString& rStr, + std::u16string_view rStr, const sal_Int32 nLen) { sal_Unicode aChar( rStr[io_rPos] ); |