From 98cabfbb707567fec39d6c71c5ee6a0dbea571d2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 1 Jul 2011 23:05:38 +0100 Subject: tweak appendLocaleInfo to return a new string --- unotools/inc/unotools/localedatawrapper.hxx | 2 +- unotools/source/i18n/localedatawrapper.cxx | 42 +++++++++++++++-------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'unotools') diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx index 306316683b94..8ff4e46da058 100644 --- a/unotools/inc/unotools/localedatawrapper.hxx +++ b/unotools/inc/unotools/localedatawrapper.hxx @@ -346,7 +346,7 @@ public: /** Append locale info to string, used with locale data checking. A string similar to "de_DE requested\n en_US loaded" is appended. */ - String& appendLocaleInfo( String& rDebugMsg ) const; + rtl::OUString appendLocaleInfo(const rtl::OUString& rDebugMsg) const; /** Ouput a message during locale data checking. The (UTF-8) string is written to stderr and in a non-product build or if DBG_UTIL is enabled diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 656453dde274..a8e1dccf0727 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -51,6 +51,7 @@ #include #include +#include #include #define LOCALEDATA_LIBRARYNAME "i18npool" @@ -770,7 +771,7 @@ void LocaleDataWrapper::getCurrSymbolsImpl() { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrSymbolsImpl: no default currency")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -882,7 +883,7 @@ void LocaleDataWrapper::getCurrFormatsImpl() { // bad luck if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrFormatsImpl: no currency formats")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -931,7 +932,7 @@ void LocaleDataWrapper::getCurrFormatsImpl() scanCurrFormatImpl( pFormatArr[nElem].Code, 0, nSign, nPar, nNum, nBlank, nSym ); if (areChecksEnabled() && (nNum == STRING_NOTFOUND || nSym == STRING_NOTFOUND)) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrFormatsImpl: CurrPositiveFormat?")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -962,7 +963,7 @@ void LocaleDataWrapper::getCurrFormatsImpl() nSym == STRING_NOTFOUND || (nPar == STRING_NOTFOUND && nSign == STRING_NOTFOUND))) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getCurrFormatsImpl: CurrNegativeFormat?")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1098,7 +1099,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode ) { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::scanDateFormat: not all DMY present")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1121,7 +1122,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode ) { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::scanDateFormat: no magic applyable")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1140,7 +1141,7 @@ void LocaleDataWrapper::getDateFormatsImpl() { // bad luck if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getDateFormatsImpl: no date formats")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1185,7 +1186,7 @@ void LocaleDataWrapper::getDateFormatsImpl() { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getDateFormatsImpl: no edit")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1193,7 +1194,7 @@ void LocaleDataWrapper::getDateFormatsImpl() { if (areChecksEnabled()) { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( + rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "LocaleDataWrapper::getDateFormatsImpl: no default")); outputCheckMessage( appendLocaleInfo( aMsg ) ); } @@ -1930,20 +1931,21 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals, } -String& LocaleDataWrapper::appendLocaleInfo( String& rDebugMsg ) const +rtl::OUString LocaleDataWrapper::appendLocaleInfo(const rtl::OUString& rDebugMsg) const { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); - rDebugMsg += '\n'; - rDebugMsg += String( aLocale.Language); - rDebugMsg += '_'; - rDebugMsg += String( aLocale.Country); - rDebugMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " requested\n" ) ); + rtl::OUStringBuffer aDebugMsg(rDebugMsg); + aDebugMsg.append(static_cast('\n')); + aDebugMsg.append(aLocale.Language); + aDebugMsg.append(static_cast('_')); + aDebugMsg.append(aLocale.Country); + aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" requested\n")); lang::Locale aLoaded = getLoadedLocale(); - rDebugMsg += String( aLoaded.Language); - rDebugMsg += '_'; - rDebugMsg += String( aLoaded.Country); - rDebugMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " loaded" ) ); - return rDebugMsg; + aDebugMsg.append(aLoaded.Language); + aDebugMsg.append(static_cast('_')); + aDebugMsg.append(aLoaded.Country); + aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" loaded")); + return aDebugMsg.makeStringAndClear(); } -- cgit v1.2.3