summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-07 10:46:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-08 10:26:10 +0200
commit3a88b513fd90f4793b6de7a7412fa33369542f40 (patch)
tree293467f4143a28a2a19f037f3215f4391794c854 /l10ntools
parent388b4fc1085074da759903a9b1768bded43dd0d3 (diff)
loplugin:stringviewparam convert methods using trim
for which we add a new o3tl::trim method Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/inc/lngmerge.hxx2
-rw-r--r--l10ntools/source/lngmerge.cxx12
2 files changed, 8 insertions, 6 deletions
diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx
index 89f383d92ab7..3a6c2cc27be5 100644
--- a/l10ntools/inc/lngmerge.hxx
+++ b/l10ntools/inc/lngmerge.hxx
@@ -44,7 +44,7 @@ private:
OString sSource;
std::vector<OString> aLanguages;
- static bool isNextGroup(OString &sGroup_out, const OString &sLine_in);
+ static bool isNextGroup(OString &sGroup_out, std::string_view sLine_in);
static void ReadLine(const OString &rLine_in,
OStringHashMap &rText_inout);
static void WritePO(PoOfstream &aPOStream, OStringHashMap &rText_inout,
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 530bda4cfc5d..3accb5e4e636 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -19,6 +19,8 @@
#include <sal/config.h>
+#include <o3tl/string_view.hxx>
+
#include <cstddef>
#include <iostream>
#include <memory>
@@ -30,11 +32,11 @@
namespace {
-bool lcl_isNextGroup(OString &sGroup_out, const OString &sLineTrim)
+bool lcl_isNextGroup(OString &sGroup_out, std::string_view sLineTrim)
{
- if (sLineTrim.startsWith("[") && sLineTrim.endsWith("]"))
+ if (o3tl::starts_with(sLineTrim, "[") && o3tl::ends_with(sLineTrim, "]"))
{
- sGroup_out = sLineTrim.getToken(1, '[').getToken(0, ']').trim();
+ sGroup_out = OString(sLineTrim).getToken(1, '[').getToken(0, ']').trim();
return true;
}
return false;
@@ -125,9 +127,9 @@ void LngParser::WritePO(PoOfstream &aPOStream,
rID, OString(), rText_inout.count("x-comment") ? rText_inout["x-comment"] : OString(), rText_inout["en-US"]);
}
-bool LngParser::isNextGroup(OString &sGroup_out, const OString &sLine_in)
+bool LngParser::isNextGroup(OString &sGroup_out, std::string_view sLine_in)
{
- return lcl_isNextGroup(sGroup_out, sLine_in.trim());
+ return lcl_isNextGroup(sGroup_out, o3tl::trim(sLine_in));
}
void LngParser::ReadLine(const OString &rLine_in,