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/parser | |
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/parser')
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index 42fd1bd9c7c2..93a3281bdc69 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -357,20 +357,20 @@ sal_uInt32 RscTypCont :: PutSysName( sal_uInt32 nRscTyp, char * pFileName, *************************************************************************/ void RscTypCont :: WriteInc( FILE * fOutput, sal_uLong lFileKey ) { - RscFile * pFName; if( NOFILE_INDEX == lFileKey ) { - pFName = aFileTab.First(); - while( pFName ) + sal_uIntPtr aIndex = aFileTab.FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { - if( pFName && pFName->IsIncFile() ) + RscFile * pFName = aFileTab.Get( aIndex ); + if( pFName->IsIncFile() ) { fprintf( fOutput, "#include " ); fprintf( fOutput, "\"%s\"\n", pFName->aFileName.getStr() ); } - pFName = aFileTab.Next(); + aIndex = aFileTab.NextIndex( aIndex ); } } else @@ -378,7 +378,7 @@ void RscTypCont :: WriteInc( FILE * fOutput, sal_uLong lFileKey ) RscDepend * pDep; RscFile * pFile; - pFName = aFileTab.Get( lFileKey ); + RscFile * pFName = aFileTab.Get( lFileKey ); if( pFName ) { for ( size_t i = 0, n = pFName->aDepLst.size(); i < n; ++i ) @@ -723,12 +723,13 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, if( NOFILE_INDEX == nFileKey ) { - pFName = aFileTab.First(); - while( pFName ){ + sal_uIntPtr aIndex = aFileTab.FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { + pFName = aFileTab.Get( aIndex ); if( !pFName->IsIncFile() ) pFName->aDefLst.WriteAll( fOutput ); - aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) ); - pFName = aFileTab.Next(); + aEnumRef.WriteSrc( aIndex ); + aIndex = aFileTab.NextIndex( aIndex ); }; } else @@ -745,11 +746,11 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, RscId::SetNames( sal_False ); if( NOFILE_INDEX == nFileKey ) { - pFName = aFileTab.First(); - while( pFName ) + sal_uIntPtr aIndex = aFileTab.FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { - aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) ); - pFName = aFileTab.Next(); + aEnumRef.WriteSrc( aIndex ); + aIndex = aFileTab.NextIndex( aIndex ); }; } else @@ -805,13 +806,11 @@ ERRTYPE RscTypCont :: WriteHxx( FILE * fOutput, sal_uLong nFileKey ) if( NOFILE_INDEX == nFileKey ) { - RscFile * pFName; - - pFName = aFileTab.First(); - while( pFName ) + sal_uIntPtr aIndex = aFileTab.FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { - aError = aEnumRef.WriteHxx( aFileTab.GetIndex( pFName ) ); - pFName = aFileTab.Next(); + aError = aEnumRef.WriteHxx( aIndex ); + aIndex = aFileTab.NextIndex( aIndex ); }; } else @@ -838,13 +837,11 @@ ERRTYPE RscTypCont::WriteCxx( FILE * fOutput, sal_uLong nFileKey, if( NOFILE_INDEX == nFileKey ) { - RscFile * pFName; - - pFName = aFileTab.First(); - while( pFName ) + sal_uIntPtr aIndex = aFileTab.FirstIndex(); + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { - aError = aEnumRef.WriteCxx( aFileTab.GetIndex( pFName ) ); - pFName = aFileTab.Next(); + aError = aEnumRef.WriteCxx( aIndex ); + aIndex = aFileTab.NextIndex( aIndex ); }; } else |