summaryrefslogtreecommitdiff
path: root/vcl/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 /vcl/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 'vcl/source')
-rw-r--r--vcl/source/app/IconThemeInfo.cxx4
-rw-r--r--vcl/source/gdi/FileDefinitionWidgetDraw.cxx4
-rw-r--r--vcl/source/helper/driverblocklist.cxx4
-rw-r--r--vcl/source/image/ImplImageTree.cxx8
-rw-r--r--vcl/source/window/builder.cxx50
-rw-r--r--vcl/source/window/window2.cxx10
6 files changed, 40 insertions, 40 deletions
diff --git a/vcl/source/app/IconThemeInfo.cxx b/vcl/source/app/IconThemeInfo.cxx
index 877b7d570b0a..139181e65a1a 100644
--- a/vcl/source/app/IconThemeInfo.cxx
+++ b/vcl/source/app/IconThemeInfo.cxx
@@ -59,9 +59,9 @@ IconThemeInfo::IconThemeInfo(const OUString& urlToFile)
}
/*static*/ Size
-IconThemeInfo::SizeByThemeName(const OUString& themeName)
+IconThemeInfo::SizeByThemeName(std::u16string_view themeName)
{
- if (themeName == "galaxy") { //kept for compiler because of unused parameter 'themeName'
+ if (themeName == u"galaxy") { //kept for compiler because of unused parameter 'themeName'
return Size( 26, 26 );
}
else {
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 0144a458e8ce..6f10ec80fc92 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -95,9 +95,9 @@ int getSettingValueInteger(OString const& rValue, int nDefault)
return rValue.toInt32();
}
-bool getSettingValueBool(OString const& rValue, bool bDefault)
+bool getSettingValueBool(std::string_view rValue, bool bDefault)
{
- if (rValue.isEmpty())
+ if (rValue.empty())
return bDefault;
if (rValue == "true" || rValue == "false")
return rValue == "true";
diff --git a/vcl/source/helper/driverblocklist.cxx b/vcl/source/helper/driverblocklist.cxx
index b946d559c760..3adf57d118a1 100644
--- a/vcl/source/helper/driverblocklist.cxx
+++ b/vcl/source/helper/driverblocklist.cxx
@@ -23,7 +23,7 @@
namespace DriverBlocklist
{
-static OperatingSystem getOperatingSystem(const OString& rString)
+static OperatingSystem getOperatingSystem(std::string_view rString)
{
if (rString == "all")
return DRIVER_OS_ALL;
@@ -54,7 +54,7 @@ static OperatingSystem getOperatingSystem(const OString& rString)
return DRIVER_OS_UNKNOWN;
}
-static VersionComparisonOp getComparison(const OString& rString)
+static VersionComparisonOp getComparison(std::string_view rString)
{
if (rString == "less")
{
diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx
index 7dc365baf4b7..b7215ac65b97 100644
--- a/vcl/source/image/ImplImageTree.cxx
+++ b/vcl/source/image/ImplImageTree.cxx
@@ -307,15 +307,15 @@ std::shared_ptr<SvMemoryStream> ImplImageTree::getImageStream(OUString const & r
return std::shared_ptr<SvMemoryStream>();
}
-OUString ImplImageTree::fallbackStyle(const OUString& rsStyle)
+OUString ImplImageTree::fallbackStyle(std::u16string_view rsStyle)
{
OUString sResult;
- if (rsStyle == "colibre" || rsStyle == "helpimg")
+ if (rsStyle == u"colibre" || rsStyle == u"helpimg")
sResult = "";
- else if (rsStyle == "sifr" || rsStyle == "breeze_dark")
+ else if (rsStyle == u"sifr" || rsStyle == u"breeze_dark")
sResult = "breeze";
- else if (rsStyle == "sifr_dark" )
+ else if (rsStyle == u"sifr_dark" )
sResult = "breeze_dark";
else
sResult = "colibre";
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 6e752daa88a4..79d4a633bd54 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -84,57 +84,57 @@ static bool toBool(std::string_view rValue)
namespace
{
- OUString mapStockToImageResource(const OUString& sType)
+ OUString mapStockToImageResource(std::u16string_view sType)
{
- if (sType == "gtk-index")
+ if (sType == u"gtk-index")
return SV_RESID_BITMAP_INDEX;
- else if (sType == "gtk-refresh")
+ else if (sType == u"gtk-refresh")
return SV_RESID_BITMAP_REFRESH;
- else if (sType == "gtk-apply")
+ else if (sType == u"gtk-apply")
return IMG_APPLY;
- else if (sType == "gtk-dialog-error")
+ else if (sType == u"gtk-dialog-error")
return IMG_ERROR;
- else if (sType == "gtk-add")
+ else if (sType == u"gtk-add")
return IMG_ADD;
- else if (sType == "gtk-remove")
+ else if (sType == u"gtk-remove")
return IMG_REMOVE;
- else if (sType == "gtk-copy")
+ else if (sType == u"gtk-copy")
return IMG_COPY;
- else if (sType == "gtk-paste")
+ else if (sType == u"gtk-paste")
return IMG_PASTE;
return OUString();
}
- SymbolType mapStockToSymbol(const OUString& sType)
+ SymbolType mapStockToSymbol(std::u16string_view sType)
{
SymbolType eRet = SymbolType::DONTKNOW;
- if (sType == "gtk-media-next")
+ if (sType == u"gtk-media-next")
eRet = SymbolType::NEXT;
- else if (sType == "gtk-media-previous")
+ else if (sType == u"gtk-media-previous")
eRet = SymbolType::PREV;
- else if (sType == "gtk-media-play")
+ else if (sType == u"gtk-media-play")
eRet = SymbolType::PLAY;
- else if (sType == "gtk-media-stop")
+ else if (sType == u"gtk-media-stop")
eRet = SymbolType::STOP;
- else if (sType == "gtk-goto-first")
+ else if (sType == u"gtk-goto-first")
eRet = SymbolType::FIRST;
- else if (sType == "gtk-goto-last")
+ else if (sType == u"gtk-goto-last")
eRet = SymbolType::LAST;
- else if (sType == "gtk-go-back")
+ else if (sType == u"gtk-go-back")
eRet = SymbolType::ARROW_LEFT;
- else if (sType == "gtk-go-forward")
+ else if (sType == u"gtk-go-forward")
eRet = SymbolType::ARROW_RIGHT;
- else if (sType == "gtk-go-up")
+ else if (sType == u"gtk-go-up")
eRet = SymbolType::ARROW_UP;
- else if (sType == "gtk-go-down")
+ else if (sType == u"gtk-go-down")
eRet = SymbolType::ARROW_DOWN;
- else if (sType == "gtk-missing-image")
+ else if (sType == u"gtk-missing-image")
eRet = SymbolType::IMAGE;
- else if (sType == "gtk-help")
+ else if (sType == u"gtk-help")
eRet = SymbolType::HELP;
- else if (sType == "gtk-close")
+ else if (sType == u"gtk-close")
eRet = SymbolType::CLOSE;
- else if (sType == "gtk-new")
+ else if (sType == u"gtk-new")
eRet = SymbolType::PLUS;
else if (!mapStockToImageResource(sType).isEmpty())
eRet = SymbolType::IMAGE;
@@ -3108,7 +3108,7 @@ void VclBuilder::handleRow(xmlreader::XmlReader &reader, const OString &rID)
m_pParserState->m_aModels[rID].m_aEntries.push_back(aRow);
}
-void VclBuilder::handleListStore(xmlreader::XmlReader &reader, const OString &rID, const OString &rClass)
+void VclBuilder::handleListStore(xmlreader::XmlReader &reader, const OString &rID, std::string_view rClass)
{
int nLevel = 1;
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 9773ca2f8b53..a6399d24081d 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1367,17 +1367,17 @@ void Window::queue_resize(StateChangedType eReason)
namespace
{
- VclAlign toAlign(const OUString &rValue)
+ VclAlign toAlign(std::u16string_view rValue)
{
VclAlign eRet = VclAlign::Fill;
- if (rValue == "fill")
+ if (rValue == u"fill")
eRet = VclAlign::Fill;
- else if (rValue == "start")
+ else if (rValue == u"start")
eRet = VclAlign::Start;
- else if (rValue == "end")
+ else if (rValue == u"end")
eRet = VclAlign::End;
- else if (rValue == "center")
+ else if (rValue == u"center")
eRet = VclAlign::Center;
return eRet;
}