diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-14 13:58:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-14 15:19:50 +0100 |
commit | 4a641de8e054e781fdb054be1210abe956effac0 (patch) | |
tree | eae9ff977fdb0e97f89d9768df6e5b85fdfbc76d | |
parent | 78fc50f06e5e9bb288570868f7521984d5d60981 (diff) |
ByteString -> rtl::OString
-rw-r--r-- | l10ntools/source/export2.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 2 | ||||
-rw-r--r-- | tools/inc/tools/isofallback.hxx | 4 | ||||
-rw-r--r-- | tools/source/rc/isofallback.cxx | 25 |
4 files changed, 18 insertions, 15 deletions
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 587f289115a5..0b7fb44d8a95 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -447,7 +447,7 @@ void Export::InitForcedLanguages( bool bMergeMode ){ ByteString Export::GetFallbackLanguage( const ByteString nLanguage ) /*****************************************************************************/ { - ByteString sFallback=nLanguage; + rtl::OString sFallback=nLanguage; GetIsoFallback( sFallback ); return sFallback; } diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 045ba7ceb299..9203fd94b5e7 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -57,7 +57,7 @@ void HelpParser::FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in XMLElement* pTmp2 = NULL; sCur = sLangIdx_in; - ByteString sFallback( sCur ); + rtl::OString sFallback( sCur ); GetIsoFallback( sFallback ); if( (rElem_out.find( sFallback ) != rElem_out.end()) && rElem_out[ sFallback ] != NULL ){ pTmp2 = rElem_out[ sFallback ]; diff --git a/tools/inc/tools/isofallback.hxx b/tools/inc/tools/isofallback.hxx index 485377605664..4a2346213ba1 100644 --- a/tools/inc/tools/isofallback.hxx +++ b/tools/inc/tools/isofallback.hxx @@ -29,11 +29,11 @@ #ifndef _ISOFALLBACK_HXX #define _ISOFALLBACK_HXX -#include <tools/string.hxx> +#include <rtl/string.hxx> #include "tools/toolsdllapi.h" // Return true if valid fallback found -TOOLS_DLLPUBLIC sal_Bool GetIsoFallback( ByteString& rLanguage ); +TOOLS_DLLPUBLIC bool GetIsoFallback(rtl::OString& rLanguage); #endif //_ISOFALLBACK_HXX diff --git a/tools/source/rc/isofallback.cxx b/tools/source/rc/isofallback.cxx index 94773de56ae0..e2a82a865b94 100644 --- a/tools/source/rc/isofallback.cxx +++ b/tools/source/rc/isofallback.cxx @@ -34,35 +34,38 @@ // ----------------------------------------------------------------------- // Return true if valid fallback found -sal_Bool GetIsoFallback( ByteString& rLanguage ) +bool GetIsoFallback(rtl::OString& rLanguage) { - rLanguage.EraseLeadingAndTrailingChars(); - if( rLanguage.Len() ){ - xub_StrLen nSepPos = rLanguage.Search( '-' ); - if ( nSepPos == STRING_NOTFOUND ){ - if ( rLanguage.Equals("en")) + rLanguage = rLanguage.trim(); + if (!rLanguage.isEmpty()) + { + sal_Int32 nSepPos = rLanguage.indexOf('-'); + if (nSepPos == -1) + { + if (rLanguage == rtl::OString(RTL_CONSTASCII_STRINGPARAM("en"))) { // en -> "" - rLanguage.Erase(); + rLanguage = rtl::OString(); return false; } else { // de -> en-US ; - rLanguage = ByteString("en-US"); + rLanguage = rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US")); return true; } } - else if( !( nSepPos == 1 && ( rLanguage.GetChar(0) == 'x' || rLanguage.GetChar(0) == 'X' ) ) ) + else if( !(nSepPos == 1 && (rLanguage.toChar() == 'x' || rLanguage.toChar() == 'X')) ) { // de-CH -> de ; // try erase from - - rLanguage = rLanguage.GetToken( 0, '-'); + sal_Int32 nIndex = 0; + rLanguage = rLanguage.getToken(0, '-', nIndex); return true; } } // "" -> ""; x-no-translate -> "" - rLanguage.Erase(); + rLanguage = rtl::OString(); return false; } |