summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-10-01 09:09:45 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-10-11 14:22:22 +0200
commit4f5b3e4bd53d6d61df1f65f496f7bc8dc525c8a1 (patch)
treee0ac44b8f22f944f3303bac8e494da41d6c7b164 /l10ntools
parent5f84c44e3d5ff19b800b6358e61228546e318d4f (diff)
In O[U]StringBuffer, make string_view params replacements for OUString ones
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/po.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index e935ab4831f8..dfe013cb9b7c 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -17,6 +17,7 @@
#include <vector>
#include <string>
+#include <string_view>
#include <po.hxx>
#include <helper.hxx>
@@ -50,7 +51,7 @@ public:
bool isFuzzy() const { return m_bFuzzy; }
bool isNull() const { return m_bNull; }
- void setExtractCom(const OString& rExtractCom)
+ void setExtractCom(std::string_view rExtractCom)
{
m_sExtractCom = rExtractCom;
}
@@ -274,9 +275,9 @@ PoEntry::PoEntry(
}
m_pGenPo->setMsgCtxt(sMsgCtxt);
m_pGenPo->setMsgId(rText);
- m_pGenPo->setExtractCom(
+ m_pGenPo->setExtractCom(OStringConcatenation(
( !rHelpText.isEmpty() ? rHelpText + "\n" : OString()) +
- genKeyId( m_pGenPo->getReference().front() + rGroupId + rLocalId + rResType + rText ) );
+ genKeyId( m_pGenPo->getReference().front() + rGroupId + rLocalId + rResType + rText ) ));
m_bIsInitialized = true;
}
@@ -441,7 +442,7 @@ PoHeader::PoHeader( std::string_view rExtSrc, const OString& rPoHeaderMsgStr )
: m_pGenPo( new GenPoEntry() )
, m_bIsInitialized( false )
{
- m_pGenPo->setExtractCom(OString::Concat("extracted from ") + rExtSrc);
+ m_pGenPo->setExtractCom(OStringConcatenation(OString::Concat("extracted from ") + rExtSrc));
m_pGenPo->setMsgStr(rPoHeaderMsgStr);
m_bIsInitialized = true;
}
@@ -450,7 +451,7 @@ PoHeader::PoHeader( std::string_view rExtSrc )
: m_pGenPo( new GenPoEntry() )
, m_bIsInitialized( false )
{
- m_pGenPo->setExtractCom(OString::Concat("extracted from ") + rExtSrc);
+ m_pGenPo->setExtractCom(OStringConcatenation(OString::Concat("extracted from ") + rExtSrc));
m_pGenPo->setMsgStr(
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?"