diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-12-07 10:49:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-12-07 11:33:12 +0000 |
commit | 6c335f5754ec1aee70cdba2d332e9cece17a7565 (patch) | |
tree | 01acd92ce6411e99e6498b11b467b41c47cd6c7f /l10ntools/source/export2.cxx | |
parent | 47690422e42f5fce29b331218a2d05966c13946d (diff) |
convert some archaic l10ntools code
Diffstat (limited to 'l10ntools/source/export2.cxx')
-rw-r--r-- | l10ntools/source/export2.cxx | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index fec515f2b888..873f39c9e469 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -89,12 +89,13 @@ ResData::~ResData() // /*****************************************************************************/ -ByteString Export::sLanguages; -ByteString Export::sForcedLanguages; +rtl::OString Export::sLanguages; +rtl::OString Export::sForcedLanguages; /*****************************************************************************/ -void Export::DumpExportList( ByteString& sListName , ExportList& aList ){ - printf( "%s\n", sListName.GetBuffer() ); +void Export::DumpExportList(const rtl::OString& rListName, ExportList& aList) +{ + printf( "%s\n", rListName.getStr() ); ByteString l(""); ExportListEntry* aEntry; for( unsigned int x = 0; x < aList.size() ; x++ ){ @@ -103,12 +104,15 @@ void Export::DumpExportList( ByteString& sListName , ExportList& aList ){ } printf("\n"); } -ByteString Export::DumpMap( ByteString& sMapName , ByteStringHashMap& aMap ){ + +ByteString Export::DumpMap(const rtl::OString& rMapName, + ByteStringHashMap& aMap) +{ ByteStringHashMap::const_iterator idbg; ByteString sReturn; - if( sMapName.Len() ) - printf("MapName %s\n", sMapName.GetBuffer()); + if( rMapName.getLength() ) + printf("MapName %s\n", rMapName.getStr()); if( aMap.size() < 1 ) return ByteString(); for( idbg = aMap.begin() ; idbg != aMap.end(); ++idbg ){ ByteString a( idbg->first ); @@ -119,6 +123,7 @@ ByteString Export::DumpMap( ByteString& sMapName , ByteStringHashMap& aMap ){ printf("\n"); return sReturn; } + /*****************************************************************************/ void Export::SetLanguages( std::vector<ByteString> val ){ /*****************************************************************************/ @@ -347,17 +352,24 @@ bool Export::isInitialized = false; /*****************************************************************************/ void Export::InitLanguages( bool bMergeMode ){ /*****************************************************************************/ - if( !isInitialized ){ + if( !isInitialized ) + { ByteString sTmp; ByteStringBoolHashMap aEnvLangs; - for ( sal_uInt16 x = 0; x < sLanguages.GetTokenCount( ',' ); x++ ){ - sTmp = getToken(getToken(sLanguages, x, ','), 0, '='); + + sal_Int32 nIndex = 0; + do + { + rtl::OString aToken = sLanguages.getToken(0, ',', nIndex); + sTmp = getToken(aToken, 0, '='); sTmp = comphelper::string::strip(sTmp, ' '); if( bMergeMode && !isAllowed( sTmp ) ){} else if( !( (sTmp.GetChar(0)=='x' || sTmp.GetChar(0)=='X') && sTmp.GetChar(1)=='-' ) ){ aLanguages.push_back( sTmp ); } } + while ( nIndex >= 0 ); + InitForcedLanguages( bMergeMode ); isInitialized = true; } @@ -367,13 +379,19 @@ void Export::InitForcedLanguages( bool bMergeMode ){ /*****************************************************************************/ ByteString sTmp; ByteStringBoolHashMap aEnvLangs; - for ( sal_uInt16 x = 0; x < sForcedLanguages.GetTokenCount( ',' ); x++ ){ - sTmp = getToken(getToken(sForcedLanguages, x, ','), 0, '='); + + sal_Int32 nIndex = 0; + do + { + rtl::OString aToken = sForcedLanguages.getToken(0, ',', nIndex); + + sTmp = getToken(aToken, 0, '='); sTmp = comphelper::string::strip(sTmp, ' '); if( bMergeMode && isAllowed( sTmp ) ){} else if( !( (sTmp.GetChar(0)=='x' || sTmp.GetChar(0)=='X') && sTmp.GetChar(1)=='-' ) ) aForcedLanguages.push_back( sTmp ); } + while ( nIndex >= 0 ); } /*****************************************************************************/ |