diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-07 14:36:26 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-08-08 10:47:31 +0300 |
commit | 7a597eb6248ef48ebeb23daa40d2c75e5a24d9ee (patch) | |
tree | b3cbd0db774b6dc5c06466b85ed2c4b42868afac /rsc/source/tools | |
parent | 976deb6b99df6a34f627cef726db595e924a8d87 (diff) |
STL'ify UniqueIndex
Convert the UniqueIndex code from a macro to a C++ template. Also use
std::map as the underlying container instead of tools/contnr.hxx.
Change-Id: I0b7b37dd7160ae019aaecdacd1e973ac6d8498e2
Diffstat (limited to 'rsc/source/tools')
-rw-r--r-- | rsc/source/tools/rscdef.cxx | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index 6c11ec970d5b..6f120221f194 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -653,15 +653,13 @@ RscFileTab::RscFileTab(){ |* *************************************************************************/ RscFileTab :: ~RscFileTab(){ - RscFile * pFile; aDefTree.Remove(); - pFile = Last(); - while( pFile ){ - Remove( GetIndex( pFile ) ); - delete pFile; - pFile = Prev(); + sal_uIntPtr aIndex = LastIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { + delete Remove( aIndex ); + aIndex = LastIndex(); }; } @@ -672,16 +670,14 @@ RscFileTab :: ~RscFileTab(){ *************************************************************************/ sal_uLong RscFileTab :: Find( const rtl::OString& rName ) { - RscFile * pFName; - - pFName = First(); - while( pFName && (pFName->aFileName != rName) ) - pFName = Next(); + sal_uIntPtr aIndex = FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND && (Get(aIndex)->aFileName != rName) ) + aIndex = NextIndex(aIndex); - if( pFName ) - return( GetIndex( pFName ) ); + if( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + return aIndex; else - return( NOFILE_INDEX ); + return NOFILE_INDEX; } /************************************************************************* @@ -702,13 +698,14 @@ sal_Bool RscFileTab::Depend( sal_uLong lDepend, sal_uLong lFree ){ if( lDepend == lFree ) return sal_True; - RscFile * pFile = First(); - while( pFile ){ + sal_uIntPtr aIndex = FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ){ + RscFile * pFile = Get(aIndex); if( !pFile->IsIncFile() ){ if( !pFile->Depend( lDepend, lFree ) ) return sal_False; }; - pFile = Next(); + aIndex = NextIndex(aIndex); }; return sal_True; |