summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 11:06:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-01 08:30:18 +0200
commit5200a73627d13e2997f81b53f61e143e77e328ee (patch)
treef95c8346d061ecd0ad33d574895d18e169662785 /vcl
parentb90d3d316dd9c720c83180b31f6bbd7003fead78 (diff)
use more string_view in various
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/jsdialog/executor.cxx2
-rw-r--r--vcl/source/outdev/text.cxx2
-rw-r--r--vcl/source/pdf/PDFiumTools.cxx44
-rw-r--r--vcl/unx/gtk3/gtkframe.cxx2
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx2
5 files changed, 26 insertions, 26 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index cda6a05a52d6..409c58ff2d49 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -92,7 +92,7 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM
int separatorPos = rData["data"].indexOf(';');
if (separatorPos > 0)
{
- OUString entryPos = rData["data"].copy(0, separatorPos);
+ std::u16string_view entryPos = rData["data"].subView(0, separatorPos);
OString posString = OUStringToOString(entryPos, RTL_TEXTENCODING_ASCII_US);
int pos = std::atoi(posString.getStr());
pCombobox->set_active(pos);
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 7d3662d0604d..cdf7a360a6ca 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2150,7 +2150,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
if ( nFirstContent < nLastContent )
{
- OUString aTempLastStr = aStr.copy( nLastContent );
+ std::u16string_view aTempLastStr = aStr.subView( nLastContent );
aTempStr = aFirstStr + aTempLastStr;
if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.getLength() ) > nMaxWidth )
diff --git a/vcl/source/pdf/PDFiumTools.cxx b/vcl/source/pdf/PDFiumTools.cxx
index 4fe465426201..28fa53b837e1 100644
--- a/vcl/source/pdf/PDFiumTools.cxx
+++ b/vcl/source/pdf/PDFiumTools.cxx
@@ -17,45 +17,45 @@ OUString convertPdfDateToISO8601(OUString const& rInput)
if (rInput.getLength() < 6)
return {};
- OUString prefix = rInput.copy(0, 2);
- if (prefix != "D:")
+ std::u16string_view prefix = rInput.subView(0, 2);
+ if (prefix != u"D:")
return {};
- OUString sYear = rInput.copy(2, 4);
+ std::u16string_view sYear = rInput.subView(2, 4);
- OUString sMonth("01");
+ std::u16string_view sMonth(u"01");
if (rInput.getLength() >= 8)
- sMonth = rInput.copy(6, 2);
+ sMonth = rInput.subView(6, 2);
- OUString sDay("01");
+ std::u16string_view sDay(u"01");
if (rInput.getLength() >= 10)
- sDay = rInput.copy(8, 2);
+ sDay = rInput.subView(8, 2);
- OUString sHours("00");
+ std::u16string_view sHours(u"00");
if (rInput.getLength() >= 12)
- sHours = rInput.copy(10, 2);
+ sHours = rInput.subView(10, 2);
- OUString sMinutes("00");
+ std::u16string_view sMinutes(u"00");
if (rInput.getLength() >= 14)
- sMinutes = rInput.copy(12, 2);
+ sMinutes = rInput.subView(12, 2);
- OUString sSeconds("00");
+ std::u16string_view sSeconds(u"00");
if (rInput.getLength() >= 16)
- sSeconds = rInput.copy(14, 2);
+ sSeconds = rInput.subView(14, 2);
OUString sTimeZoneMark("Z");
if (rInput.getLength() >= 17)
- sTimeZoneMark = rInput.copy(16, 1);
+ sTimeZoneMark = rInput.subView(16, 1);
- OUString sTimeZoneHours("00");
- OUString sTimeZoneMinutes("00");
+ std::u16string_view sTimeZoneHours(u"00");
+ std::u16string_view sTimeZoneMinutes(u"00");
if ((sTimeZoneMark == "+" || sTimeZoneMark == "-") && rInput.getLength() >= 22)
{
- OUString sTimeZoneSeparator = rInput.copy(19, 1);
- if (sTimeZoneSeparator == "'")
+ std::u16string_view sTimeZoneSeparator = rInput.subView(19, 1);
+ if (sTimeZoneSeparator == u"'")
{
- sTimeZoneHours = rInput.copy(17, 2);
- sTimeZoneMinutes = rInput.copy(20, 2);
+ sTimeZoneHours = rInput.subView(17, 2);
+ sTimeZoneMinutes = rInput.subView(20, 2);
}
}
@@ -65,8 +65,8 @@ OUString convertPdfDateToISO8601(OUString const& rInput)
else if (sTimeZoneMark == "Z")
sTimeZoneString = sTimeZoneMark;
- return sYear + "-" + sMonth + "-" + sDay + "T" + sHours + ":" + sMinutes + ":" + sSeconds
- + sTimeZoneString;
+ return OUString::Concat(sYear) + "-" + sMonth + "-" + sDay + "T" + sHours + ":" + sMinutes + ":"
+ + sSeconds + sTimeZoneString;
}
} // end vcl::pdf
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 0a2ad6dc0df3..91594957d66b 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -5609,7 +5609,7 @@ gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pCon
pThis->m_pFrame->CallCallback(SalEvent::SurroundingTextRequest, &aEvt);
OString sUTF = OUStringToOString(aEvt.maText, RTL_TEXTENCODING_UTF8);
- OUString sCursorText(aEvt.maText.copy(0, aEvt.mnStart));
+ std::u16string_view sCursorText(aEvt.maText.subView(0, aEvt.mnStart));
gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(),
OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength());
return true;
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index ca8c893d3915..d499cf0168f9 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17946,7 +17946,7 @@ public:
if (nCursorIndex != -1)
{
OString sUTF = OUStringToOString(sSurroundingText, RTL_TEXTENCODING_UTF8);
- OUString sCursorText(sSurroundingText.copy(0, nCursorIndex));
+ std::u16string_view sCursorText(sSurroundingText.subView(0, nCursorIndex));
gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(),
OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength());
}