diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 20:02:29 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-22 21:24:21 +0200 |
commit | 3ead1e624514466811d451325d02acd50862c80a (patch) | |
tree | 9ec017a1abd5390f7d960e34964c6156c1f45671 /scaddins | |
parent | ea29e9936a3e628f95ca4ae1d5816adfce87318f (diff) |
Extend loplugin:stringviewparam to starts/endsWith: scaddins
Change-Id: I4e6d9d8f429e9a9133a494790522217638ad18e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122484
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/pricing/pricing.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index 83cacff87fc8..3961603bc04b 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -32,8 +32,10 @@ #include <cppuhelper/weak.hxx> #include <algorithm> #include <cmath> +#include <string_view> #include <unotools/resmgr.hxx> #include <i18nlangtag/languagetag.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; using namespace sca::pricing; @@ -309,10 +311,10 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibility // auxiliary input handling functions namespace { -bool getinput_putcall(bs::types::PutCall& pc, const OUString& str) { - if(str.startsWith("c")) { +bool getinput_putcall(bs::types::PutCall& pc, std::u16string_view str) { + if(o3tl::starts_with(str, u"c")) { pc=bs::types::Call; - } else if(str.startsWith("p")) { + } else if(o3tl::starts_with(str, u"p")) { pc=bs::types::Put; } else { return false; @@ -343,10 +345,10 @@ bool getinput_strike(double& strike, const uno::Any& anyval) { return true; } -bool getinput_inout(bs::types::BarrierKIO& kio, const OUString& str) { - if(str.startsWith("i")) { +bool getinput_inout(bs::types::BarrierKIO& kio, std::u16string_view str) { + if(o3tl::starts_with(str, u"i")) { kio=bs::types::KnockIn; - } else if(str.startsWith("o")) { + } else if(o3tl::starts_with(str, u"o")) { kio=bs::types::KnockOut; } else { return false; @@ -354,10 +356,10 @@ bool getinput_inout(bs::types::BarrierKIO& kio, const OUString& str) { return true; } -bool getinput_barrier(bs::types::BarrierActive& cont, const OUString& str) { - if(str.startsWith("c")) { +bool getinput_barrier(bs::types::BarrierActive& cont, std::u16string_view str) { + if(o3tl::starts_with(str, u"c")) { cont=bs::types::Continuous; - } else if(str.startsWith("e")) { + } else if(o3tl::starts_with(str, u"e")) { cont=bs::types::Maturity; } else { return false; @@ -365,10 +367,10 @@ bool getinput_barrier(bs::types::BarrierActive& cont, const OUString& str) { return true; } -bool getinput_fordom(bs::types::ForDom& fd, const OUString& str) { - if(str.startsWith("f")) { +bool getinput_fordom(bs::types::ForDom& fd, std::u16string_view str) { + if(o3tl::starts_with(str, u"f")) { fd=bs::types::Foreign; - } else if(str.startsWith("d")) { + } else if(o3tl::starts_with(str, u"d")) { fd=bs::types::Domestic; } else { return false; |