summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-11 22:24:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-12 12:42:15 +0200
commitcbaf1fbaa6e707d939f815eda360fad68a492aca (patch)
tree20b3dfeac257130afb01572b2c117b7840d07007 /l10ntools
parentf751417b77e6573a0c639778e76ec943449f4573 (diff)
loplugin:stringview more o3tl conversion
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/lngmerge.cxx6
-rw-r--r--l10ntools/source/propmerge.cxx11
2 files changed, 10 insertions, 7 deletions
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index f8dc6fc3c478..31bf50fc9126 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -36,7 +36,9 @@ bool lcl_isNextGroup(OString &sGroup_out, std::string_view sLineTrim)
{
if (o3tl::starts_with(sLineTrim, "[") && o3tl::ends_with(sLineTrim, "]"))
{
- sGroup_out = OString(sLineTrim).getToken(1, '[').getToken(0, ']').trim();
+ sLineTrim = o3tl::getToken(sLineTrim, 1, '[');
+ sLineTrim = o3tl::getToken(sLineTrim, 0, ']');
+ sGroup_out = OString(o3tl::trim(sLineTrim));
return true;
}
return false;
@@ -137,7 +139,7 @@ void LngParser::ReadLine(const OString &rLine_in,
{
if (!rLine_in.match(" *") && !rLine_in.match("/*"))
{
- OString sLang(rLine_in.getToken(0, '=').trim());
+ OString sLang(o3tl::trim(o3tl::getToken(rLine_in, 0, '=')));
if (!sLang.isEmpty()) {
OString sText(rLine_in.getToken(1, '"'));
rText_inout[sLang] = sText;
diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx
index 0fa81e4fb5ac..7b74ab4d3cf8 100644
--- a/l10ntools/source/propmerge.cxx
+++ b/l10ntools/source/propmerge.cxx
@@ -8,6 +8,7 @@
*/
#include <rtl/ustring.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <cstdlib>
@@ -142,12 +143,12 @@ void PropParser::Extract( const OString& rPOFile )
const sal_Int32 nEqualSign = sLine.indexOf('=');
if( nEqualSign != -1 )
{
- OString sID = sLine.copy( 0, nEqualSign ).trim();
- OString sText = lcl_ConvertToUTF8( sLine.copy( nEqualSign + 1 ).trim() );
+ std::string_view sID = o3tl::trim(sLine.subView( 0, nEqualSign ));
+ OString sText = lcl_ConvertToUTF8( OString(o3tl::trim(sLine.subView( nEqualSign + 1 ))) );
common::writePoEntry(
"Propex", aPOStream, m_sSource, "property",
- sID, OString(), OString(), sText);
+ OString(sID), OString(), OString(), sText);
}
}
@@ -191,13 +192,13 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil
if( !sLine.startsWith(" *") && !sLine.startsWith("/*") &&
nEqualSign != -1 )
{
- const OString sID( sLine.copy( 0, sLine.indexOf('=') ).trim() );
+ const OString sID( o3tl::trim(sLine.subView( 0, sLine.indexOf('=') )) );
ResData aResData( sID, m_sSource );
aResData.sResTyp = "property";
OString sNewText;
if( m_sLang == "qtz" )
{
- const OString sOriginText = lcl_ConvertToUTF8(sLine.copy( nEqualSign + 1 ).trim());
+ const OString sOriginText = lcl_ConvertToUTF8(OString(o3tl::trim(sLine.subView( nEqualSign + 1 ))));
sNewText = MergeEntrys::GetQTZText(aResData, sOriginText);
}
else if( pMergeDataFile )