diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 17:15:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 18:55:18 +0200 |
commit | c638bcc78cfa3974b7461096b6ac521dfc5e927c (patch) | |
tree | a39e95a99cdf2bb81437e24ef9343f8f8a0e261e /vcl/source/window | |
parent | 8d65f68f98950efe7cb117d7ad228bab79ad0ddb (diff) |
Extend loplugin:stringviewparam to starts/endsWith: vcl
Change-Id: Ic208697fd985da223819d203e67325b03028fca5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122469
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/layout.cxx | 9 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 12 |
2 files changed, 14 insertions, 7 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 4d25a0671836..e49396313449 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -7,11 +7,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <config_features.h> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <comphelper/base64.hxx> #include <o3tl/enumarray.hxx> #include <o3tl/enumrange.hxx> +#include <o3tl/string_view.hxx> #include <tools/stream.hxx> #include <vcl/builder.hxx> #include <vcl/toolkit/button.hxx> @@ -747,7 +752,7 @@ struct ButtonOrder } -static int getButtonPriority(const OString &rType) +static int getButtonPriority(std::string_view rType) { static const size_t N_TYPES = 6; static const ButtonOrder aDiscardCancelSave[N_TYPES] = @@ -783,7 +788,7 @@ static int getButtonPriority(const OString &rType) for (size_t i = 0; i < N_TYPES; ++i, ++pOrder) { - if (rType.endsWith(pOrder->m_aType)) + if (o3tl::ends_with(rType, pOrder->m_aType)) return pOrder->m_nPriority; } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index ea731d784a7d..1f142ab6775b 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -36,6 +36,7 @@ #include <tools/poly.hxx> #include <svl/imageitm.hxx> #include <sal/log.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <accel.hxx> @@ -49,6 +50,7 @@ #include <cstdlib> #include <map> +#include <string_view> #include <vector> #include <math.h> @@ -3591,12 +3593,12 @@ void ToolBox::Resize() namespace { - bool DispatchableCommand(const OUString& rName) + bool DispatchableCommand(std::u16string_view rName) { - return rName.startsWith(".uno") || - rName.startsWith("slot:") || - rName.startsWith("macro:") || - rName.startsWith("vnd.sun.star.script"); + return o3tl::starts_with(rName, u".uno") || + o3tl::starts_with(rName, u"slot:") || + o3tl::starts_with(rName, u"macro:") || + o3tl::starts_with(rName, u"vnd.sun.star.script"); } } |