summaryrefslogtreecommitdiff
path: root/i18npool/source
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-11-25 08:14:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-30 12:32:14 +0100
commit8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch)
treedd45d452202998297b8562743ea6345462304d04 /i18npool/source
parentd05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff)
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source')
-rw-r--r--i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx4
-rw-r--r--i18npool/source/localedata/LocaleNode.hxx2
-rw-r--r--i18npool/source/localedata/filewriter.cxx4
-rw-r--r--i18npool/source/numberformatcode/numberformatcode.cxx26
4 files changed, 18 insertions, 18 deletions
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 119cc76b4f61..2d55e1fd0974 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -546,10 +546,10 @@ void lcl_formatCharsGR(const sal_Unicode table[], int n, OUString& s )
}
static
-bool should_ignore( const OUString& s )
+bool should_ignore( std::u16string_view s )
{
// return true if blank or null
- return s == " " || (!s.isEmpty() && s[0]==0);
+ return s == u" " || (!s.empty() && s[0]==0);
}
/**
diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx
index f5990fcb772b..0d46a9e80876 100644
--- a/i18npool/source/localedata/LocaleNode.hxx
+++ b/i18npool/source/localedata/LocaleNode.hxx
@@ -49,7 +49,7 @@ public:
void writeFunction3(const char *func, const char *style, const char* levels, const char* attr, const char *array) const;
void writeRefFunction3(const char *func, const OUString& useLocale) const;
void writeIntParameter(const char* pAsciiStr, const sal_Int16 count, sal_Int16 val) const;
- bool writeDefaultParameter(const char* pAsciiStr, const OUString& str, sal_Int16 count) const;
+ bool writeDefaultParameter(const char* pAsciiStr, std::u16string_view str, sal_Int16 count) const;
void writeParameter(const char* pAsciiStr, const OUString& aChars) const;
void writeParameter(const char* pAsciiStr, const OUString& aChars, sal_Int16 count) const;
void writeParameter(const char* pAsciiStr, const OUString& aChars, sal_Int16 count0, sal_Int16 count1) const;
diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx
index f4652fefd610..f8643025d91d 100644
--- a/i18npool/source/localedata/filewriter.cxx
+++ b/i18npool/source/localedata/filewriter.cxx
@@ -126,9 +126,9 @@ void OFileWriter::writeIntParameter(const char* pAsciiStr, const sal_Int16 count
fprintf(m_f, "static const sal_Unicode %s%d[] = {%d};\n", pAsciiStr, count, val);
}
-bool OFileWriter::writeDefaultParameter(const char* pAsciiStr, const OUString& str, sal_Int16 count) const
+bool OFileWriter::writeDefaultParameter(const char* pAsciiStr, std::u16string_view str, sal_Int16 count) const
{
- bool bBool = str == "true";
+ bool bBool = str == u"true";
fprintf(m_f,"static const sal_Unicode default%s%d[] = {%d};\n", pAsciiStr, count, bBool);
return bBool;
}
diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx
index c98a8b36c01e..90d6904b85a1 100644
--- a/i18npool/source/numberformatcode/numberformatcode.cxx
+++ b/i18npool/source/numberformatcode/numberformatcode.cxx
@@ -175,13 +175,13 @@ NumberFormatCodeMapper::mapElementTypeShortToString(sal_Int16 formatType)
}
sal_Int16
-NumberFormatCodeMapper::mapElementTypeStringToShort(const OUString& formatType)
+NumberFormatCodeMapper::mapElementTypeStringToShort(std::u16string_view formatType)
{
- if ( formatType == "short" )
+ if ( formatType == u"short" )
return css::i18n::KNumberFormatType::SHORT;
- if ( formatType == "medium" )
+ if ( formatType == u"medium" )
return css::i18n::KNumberFormatType::MEDIUM;
- if ( formatType == "long" )
+ if ( formatType == u"long" )
return css::i18n::KNumberFormatType::LONG;
return css::i18n::KNumberFormatType::SHORT;
@@ -214,23 +214,23 @@ NumberFormatCodeMapper::mapElementUsageShortToString(sal_Int16 formatUsage)
sal_Int16
-NumberFormatCodeMapper::mapElementUsageStringToShort(const OUString& formatUsage)
+NumberFormatCodeMapper::mapElementUsageStringToShort(std::u16string_view formatUsage)
{
- if ( formatUsage == "DATE" )
+ if ( formatUsage == u"DATE" )
return css::i18n::KNumberFormatUsage::DATE;
- if ( formatUsage == "TIME" )
+ if ( formatUsage == u"TIME" )
return css::i18n::KNumberFormatUsage::TIME;
- if ( formatUsage == "DATE_TIME" )
+ if ( formatUsage == u"DATE_TIME" )
return css::i18n::KNumberFormatUsage::DATE_TIME;
- if ( formatUsage == "FIXED_NUMBER" )
+ if ( formatUsage == u"FIXED_NUMBER" )
return css::i18n::KNumberFormatUsage::FIXED_NUMBER;
- if ( formatUsage == "FRACTION_NUMBER" )
+ if ( formatUsage == u"FRACTION_NUMBER" )
return css::i18n::KNumberFormatUsage::FRACTION_NUMBER;
- if ( formatUsage == "PERCENT_NUMBER" )
+ if ( formatUsage == u"PERCENT_NUMBER" )
return css::i18n::KNumberFormatUsage::PERCENT_NUMBER;
- if ( formatUsage == "CURRENCY" )
+ if ( formatUsage == u"CURRENCY" )
return css::i18n::KNumberFormatUsage::CURRENCY;
- if ( formatUsage == "SCIENTIFIC_NUMBER" )
+ if ( formatUsage == u"SCIENTIFIC_NUMBER" )
return css::i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER;
return 0;