diff options
author | Gökhan Gurbetoğlu <gokhan.gurbetoglu@pardus.org.tr> | 2018-04-12 02:08:51 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-17 08:16:54 +0200 |
commit | 37729618021bb44b9c6ba37dc72a1d3111ce0ffb (patch) | |
tree | 968a0c4e84ca9d54f7fbe833f9a268425e98fe81 | |
parent | 821371fb453f880240efa71ac3f556831be161d9 (diff) |
tdf#100726 - Improve readability of OUString concatanations
Change-Id: I3ba75dbe6754b8138f61e223387832a6fb53c1c5
Reviewed-on: https://gerrit.libreoffice.org/52752
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/source/filter/ftools/ftools.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 40 | ||||
-rw-r--r-- | sd/source/filter/html/htmlex.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 27 | ||||
-rw-r--r-- | stoc/test/testintrosp.cxx | 124 |
5 files changed, 105 insertions, 110 deletions
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index f7d085a28b6c..196f293aa097 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -119,12 +119,10 @@ rtl_TextEncoding ScfTools::GetSystemTextEncoding() OUString ScfTools::GetHexStr( sal_uInt16 nValue ) { const sal_Char pHex[] = "0123456789ABCDEF"; - OUString aStr; - - aStr += OUString( pHex[ nValue >> 12 ] ); - aStr += OUString( pHex[ (nValue >> 8) & 0x000F ] ); - aStr += OUString( pHex[ (nValue >> 4) & 0x000F ] ); - aStr += OUString( pHex[ nValue & 0x000F ] ); + OUString aStr = OUString( pHex[ nValue >> 12 ] ) + + OUString( pHex[ (nValue >> 8) & 0x000F ] ) + + OUString( pHex[ (nValue >> 4) & 0x000F ] ) + + OUString( pHex[ nValue & 0x000F ] ); return aStr; } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 099dae70e5e1..d27a894df309 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2100,12 +2100,12 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm ) rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true ); - aBufStr = "C;X"; - aBufStr += OUString::number( c ); - aBufStr += ";Y"; - aBufStr += OUString::number( r ); - aBufStr += ";K"; - aBufStr += aValStr; + aBufStr = "C;X" + + OUString::number( c ) + + ";Y" + + OUString::number( r ) + + ";K" + + aValStr; lcl_WriteSimpleString( rStrm, aBufStr ); goto checkformula; @@ -2115,11 +2115,11 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm ) aCellStr = pDoc->GetString(nCol, nRow, aRange.aStart.Tab()); aCellStr = aCellStr.replaceAll("\n", SYLK_LF); - aBufStr = "C;X"; - aBufStr += OUString::number( c ); - aBufStr += ";Y"; - aBufStr += OUString::number( r ); - aBufStr += ";K"; + aBufStr = "C;X" + + OUString::number( c ) + + ";Y" + + OUString::number( r ) + + ";K"; lcl_WriteSimpleString( rStrm, aBufStr ); lcl_WriteString( rStrm, aCellStr, '"', ';' ); @@ -2160,21 +2160,21 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm ) pFCell->GetMatColsRows( nC, nR ); nC += c - 1; nR += r - 1; - aPrefix = ";R"; - aPrefix += OUString::number( nR ); - aPrefix += ";C"; - aPrefix += OUString::number( nC ); - aPrefix += ";M"; + aPrefix = ";R" + + OUString::number( nR ) + + ";C" + + OUString::number( nC ) + + ";M"; } break; case ScMatrixMode::Reference : { // diff expression with 'I' M$-extension ScAddress aPos; (void)pFCell->GetMatrixOrigin( aPos ); - aPrefix = ";I;R"; - aPrefix += OUString::number( aPos.Row() - nStartRow + 1 ); - aPrefix += ";C"; - aPrefix += OUString::number( aPos.Col() - nStartCol + 1 ); + aPrefix = ";I;R" + + OUString::number( aPos.Row() - nStartRow + 1 ) + + ";C" + + OUString::number( aPos.Col() - nStartCol + 1 ); } break; default: diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index b9125a458b6f..f3dc165fabda 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -174,14 +174,12 @@ public: // close all still open tags OUString HtmlState::Flush() { - OUString aStr; - - aStr += SetWeight(false); - aStr += SetItalic(false); - aStr += SetUnderline(false); - aStr += SetStrikeout(false); - aStr += SetColor(maDefColor); - aStr += SetLink("",""); + OUString aStr = SetWeight(false) + + SetItalic(false) + + SetUnderline(false) + + SetStrikeout(false) + + SetColor(maDefColor) + + SetLink("",""); return aStr; } diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index cda6becfc1ab..86977473f966 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -143,14 +143,13 @@ OUString CreateSizeText( sal_Int64 nSize ) { aSizeStr = ::rtl::math::doubleToUString( fSize, rtl_math_StringFormat_F, nDec, - rLocaleWrapper.getNumDecimalSep()[0] ); - aSizeStr += aUnitStr; - - aSizeStr += " ("; - aSizeStr += rLocaleWrapper.getNum( nSize2, 0 ); - aSizeStr += " "; - aSizeStr += SfxResId(STR_BYTES); - aSizeStr += ")"; + rLocaleWrapper.getNumDecimalSep()[0] ) + + aUnitStr + + " (" + + rLocaleWrapper.getNum( nSize2, 0 ) + + " " + + SfxResId(STR_BYTES) + + ")"; } return aSizeStr; } @@ -161,9 +160,9 @@ OUString ConvertDateTime_Impl( const OUString& rName, Date aD(uDT); tools::Time aT(uDT); const OUString aDelim( ", " ); - OUString aStr( rWrapper.getDate( aD ) ); - aStr += aDelim; - aStr += rWrapper.getTime( aT ); + OUString aStr = rWrapper.getDate( aD ) + + aDelim + + rWrapper.getTime( aT ); OUString aAuthor = comphelper::string::stripStart(rName, ' '); if (!aAuthor.isEmpty()) { @@ -726,9 +725,9 @@ namespace Date aDate( _nDate ); tools::Time aTime( _nTime ); - OUString aStr( rWrapper.getDate( aDate ) ); - aStr += ", "; - aStr += rWrapper.getTime( aTime ); + OUString aStr = rWrapper.getDate( aDate ) + + ", " + + rWrapper.getTime( aTime ); return aStr; } diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx index f6888b504bf9..e33ee178e3e9 100644 --- a/stoc/test/testintrosp.cxx +++ b/stoc/test/testintrosp.cxx @@ -881,10 +881,10 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, sal_Int32 nLen = aRetSeq.getLength(); - aErrorStr = "Expected to find "; - aErrorStr += OString::valueOf( nDemandedPropCount ); - aErrorStr += " properties but found "; - aErrorStr += OString::valueOf( nLen ); + aErrorStr = "Expected to find " + + OString::valueOf( nDemandedPropCount ) + + " properties but found " + + OString::valueOf( nLen ); OSL_ENSURE( nLen == nDemandedPropCount, aErrorStr.getStr() ); const Property* pProps = aRetSeq.getConstArray(); @@ -909,23 +909,23 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OString aNameStr( aPropName.getStr(), aPropName.getLength(), RTL_TEXTENCODING_ASCII_US ); OString aDemandedName = pPropertyDefs[ iDemanded ].pName; - aErrorStr = "Expected property \""; - aErrorStr += aDemandedName; - aErrorStr += "\", found \""; - aErrorStr += aNameStr; - aErrorStr += "\""; + aErrorStr = "Expected property \"" + + aDemandedName + + "\", found \"" + + aNameStr + + "\""; OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() ); Type aPropType = aProp.Type; OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) ); OString aDemandedTypeNameStr = pDemandedPropTypes[ iDemanded ]; - aErrorStr = "Property \""; - aErrorStr += aDemandedName; - aErrorStr += "\", expected type >"; - aErrorStr += aDemandedTypeNameStr; - aErrorStr += "< found type >"; - aErrorStr += aTypeNameStr; - aErrorStr += "<"; + aErrorStr = "Property \"" + + aDemandedName + + "\", expected type >" + + aDemandedTypeNameStr + + "< found type >" + + aTypeNameStr + + "<"; OSL_ENSURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() ); // read and report value of property @@ -933,13 +933,13 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OString aValStr = OUStringToOString( AnyToString( aPropVal, sal_False, xMgr ), RTL_TEXTENCODING_ASCII_US ); OString aDemandedValStr = pDemandedPropVals[ iDemanded ]; - aErrorStr = "Property \""; - aErrorStr += aDemandedName; - aErrorStr += "\", expected val >"; - aErrorStr += aDemandedValStr; - aErrorStr += "< found val >"; - aErrorStr += aValStr; - aErrorStr += "<"; + aErrorStr = "Property \"" + + aDemandedName + + "\", expected val >" + + aDemandedValStr + + "< found val >" + + aValStr + + "<"; OSL_ENSURE( aValStr == aDemandedValStr, aErrorStr.getStr() ); // check value and modify it according to its type @@ -991,11 +991,11 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OUString aExactName = xExactName->getExactName( aUpperUStr ); if( aExactName != aPropName ) { - aErrorStr = "Property \""; - aErrorStr += OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US ); - aErrorStr += "\", not found as \""; - aErrorStr += OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US ); - aErrorStr += "\" using XExactName"; + aErrorStr = "Property \"" + + OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US ) + + "\", not found as \"" + + OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US ) + + "\" using XExactName"; OSL_ENSURE( sal_False, aErrorStr.getStr() ); } } @@ -1021,36 +1021,36 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OUString aStr = AnyToString( aPropVal, sal_False, xMgr ); OString aModifiedValStr = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US ); OString aDemandedModifiedValStr = pDemandedModifiedPropVals[ i ]; - aErrorStr = "Property \""; - aErrorStr += aDemandedName; - aErrorStr += "\", expected modified val >"; - aErrorStr += aDemandedModifiedValStr; - aErrorStr += "< found val >"; - aErrorStr += aModifiedValStr; - aErrorStr += "<"; + aErrorStr = "Property \"" + + aDemandedName + + "\", expected modified val >" + + aDemandedModifiedValStr + + "< found val >" + + aModifiedValStr + + "<"; OSL_ENSURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() ); } // check whether all properties can be found individually - aErrorStr = "property \""; - aErrorStr += aDemandedName; - aErrorStr += "\" not found with hasProperty()"; + aErrorStr = "property \"" + + aDemandedName + + "\" not found with hasProperty()"; OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts ); OSL_ENSURE( bProperty, aErrorStr.getStr() ); - aErrorStr = "property \""; - aErrorStr += aDemandedName; - aErrorStr += "\" not equal to same Property in sequence returned by getProperties()"; + aErrorStr = "property \"" + + aDemandedName + + "\" not equal to same Property in sequence returned by getProperties()"; try { Property aGetProp = xAccess->getProperty( aWDemandedName, nConcepts ); } catch (const RuntimeException &) { - aErrorStr = "property \""; - aErrorStr += aDemandedName; - aErrorStr += "\", exception was thrown when trying getProperty()"; + aErrorStr = "property \"" + + aDemandedName + + "\", exception was thrown when trying getProperty()"; OSL_ENSURE( sal_False, aErrorStr.getStr() ); } @@ -1080,10 +1080,10 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( nRealConcepts ); sal_Int32 nLen = aMethodSeq.getLength(); - aErrorStr = "Expected to find "; - aErrorStr += OString::valueOf( nDemandedMethCount ); - aErrorStr += " methods but found "; - aErrorStr += OString::valueOf( nLen ); + aErrorStr = "Expected to find " + + OString::valueOf( nDemandedMethCount ) + + " methods but found " + + OString::valueOf( nLen ); OSL_ENSURE( nLen == nDemandedMethCount, aErrorStr.getStr() ); const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); @@ -1107,24 +1107,24 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, OString aDemandedName = pMethodDefs[ iList ].pName; iList++; - aErrorStr = "Expected method \""; - aErrorStr += aDemandedName; - aErrorStr += "\", found \""; - aErrorStr += aNameStr; - aErrorStr += "\""; + aErrorStr = "Expected method \"" + + aDemandedName + + "\", found \"" + + aNameStr + + "\""; OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() ); // Check that the method is really there with hasMethod. - aErrorStr = "method \""; - aErrorStr += aDemandedName; - aErrorStr += "\" not found with hasMethod()"; + aErrorStr = "method \"" + + aDemandedName + + "\" not found with hasMethod()"; OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts ); OSL_ENSURE( bMethod, aErrorStr.getStr() ); - aErrorStr = "method \""; - aErrorStr += aDemandedName; - aErrorStr += "\" not equal to same method in sequence returned by getMethods()"; + aErrorStr = "method \"" + + aDemandedName + + "\" not equal to same method in sequence returned by getMethods()"; try { Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts ); @@ -1132,9 +1132,9 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, } catch (const RuntimeException &) { - aErrorStr = "method \""; - aErrorStr += aDemandedName; - aErrorStr += "\", exception was thrown when trying getMethod()"; + aErrorStr = "method \"" + + aDemandedName + + "\", exception was thrown when trying getMethod()"; OSL_ENSURE( sal_False, aErrorStr.getStr() ); } } |