summaryrefslogtreecommitdiff
path: root/vcl
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 /vcl
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 'vcl')
-rw-r--r--vcl/inc/IconThemeScanner.hxx4
-rw-r--r--vcl/inc/listbox.hxx2
-rw-r--r--vcl/inc/window.h2
-rw-r--r--vcl/qt5/QtTransferable.cxx12
-rw-r--r--vcl/source/app/IconThemeScanner.cxx7
-rw-r--r--vcl/source/control/combobox.cxx2
-rw-r--r--vcl/source/control/imp_listbox.cxx5
-rw-r--r--vcl/source/filter/graphicfilter.cxx4
-rw-r--r--vcl/source/filter/webp/writer.cxx15
-rw-r--r--vcl/source/font/PhysicalFontFace.cxx5
-rw-r--r--vcl/source/gdi/FileDefinitionWidgetDraw.cxx7
-rw-r--r--vcl/source/gdi/WidgetDefinitionReader.cxx73
-rw-r--r--vcl/source/treelist/svtabbx.cxx9
-rw-r--r--vcl/source/window/syswin.cxx62
-rw-r--r--vcl/source/window/window2.cxx29
-rw-r--r--vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx11
-rw-r--r--vcl/workben/svpclient.cxx13
17 files changed, 135 insertions, 127 deletions
diff --git a/vcl/inc/IconThemeScanner.hxx b/vcl/inc/IconThemeScanner.hxx
index d997443a63aa..80f24054799f 100644
--- a/vcl/inc/IconThemeScanner.hxx
+++ b/vcl/inc/IconThemeScanner.hxx
@@ -31,7 +31,7 @@ public:
/** Factory method to create the object.
* Provide a path to search for IconThemes.
*/
- static std::shared_ptr<IconThemeScanner> Create(const OUString& path);
+ static std::shared_ptr<IconThemeScanner> Create(std::u16string_view path);
/** This method will return the standard path where icon themes are located.
*/
@@ -60,7 +60,7 @@ private:
* - The directory does not exist
* - There are no files which match the pattern images_xxx.zip
*/
- void ScanDirectoryForIconThemes(const OUString& path);
+ void ScanDirectoryForIconThemes(std::u16string_view path);
/** Adds the provided icon theme by path.
*/
diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx
index 561cbcfac636..6846a4272976 100644
--- a/vcl/inc/listbox.hxx
+++ b/vcl/inc/listbox.hxx
@@ -484,7 +484,7 @@ public:
bool IsSelectionChanged() const { return maLBWindow->IsSelectionChanged(); }
sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); }
- void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep );
+ void SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep );
OUString GetMRUEntries( sal_Unicode cSep ) const;
void SetMaxMRUCount( sal_Int32 n ) { maLBWindow->GetEntryList().SetMaxMRUCount( n ); }
sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList().GetMaxMRUCount(); }
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 903e857037aa..b0395330e19e 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -433,7 +433,7 @@ bool ImplLOKHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEve
void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight );
-VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, const OString& rStr);
+VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, std::string_view rStr);
VCL_DLLPUBLIC css::uno::Reference<css::accessibility::XAccessibleEditableText>
FindFocusedEditableText(css::uno::Reference<css::accessibility::XAccessibleContext> const&);
diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx
index 51178038dad2..806f57426255 100644
--- a/vcl/qt5/QtTransferable.cxx
+++ b/vcl/qt5/QtTransferable.cxx
@@ -21,18 +21,18 @@
#include <cassert>
-static bool lcl_textMimeInfo(const OUString& rMimeString, bool& bHaveNoCharset, bool& bHaveUTF16,
- bool& bHaveUTF8)
+static bool lcl_textMimeInfo(std::u16string_view rMimeString, bool& bHaveNoCharset,
+ bool& bHaveUTF16, bool& bHaveUTF8)
{
sal_Int32 nIndex = 0;
if (o3tl::getToken(rMimeString, 0, ';', nIndex) == u"text/plain")
{
- OUString aToken(rMimeString.getToken(0, ';', nIndex));
- if (aToken == "charset=utf-16")
+ std::u16string_view aToken(o3tl::getToken(rMimeString, 0, ';', nIndex));
+ if (aToken == u"charset=utf-16")
bHaveUTF16 = true;
- else if (aToken == "charset=utf-8")
+ else if (aToken == u"charset=utf-8")
bHaveUTF8 = true;
- else if (aToken.isEmpty())
+ else if (aToken.empty())
bHaveNoCharset = true;
else // we just handle UTF-16 and UTF-8, everything else is "bytes"
return false;
diff --git a/vcl/source/app/IconThemeScanner.cxx b/vcl/source/app/IconThemeScanner.cxx
index a9163af3c690..c8f6a1ac7e8d 100644
--- a/vcl/source/app/IconThemeScanner.cxx
+++ b/vcl/source/app/IconThemeScanner.cxx
@@ -18,6 +18,7 @@
#include <salhelper/linkhelper.hxx>
#include <unotools/pathoptions.hxx>
#include <vcl/IconThemeInfo.hxx>
+#include <o3tl/string_view.hxx>
namespace vcl {
@@ -59,7 +60,7 @@ OUString convert_to_absolute_path(const OUString& path)
IconThemeScanner::IconThemeScanner()
{}
-void IconThemeScanner::ScanDirectoryForIconThemes(const OUString& paths)
+void IconThemeScanner::ScanDirectoryForIconThemes(std::u16string_view paths)
{
mFoundIconThemes.clear();
@@ -68,7 +69,7 @@ void IconThemeScanner::ScanDirectoryForIconThemes(const OUString& paths)
sal_Int32 nIndex = 0;
do
{
- aPaths.push_front(paths.getToken(0, ';', nIndex));
+ aPaths.push_front(OUString(o3tl::getToken(paths, 0, ';', nIndex)));
}
while (nIndex >= 0);
@@ -168,7 +169,7 @@ IconThemeScanner::IconThemeIsInstalled(const OUString& themeId) const
}
/*static*/ std::shared_ptr<IconThemeScanner>
-IconThemeScanner::Create(const OUString &path)
+IconThemeScanner::Create(std::u16string_view path)
{
std::shared_ptr<IconThemeScanner> retval(new IconThemeScanner);
retval->ScanDirectoryForIconThemes(path);
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 44d7fc5f5b8a..50882532edc9 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1286,7 +1286,7 @@ void ComboBox::AddSeparator( sal_Int32 n )
m_pImpl->m_pImplLB->AddSeparator( n );
}
-void ComboBox::SetMRUEntries( const OUString& rEntries )
+void ComboBox::SetMRUEntries( std::u16string_view rEntries )
{
m_pImpl->m_pImplLB->SetMRUEntries( rEntries, ';' );
}
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 2d405e542775..13910084db77 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -35,6 +35,7 @@
#include <sal/log.hxx>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>
@@ -2419,7 +2420,7 @@ bool ImplListBox::HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control&
return bDone;
}
-void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
+void ImplListBox::SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep )
{
bool bChanges = GetEntryList().GetMRUCount() != 0;
@@ -2431,7 +2432,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
sal_Int32 nIndex = 0;
do
{
- OUString aEntry = rEntries.getToken( 0, cSep, nIndex );
+ OUString aEntry( o3tl::getToken(rEntries, 0, cSep, nIndex ) );
// Accept only existing entries
if ( GetEntryList().FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
{
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 6e486035b777..758052856f9b 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1208,7 +1208,7 @@ ErrCode GraphicFilter::readTIFF(SvStream & rStream, Graphic & rGraphic, GfxLinkT
return ERRCODE_GRFILTER_FILTERERROR;
}
-ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName)
+ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, std::u16string_view aFilterName)
{
ErrCode aReturnCode = ERRCODE_GRFILTER_FILTERERROR;
@@ -1218,7 +1218,7 @@ ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGra
if (!rStream.GetError())
{
- if (aFilterName.equalsIgnoreAsciiCase(IMP_MOV))
+ if (o3tl::equalsIgnoreAsciiCase(aFilterName, u"" IMP_MOV))
{
rGraphic.SetDefaultType();
rStream.Seek(STREAM_SEEK_TO_END);
diff --git a/vcl/source/filter/webp/writer.cxx b/vcl/source/filter/webp/writer.cxx
index b1ac654d858a..f29dad007ed6 100644
--- a/vcl/source/filter/webp/writer.cxx
+++ b/vcl/source/filter/webp/writer.cxx
@@ -23,6 +23,7 @@
#include <vcl/BitmapReadAccess.hxx>
#include <comphelper/scopeguard.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <webp/encode.h>
@@ -32,23 +33,23 @@ static int writerFunction(const uint8_t* data, size_t size, const WebPPicture* p
return stream->WriteBytes(data, size) == size ? 1 : 0;
}
-static WebPPreset presetToValue(const OUString& preset)
+static WebPPreset presetToValue(std::u16string_view preset)
{
- if (preset.equalsIgnoreAsciiCase("picture"))
+ if (o3tl::equalsIgnoreAsciiCase(preset, u"picture"))
return WEBP_PRESET_PICTURE;
- if (preset.equalsIgnoreAsciiCase("photo"))
+ if (o3tl::equalsIgnoreAsciiCase(preset, u"photo"))
return WEBP_PRESET_PHOTO;
- if (preset.equalsIgnoreAsciiCase("drawing"))
+ if (o3tl::equalsIgnoreAsciiCase(preset, u"drawing"))
return WEBP_PRESET_DRAWING;
- if (preset.equalsIgnoreAsciiCase("icon"))
+ if (o3tl::equalsIgnoreAsciiCase(preset, u"icon"))
return WEBP_PRESET_ICON;
- if (preset.equalsIgnoreAsciiCase("text"))
+ if (o3tl::equalsIgnoreAsciiCase(preset, u"text"))
return WEBP_PRESET_TEXT;
return WEBP_PRESET_DEFAULT;
}
static bool writeWebp(SvStream& rStream, const BitmapEx& bitmapEx, bool lossless,
- const OUString& preset, int quality)
+ std::u16string_view preset, int quality)
{
WebPConfig config;
if (!WebPConfigInit(&config))
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index b7c1ad7d0816..aef9054fdcc1 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -27,6 +27,7 @@
#include <font/FontSelectPattern.hxx>
#include <font/PhysicalFontFace.hxx>
+#include <o3tl/string_view.hxx>
#include <string_view>
@@ -80,9 +81,9 @@ static int FamilyNameMatchValue(FontSelectPattern const& rFSP, std::u16string_vi
return 0;
}
-static int StyleNameMatchValue(FontMatchStatus const& rStatus, OUString const& rStyle)
+static int StyleNameMatchValue(FontMatchStatus const& rStatus, std::u16string_view rStyle)
{
- if (rStatus.mpTargetStyleName && rStyle.equalsIgnoreAsciiCase(*rStatus.mpTargetStyleName))
+ if (rStatus.mpTargetStyleName && o3tl::equalsIgnoreAsciiCase(rStyle, *rStatus.mpTargetStyleName))
return 120000;
return 0;
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index ec840c984d80..88f4d6189a57 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/graphic/SvgTools.hpp>
#include <basegfx/DrawCommands.hxx>
+#include <o3tl/string_view.hxx>
using namespace css;
@@ -90,13 +91,13 @@ getWidgetDefinitionForTheme(std::u16string_view rThemenName)
return spDefinition;
}
-int getSettingValueInteger(OString const& rValue, int nDefault)
+int getSettingValueInteger(std::string_view rValue, int nDefault)
{
- if (rValue.isEmpty())
+ if (rValue.empty())
return nDefault;
if (!comphelper::string::isdigitAsciiString(rValue))
return nDefault;
- return rValue.toInt32();
+ return o3tl::toInt32(rValue);
}
bool getSettingValueBool(std::string_view rValue, bool bDefault)
diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx
index 7d3fb7c4c8f3..4f68c35e4de5 100644
--- a/vcl/source/gdi/WidgetDefinitionReader.cxx
+++ b/vcl/source/gdi/WidgetDefinitionReader.cxx
@@ -13,6 +13,7 @@
#include <sal/config.h>
#include <osl/file.hxx>
#include <tools/stream.hxx>
+#include <o3tl/string_view.hxx>
#include <unordered_map>
namespace vcl
@@ -69,77 +70,77 @@ OString getValueOrAny(OString const& rInputString)
return rInputString;
}
-ControlPart xmlStringToControlPart(OString const& sPart)
+ControlPart xmlStringToControlPart(std::string_view sPart)
{
- if (sPart.equalsIgnoreAsciiCase("NONE"))
+ if (o3tl::equalsIgnoreAsciiCase(sPart, "NONE"))
return ControlPart::NONE;
- else if (sPart.equalsIgnoreAsciiCase("Entire"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "Entire"))
return ControlPart::Entire;
- else if (sPart.equalsIgnoreAsciiCase("ListboxWindow"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ListboxWindow"))
return ControlPart::ListboxWindow;
- else if (sPart.equalsIgnoreAsciiCase("Button"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "Button"))
return ControlPart::Button;
- else if (sPart.equalsIgnoreAsciiCase("ButtonUp"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonUp"))
return ControlPart::ButtonUp;
- else if (sPart.equalsIgnoreAsciiCase("ButtonDown"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonDown"))
return ControlPart::ButtonDown;
- else if (sPart.equalsIgnoreAsciiCase("ButtonLeft"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonLeft"))
return ControlPart::ButtonLeft;
- else if (sPart.equalsIgnoreAsciiCase("ButtonRight"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonRight"))
return ControlPart::ButtonRight;
- else if (sPart.equalsIgnoreAsciiCase("AllButtons"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "AllButtons"))
return ControlPart::AllButtons;
- else if (sPart.equalsIgnoreAsciiCase("SeparatorHorz"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "SeparatorHorz"))
return ControlPart::SeparatorHorz;
- else if (sPart.equalsIgnoreAsciiCase("SeparatorVert"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "SeparatorVert"))
return ControlPart::SeparatorVert;
- else if (sPart.equalsIgnoreAsciiCase("TrackHorzLeft"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackHorzLeft"))
return ControlPart::TrackHorzLeft;
- else if (sPart.equalsIgnoreAsciiCase("TrackVertUpper"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackVertUpper"))
return ControlPart::TrackVertUpper;
- else if (sPart.equalsIgnoreAsciiCase("TrackHorzRight"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackHorzRight"))
return ControlPart::TrackHorzRight;
- else if (sPart.equalsIgnoreAsciiCase("TrackVertLower"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackVertLower"))
return ControlPart::TrackVertLower;
- else if (sPart.equalsIgnoreAsciiCase("TrackHorzArea"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackHorzArea"))
return ControlPart::TrackHorzArea;
- else if (sPart.equalsIgnoreAsciiCase("TrackVertArea"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackVertArea"))
return ControlPart::TrackVertArea;
- else if (sPart.equalsIgnoreAsciiCase("Arrow"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "Arrow"))
return ControlPart::Arrow;
- else if (sPart.equalsIgnoreAsciiCase("ThumbHorz"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ThumbHorz"))
return ControlPart::ThumbHorz;
- else if (sPart.equalsIgnoreAsciiCase("ThumbVert"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "ThumbVert"))
return ControlPart::ThumbVert;
- else if (sPart.equalsIgnoreAsciiCase("MenuItem"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "MenuItem"))
return ControlPart::MenuItem;
- else if (sPart.equalsIgnoreAsciiCase("MenuItemCheckMark"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "MenuItemCheckMark"))
return ControlPart::MenuItemCheckMark;
- else if (sPart.equalsIgnoreAsciiCase("MenuItemRadioMark"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "MenuItemRadioMark"))
return ControlPart::MenuItemRadioMark;
- else if (sPart.equalsIgnoreAsciiCase("Separator"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "Separator"))
return ControlPart::Separator;
- else if (sPart.equalsIgnoreAsciiCase("SubmenuArrow"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "SubmenuArrow"))
return ControlPart::SubmenuArrow;
- else if (sPart.equalsIgnoreAsciiCase("SubEdit"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "SubEdit"))
return ControlPart::SubEdit;
- else if (sPart.equalsIgnoreAsciiCase("DrawBackgroundHorz"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "DrawBackgroundHorz"))
return ControlPart::DrawBackgroundHorz;
- else if (sPart.equalsIgnoreAsciiCase("DrawBackgroundVert"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "DrawBackgroundVert"))
return ControlPart::DrawBackgroundVert;
- else if (sPart.equalsIgnoreAsciiCase("TabsDrawRtl"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "TabsDrawRtl"))
return ControlPart::TabsDrawRtl;
- else if (sPart.equalsIgnoreAsciiCase("HasBackgroundTexture"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "HasBackgroundTexture"))
return ControlPart::HasBackgroundTexture;
- else if (sPart.equalsIgnoreAsciiCase("HasThreeButtons"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "HasThreeButtons"))
return ControlPart::HasThreeButtons;
- else if (sPart.equalsIgnoreAsciiCase("BackgroundWindow"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "BackgroundWindow"))
return ControlPart::BackgroundWindow;
- else if (sPart.equalsIgnoreAsciiCase("BackgroundDialog"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "BackgroundDialog"))
return ControlPart::BackgroundDialog;
- else if (sPart.equalsIgnoreAsciiCase("Border"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "Border"))
return ControlPart::Border;
- else if (sPart.equalsIgnoreAsciiCase("Focus"))
+ else if (o3tl::equalsIgnoreAsciiCase(sPart, "Focus"))
return ControlPart::Focus;
return ControlPart::NONE;
}
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index b116c95d2e37..ec403682a35d 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -28,6 +28,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <strings.hrc>
#include <svdata.hxx>
@@ -171,8 +172,8 @@ void SvTabListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
const sal_uInt16 nCount = mvTabList.size() - 1;
for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
{
- const OUString aToken = GetToken(aCurEntry, nIndex);
- pEntry->AddItem(std::make_unique<SvLBoxString>(aToken));
+ const std::u16string_view aToken = GetToken(aCurEntry, nIndex);
+ pEntry->AddItem(std::make_unique<SvLBoxString>(OUString(aToken)));
}
}
@@ -317,9 +318,9 @@ sal_uInt32 SvTabListBox::GetEntryPos( const SvTreeListEntry* pEntry ) const
}
// static
-OUString SvTabListBox::GetToken( const OUString &sStr, sal_Int32& nIndex )
+std::u16string_view SvTabListBox::GetToken( std::u16string_view sStr, sal_Int32& nIndex )
{
- return sStr.getToken(0, '\t', nIndex);
+ return o3tl::getToken(sStr, 0, '\t', nIndex);
}
OUString SvTabListBox::GetTabEntryText( sal_uInt32 nPos, sal_uInt16 nCol ) const
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index f691f62dfda3..bf6be3b0ab10 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -36,6 +36,7 @@
#include <vcl/virdev.hxx>
#include <rtl/strbuf.hxx>
+#include <o3tl/string_view.hxx>
#include <accel.hxx>
#include <salframe.hxx>
@@ -398,16 +399,15 @@ const Size& SystemWindow::GetMaxOutputSizePixel() const
return mpImplData->maMaxOutSize;
}
-void ImplWindowStateFromStr(WindowStateData& rData,
- const OString& rStr)
+void ImplWindowStateFromStr(WindowStateData& rData, std::string_view rStr)
{
WindowStateMask nValidMask = WindowStateMask::NONE;
sal_Int32 nIndex = 0;
- OString aTokenStr = rStr.getToken(0, ',', nIndex);
- if (!aTokenStr.isEmpty())
+ std::string_view aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetX(aTokenStr.toInt32());
+ rData.SetX(o3tl::toInt32(aTokenStr));
if( rData.GetX() > -16384 && rData.GetX() < 16384 )
nValidMask |= WindowStateMask::X;
else
@@ -415,10 +415,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetX( 0 );
- aTokenStr = rStr.getToken(0, ',', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetY(aTokenStr.toInt32());
+ rData.SetY(o3tl::toInt32(aTokenStr));
if( rData.GetY() > -16384 && rData.GetY() < 16384 )
nValidMask |= WindowStateMask::Y;
else
@@ -426,10 +426,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetY( 0 );
- aTokenStr = rStr.getToken(0, ',', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetWidth(aTokenStr.toInt32());
+ rData.SetWidth(o3tl::toInt32(aTokenStr));
if( rData.GetWidth() > 0 && rData.GetWidth() < 16384 )
nValidMask |= WindowStateMask::Width;
else
@@ -437,10 +437,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetWidth( 0 );
- aTokenStr = rStr.getToken(0, ';', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetHeight(aTokenStr.toInt32());
+ rData.SetHeight(o3tl::toInt32(aTokenStr));
if( rData.GetHeight() > 0 && rData.GetHeight() < 16384 )
nValidMask |= WindowStateMask::Height;
else
@@ -448,12 +448,12 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetHeight( 0 );
- aTokenStr = rStr.getToken(0, ';', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex);
+ if (!aTokenStr.empty())
{
// #94144# allow Minimize again, should be masked out when read from configuration
// 91625 - ignore Minimize
- WindowStateState nState = static_cast<WindowStateState>(aTokenStr.toInt32());
+ WindowStateState nState = static_cast<WindowStateState>(o3tl::toInt32(aTokenStr));
//nState &= ~(WindowStateState::Minimized);
rData.SetState( nState );
nValidMask |= WindowStateMask::State;
@@ -462,10 +462,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
rData.SetState( WindowStateState::NONE );
// read maximized pos/size
- aTokenStr = rStr.getToken(0, ',', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetMaximizedX(aTokenStr.toInt32());
+ rData.SetMaximizedX(o3tl::toInt32(aTokenStr));
if( rData.GetMaximizedX() > -16384 && rData.GetMaximizedX() < 16384 )
nValidMask |= WindowStateMask::MaximizedX;
else
@@ -473,10 +473,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetMaximizedX( 0 );
- aTokenStr = rStr.getToken(0, ',', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetMaximizedY(aTokenStr.toInt32());
+ rData.SetMaximizedY(o3tl::toInt32(aTokenStr));
if( rData.GetMaximizedY() > -16384 && rData.GetMaximizedY() < 16384 )
nValidMask |= WindowStateMask::MaximizedY;
else
@@ -484,10 +484,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetMaximizedY( 0 );
- aTokenStr = rStr.getToken(0, ',', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetMaximizedWidth(aTokenStr.toInt32());
+ rData.SetMaximizedWidth(o3tl::toInt32(aTokenStr));
if( rData.GetMaximizedWidth() > 0 && rData.GetMaximizedWidth() < 16384 )
nValidMask |= WindowStateMask::MaximizedWidth;
else
@@ -495,10 +495,10 @@ void ImplWindowStateFromStr(WindowStateData& rData,
}
else
rData.SetMaximizedWidth( 0 );
- aTokenStr = rStr.getToken(0, ';', nIndex);
- if (!aTokenStr.isEmpty())
+ aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex);
+ if (!aTokenStr.empty())
{
- rData.SetMaximizedHeight(aTokenStr.toInt32());
+ rData.SetMaximizedHeight(o3tl::toInt32(aTokenStr));
if( rData.GetMaximizedHeight() > 0 && rData.GetMaximizedHeight() < 16384 )
nValidMask |= WindowStateMask::MaximizedHeight;
else
@@ -833,9 +833,9 @@ void SystemWindow::GetWindowStateData( WindowStateData& rData ) const
}
}
-void SystemWindow::SetWindowState(const OString& rStr)
+void SystemWindow::SetWindowState(std::string_view rStr)
{
- if (rStr.isEmpty())
+ if (rStr.empty())
return;
WindowStateData aData;
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index bf8973114185..eaa3c4fa7d25 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -34,6 +34,7 @@
#include <vcl/dockwin.hxx>
#include <vcl/settings.hxx>
#include <vcl/builder.hxx>
+#include <o3tl/string_view.hxx>
#include <window.h>
#include <svdata.hxx>
@@ -1405,28 +1406,28 @@ namespace
}
}
-bool Window::set_font_attribute(const OString &rKey, const OUString &rValue)
+bool Window::set_font_attribute(const OString &rKey, std::u16string_view rValue)
{
if (rKey == "weight")
{
vcl::Font aFont(GetControlFont());
- if (rValue == "thin")
+ if (rValue == u"thin")
aFont.SetWeight(WEIGHT_THIN);
- else if (rValue == "ultralight")
+ else if (rValue == u"ultralight")
aFont.SetWeight(WEIGHT_ULTRALIGHT);
- else if (rValue == "light")
+ else if (rValue == u"light")
aFont.SetWeight(WEIGHT_LIGHT);
- else if (rValue == "book")
+ else if (rValue == u"book")
aFont.SetWeight(WEIGHT_SEMILIGHT);
- else if (rValue == "normal")
+ else if (rValue == u"normal")
aFont.SetWeight(WEIGHT_NORMAL);
- else if (rValue == "medium")
+ else if (rValue == u"medium")
aFont.SetWeight(WEIGHT_MEDIUM);
- else if (rValue == "semibold")
+ else if (rValue == u"semibold")
aFont.SetWeight(WEIGHT_SEMIBOLD);
- else if (rValue == "bold")
+ else if (rValue == u"bold")
aFont.SetWeight(WEIGHT_BOLD);
- else if (rValue == "ultrabold")
+ else if (rValue == u"ultrabold")
aFont.SetWeight(WEIGHT_ULTRABOLD);
else
aFont.SetWeight(WEIGHT_BLACK);
@@ -1435,11 +1436,11 @@ bool Window::set_font_attribute(const OString &rKey, const OUString &rValue)
else if (rKey == "style")
{
vcl::Font aFont(GetControlFont());
- if (rValue == "normal")
+ if (rValue == u"normal")
aFont.SetItalic(ITALIC_NONE);
- else if (rValue == "oblique")
+ else if (rValue == u"oblique")
aFont.SetItalic(ITALIC_OBLIQUE);
- else if (rValue == "italic")
+ else if (rValue == u"italic")
aFont.SetItalic(ITALIC_NORMAL);
SetControlFont(aFont);
}
@@ -1452,7 +1453,7 @@ bool Window::set_font_attribute(const OString &rKey, const OUString &rValue)
else if (rKey == "size")
{
vcl::Font aFont(GetControlFont());
- sal_Int32 nHeight = rValue.toInt32() / 1000;
+ sal_Int32 nHeight = o3tl::toInt32(rValue) / 1000;
aFont.SetFontHeight(nHeight);
SetControlFont(aFont);
}
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index f83e861e9706..183f429e909c 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -399,18 +399,17 @@ void FilterEntry::getSubFilters( css::uno::Sequence< css::beans::StringPair >& _
}
static bool
-isFilterString( const OUString &rFilterString, const char *pMatch )
+isFilterString( std::u16string_view rFilterString, const char *pMatch )
{
sal_Int32 nIndex = 0;
- OUString aToken;
bool bIsFilter = true;
OUString aMatch(OUString::createFromAscii(pMatch));
do
{
- aToken = rFilterString.getToken( 0, ';', nIndex );
- if( !aToken.match( aMatch ) )
+ std::u16string_view aToken = o3tl::getToken(rFilterString, 0, ';', nIndex );
+ if( !o3tl::starts_with(aToken, aMatch) )
{
bIsFilter = false;
break;
@@ -439,11 +438,11 @@ shrinkFilterName( const OUString &rFilterName, bool bAllowNoStar = false )
nBracketLen = nBracketEnd - i;
if( nBracketEnd <= 0 )
continue;
- if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), "*." ) )
+ if( isFilterString( rFilterName.subView( i + 1, nBracketLen - 1 ), "*." ) )
aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" );
else if (bAllowNoStar)
{
- if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), ".") )
+ if( isFilterString( rFilterName.subView( i + 1, nBracketLen - 1 ), ".") )
aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" );
}
}
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index 07153f100016..584ad041d62a 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -41,6 +41,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
+#include <o3tl/string_view.hxx>
#include <math.h>
@@ -106,7 +107,7 @@ public:
virtual ~MyWin() override { disposeOnce(); }
virtual void dispose() override;
- void parseList( const OString& rList );
+ void parseList( std::string_view rList );
static OString processCommand( const OString& rCommand );
DECL_LINK( ListHdl, Button*, void );
@@ -167,19 +168,19 @@ void MyWin::dispose()
WorkWindow::dispose();
}
-void MyWin::parseList( const OString& rList )
+void MyWin::parseList( std::string_view rList )
{
sal_Int32 nTokenPos = 0;
OUString aElementType;
m_aSvpBitmaps->Clear();
while( nTokenPos >= 0 )
{
- OString aLine = rList.getToken( 0, '\n', nTokenPos );
- if( ! aLine.getLength() || *aLine.getStr() == '#' )
+ std::string_view aLine = o3tl::getToken(rList, 0, '\n', nTokenPos );
+ if( aLine.empty() || aLine[0] == '#' )
continue;
- if( aLine.startsWith( "ElementType: " ) )
- aElementType = OStringToOUString( aLine.subView( 13 ), RTL_TEXTENCODING_ASCII_US );
+ if( o3tl::starts_with(aLine, "ElementType: " ) )
+ aElementType = OStringToOUString( aLine.substr( 13 ), RTL_TEXTENCODING_ASCII_US );
else
{
OUString aNewElement =