summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-12 12:43:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-13 08:38:53 +0200
commitfdfd517a6f75e394ddcb1e195decbfed33ba56b9 (patch)
treee3bff14e5531affcd908415b4e85d7ceac4aa1fd /basic
parente568c9dca8b93b96a8a130a8fb6f1bba1a33d6ea (diff)
loplugin:stringviewparam whitelist some more functions
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/inc/sbxform.hxx2
-rw-r--r--basic/source/classes/sbunoobj.cxx4
-rw-r--r--basic/source/inc/sbunoobj.hxx7
-rw-r--r--basic/source/sbx/sbxform.cxx21
-rw-r--r--basic/source/sbx/sbxscan.cxx5
5 files changed, 21 insertions, 18 deletions
diff --git a/basic/inc/sbxform.hxx b/basic/inc/sbxform.hxx
index 8173c8ed87b7..8ae9cb2db3f4 100644
--- a/basic/inc/sbxform.hxx
+++ b/basic/inc/sbxform.hxx
@@ -95,7 +95,7 @@ class SbxBasicFormater {
OUString BasicFormat( double dNumber, const OUString& sFormatStrg );
static OUString BasicFormatNull( const OUString& sFormatStrg );
- static bool isBasicFormat( const OUString& sFormatStrg );
+ static bool isBasicFormat( std::u16string_view sFormatStrg );
private:
static inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 999972c94744..3dc1b8f643a0 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3271,14 +3271,14 @@ void VBAConstantHelper::init()
}
bool
-VBAConstantHelper::isVBAConstantType( const OUString& rName )
+VBAConstantHelper::isVBAConstantType( std::u16string_view rName )
{
init();
bool bConstant = false;
for (auto const& elem : aConstCache)
{
- if( rName.equalsIgnoreAsciiCase(elem) )
+ if( o3tl::equalsIgnoreAsciiCase(rName, elem) )
{
bConstant = true;
break;
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 1fc8ebe4e6c1..67be6f92ca5e 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -31,6 +31,7 @@
#include <com/sun/star/reflection/XIdlClass.hpp>
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <rtl/ustring.hxx>
+#include <o3tl/string_view.hxx>
#include <string_view>
#include <unordered_map>
@@ -65,9 +66,9 @@ class SbUnoStructRefObject final : public SbxObject
{
struct caseLessComp
{
- bool operator() (const OUString& rProp, std::u16string_view rOtherProp ) const
+ bool operator() (std::u16string_view rProp, std::u16string_view rOtherProp ) const
{
- return rProp.compareToIgnoreAsciiCase( rOtherProp ) < 0;
+ return o3tl::compareToIgnoreAsciiCase( rProp, rOtherProp ) < 0;
}
};
typedef std::map< OUString, std::unique_ptr<StructRefInfo>, caseLessComp > StructFieldInfo;
@@ -372,7 +373,7 @@ private:
public:
static VBAConstantHelper& instance();
SbxVariable* getVBAConstant( const OUString& rName );
- bool isVBAConstantType( const OUString& rName );
+ bool isVBAConstantType( std::u16string_view rName );
};
SbxVariable* getDefaultProp( SbxVariable* pRef );
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 0123dd076d02..ef273c1f392b 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -24,6 +24,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/character.hxx>
+#include <o3tl/string_view.hxx>
/*
TODO: are there any Star-Basic characteristics unconsidered?
@@ -957,41 +958,41 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormat
return sReturnStrg;
}
-bool SbxBasicFormater::isBasicFormat( const OUString& sFormatStrg )
+bool SbxBasicFormater::isBasicFormat( std::u16string_view sFormatStrg )
{
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_GENERALNUMBER ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_CURRENCY ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_CURRENCY ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_FIXED ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_FIXED ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_STANDARD ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_STANDARD ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_PERCENT ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_PERCENT ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_SCIENTIFIC ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_SCIENTIFIC ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_YESNO ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_YESNO ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_TRUEFALSE ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_TRUEFALSE ) )
{
return true;
}
- if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_ONOFF ) )
+ if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_ONOFF ) )
{
return true;
}
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 9151c34defba..ae6d50b9cfdf 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -48,6 +48,7 @@
#include <rtl/math.hxx>
#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
+#include <o3tl/string_view.hxx>
void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep, sal_Unicode& rcDecimalSepAlt )
@@ -470,12 +471,12 @@ const VbaFormatInfo pFormatInfoTable[] =
{ VbaFormatType::Null, std::u16string_view(u""), NF_INDEX_TABLE_ENTRIES, nullptr }
};
-const VbaFormatInfo* getFormatInfo( const OUString& rFmt )
+const VbaFormatInfo* getFormatInfo( std::u16string_view rFmt )
{
const VbaFormatInfo* pInfo = pFormatInfoTable;
while( pInfo->meType != VbaFormatType::Null )
{
- if( rFmt.equalsIgnoreAsciiCase( pInfo->mpVbaFormat ) )
+ if( o3tl::equalsIgnoreAsciiCase( rFmt, pInfo->mpVbaFormat ) )
break;
++pInfo;
}