summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-17 23:44:17 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-03-05 22:30:09 +0100
commitc7ab0bff8df23661ee9304578bd9fcf63f4d2dd0 (patch)
tree2322ff248c8aabeabd9b4313ce8b8fc9b6380ed7 /l10ntools
parent730df730a9425dbf4ed778dce7a95c1c0be274f6 (diff)
Use optimized OString concatenation
Change-Id: I7c74e007cb382701c3d9c41f9a6fb76ff0cb19fe Reviewed-on: https://gerrit.libreoffice.org/68120 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/xrmmerge.cxx42
1 files changed, 12 insertions, 30 deletions
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index b6f7d388c31f..26dee6f4540c 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -261,12 +261,8 @@ void XRMResParser::Execute( int nToken, char * pToken )
OString XRMResParser::GetAttribute( const OString &rToken, const OString &rAttribute )
{
- OString sTmp( rToken );
- sTmp = sTmp.replace('\t', ' ');
-
- OString sSearch( " " );
- sSearch += rAttribute;
- sSearch += "=";
+ const OString sSearch{ " " + rAttribute + "=" };
+ OString sTmp{ rToken.replace('\t', ' ') };
sal_Int32 nPos = sTmp.indexOf( sSearch );
if ( nPos<0 )
@@ -293,9 +289,7 @@ XRMResExport::XRMResExport(
pOutputStream.open( rOutputFile, PoOfstream::APP );
if (!pOutputStream.isOpen())
{
- OString sError( "Unable to open output file: " );
- sError += rOutputFile;
- Error( sError );
+ Error( "Unable to open output file: " + rOutputFile );
}
}
@@ -310,9 +304,8 @@ void XRMResExport::WorkOnDesc(
const OString &rOpenTag,
OString &rText )
{
- OString sDescFileName(
- sInputFileName.replaceAll("description.xml", OString()));
- sDescFileName += GetAttribute( rOpenTag, "xlink:href" );
+ const OString sDescFileName{ sInputFileName.replaceAll("description.xml", OString())
+ + GetAttribute( rOpenTag, "xlink:href" ) };
ifstream file (sDescFileName.getStr(), ios::in|ios::binary|ios::ate);
if (file.is_open()) {
int size = static_cast<int>(file.tellg());
@@ -377,9 +370,7 @@ XRMResMerge::XRMResMerge(
pOutputStream.open(
rOutputFile.getStr(), std::ios_base::out | std::ios_base::trunc);
if (!pOutputStream.is_open()) {
- OString sError( "Unable to open output file: " );
- sError += rOutputFile;
- Error( sError );
+ Error( "Unable to open output file: " + rOutputFile );
}
}
@@ -405,10 +396,8 @@ void XRMResMerge::WorkOnDesc(
( pEntrys->GetText( sText, sCur, true )) &&
!sText.isEmpty())
{
- OString sAdditionalLine( "\n " );
- sAdditionalLine += rOpenTag;
- OString sSearch = sLangAttribute;
- sSearch += "=\"";
+ OString sAdditionalLine{ "\n " + rOpenTag };
+ OString sSearch{ sLangAttribute + "=\"" };
OString sReplace( sSearch );
sSearch += GetAttribute( rOpenTag, sLangAttribute );
@@ -419,9 +408,7 @@ void XRMResMerge::WorkOnDesc(
sSearch = OString("xlink:href=\"");
sReplace = sSearch;
- OString sLocDescFilename = sDescFilename;
- sLocDescFilename = sLocDescFilename.replaceFirst(
- "en-US", sCur);
+ const OString sLocDescFilename = sDescFilename.replaceFirst( "en-US", sCur);
sSearch += sDescFilename;
sReplace += sLocDescFilename;
@@ -491,20 +478,15 @@ void XRMResMerge::EndOfText(
helper::isWellFormedXML( sContent ))
{
const OString& sText( sContent );
- OString sAdditionalLine( "\n " );
- sAdditionalLine += rOpenTag;
- OString sSearch = sLangAttribute;
- sSearch += "=\"";
+ OString sAdditionalLine{ "\n " + rOpenTag };
+ OString sSearch{ sLangAttribute + "=\"" };
OString sReplace( sSearch );
sSearch += GetAttribute( rOpenTag, sLangAttribute );
sReplace += sCur;
sAdditionalLine = sAdditionalLine.replaceFirst(
- sSearch, sReplace);
-
- sAdditionalLine += sText;
- sAdditionalLine += rCloseTag;
+ sSearch, sReplace) + sText + rCloseTag;
Output( sAdditionalLine );
}