scaddins/source/pricing/pricing.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 3ead1e624514466811d451325d02acd50862c80a
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Sep 22 20:02:29 2021 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Sep 22 21:24:21 2021 +0200

    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 <sberg...@redhat.com>

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;

Reply via email to