[Libreoffice-commits] .: 2 commits - tools/bootstrp tools/inc

Joseph Powers jpowers at kemper.freedesktop.org
Sat Feb 12 06:42:20 PST 2011


 tools/bootstrp/addexes/makefile.mk |    4 
 tools/bootstrp/makefile.mk         |    4 
 tools/bootstrp/mkcreate.cxx        |  173 ++++++++++++++-----------------------
 tools/bootstrp/prj.cxx             |   55 ++++-------
 tools/bootstrp/sstring.cxx         |  130 +++++++++++++++------------
 tools/inc/bootstrp/mkcreate.hxx    |    4 
 tools/inc/bootstrp/sstring.hxx     |   30 ++++--
 7 files changed, 186 insertions(+), 214 deletions(-)

New commits:
commit 941eb9f005e08f413a5341266db2d9a602cbafae
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Feb 12 06:40:48 2011 -0800

    Remove DECLARE_LIST( ByteStringList, ByteString* )

diff --git a/tools/bootstrp/mkcreate.cxx b/tools/bootstrp/mkcreate.cxx
index fdc895e..001e7b4 100644
--- a/tools/bootstrp/mkcreate.cxx
+++ b/tools/bootstrp/mkcreate.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -99,16 +99,14 @@ CodedDependency *SourceDirectory::AddCodedDependency(
         pCodedDependencies->PutString(( ByteString * ) pReturn );
     }
     else {
-        ULONG nPos =
-            pCodedDependencies->IsString( (ByteString *) (& rCodedIdentifier) );
+        size_t nPos = pCodedDependencies->IsString( (ByteString*)(&rCodedIdentifier) );
         if ( nPos == NOT_THERE ) {
             pReturn =
                 new CodedDependency( rCodedIdentifier, nOperatingSystems );
             pCodedDependencies->PutString(( ByteString * ) pReturn );
         }
         else {
-            pReturn =
-                ( CodedDependency * ) pCodedDependencies->GetObject( nPos );
+            pReturn = ( CodedDependency * ) (*pCodedDependencies)[ nPos ];
             pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems );
         }
     }
@@ -128,16 +126,14 @@ CodedDependency *SourceDirectory::AddCodedIdentifier(
         pCodedIdentifier->PutString(( ByteString * ) pReturn );
     }
     else {
-        ULONG nPos =
-            pCodedIdentifier->IsString( ( ByteString *) (& rCodedIdentifier) );
+        size_t nPos = pCodedIdentifier->IsString( ( ByteString*)(&rCodedIdentifier) );
         if ( nPos == NOT_THERE ) {
             pReturn =
                 new CodedDependency( rCodedIdentifier, nOperatingSystems );
             pCodedIdentifier->PutString(( ByteString * ) pReturn );
         }
         else {
-            pReturn =
-                ( CodedDependency * ) pCodedIdentifier->GetObject( nPos );
+            pReturn = ( CodedDependency * ) (*pCodedIdentifier)[ nPos ];
             pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems );
         }
     }
@@ -272,10 +268,9 @@ Dependency *SourceDirectory::ResolvesDependency(
     if ( !pCodedIdentifier )
         return NULL;
 
-    ULONG nPos = pCodedIdentifier->IsString( pCodedDependency );
+    size_t nPos = pCodedIdentifier->IsString( pCodedDependency );
     if ( nPos != NOT_THERE ) {
-        CodedDependency *pIdentifier =
-            ( CodedDependency * ) pCodedIdentifier->GetObject( nPos );
+        CodedDependency *pIdentifier = ( CodedDependency* )(*pCodedIdentifier)[ nPos ];
         USHORT nResult =
             pIdentifier->GetOperatingSystem() &
             pCodedDependency->GetOperatingSystem();
@@ -295,26 +290,24 @@ void SourceDirectory::ResolveDependencies()
     if ( !pSubDirectories )
         return;
 
-    for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
-        SourceDirectory *pActDirectory =
-            ( SourceDirectory * ) pSubDirectories->GetObject( i );
+    for ( size_t i = 0; i < pSubDirectories->size(); i++ ) {
+        SourceDirectory *pActDirectory = (SourceDirectory*)(*pSubDirectories)[ i ];
         if ( pActDirectory->pSubDirectories )
             pActDirectory->ResolveDependencies();
 
         if ( pActDirectory->pCodedDependencies ) {
-            while ( pActDirectory->pCodedDependencies->Count())
+            while ( pActDirectory->pCodedDependencies->size() )
             {
                 CodedDependency *pCodedDependency = ( CodedDependency * )
-                    pActDirectory->pCodedDependencies->GetObject(( ULONG ) 0 );
+                    (*pActDirectory->pCodedDependencies)[ 0 ];
 
-                for (
-                    ULONG k = 0;
-                    ( k < pSubDirectories->Count()) &&
-                        ( pCodedDependency->GetOperatingSystem() != OS_NONE );
-                    k++
+                for ( size_t k = 0;
+                         ( k < pSubDirectories->size() )
+                      && ( pCodedDependency->GetOperatingSystem() != OS_NONE );
+                      k++
                 ) {
                     Dependency *pDependency =
-                        ((SourceDirectory *) pSubDirectories->GetObject( k ))->
+                        ((SourceDirectory *)(*pSubDirectories)[ k ])->
                         ResolvesDependency( pCodedDependency );
                     if ( pDependency )
                     {
@@ -330,7 +323,7 @@ void SourceDirectory::ResolveDependencies()
                 }
                 else
                     delete pCodedDependency;
-                pActDirectory->pCodedDependencies->Remove(( ULONG ) 0 );
+                pActDirectory->pCodedDependencies->erase( 0 );
             }
         }
     }
@@ -345,33 +338,35 @@ ByteString SourceDirectory::GetTarget()
     if ( !pDependencies )
         return sReturn;
 
-    ULONG k = 0;
-    while ( k < pDependencies->Count()) {
-        if ( *this == *pDependencies->GetObject( k ))
-            delete pDependencies->Remove( k );
+    size_t k = 0;
+    while ( k < pDependencies->size()) {
+        if ( *this == *(*pDependencies)[ k ] )
+            delete pDependencies->erase( k );
         else
             k++;
     }
 
-    if ( !pDependencies->Count()) {
+    if ( !pDependencies->size() ) {
         delete pDependencies;
         pDependencies = NULL;
         return sReturn;
     }
 
     BOOL bDependsOnPlatform = FALSE;
-    for ( ULONG i = 0; i < pDependencies->Count(); i++ )
-        if ((( Dependency * ) pDependencies->GetObject( i ))->
-            GetOperatingSystem() != OS_ALL )
+    for ( size_t i = 0; i < pDependencies->size(); i++ ) {
+        if ( ((Dependency*)(*pDependencies)[ i ])->GetOperatingSystem() != OS_ALL ) {
             bDependsOnPlatform = TRUE;
+            break;
+        }
+    }
 
     ByteString sTarget( *this );
     sTarget.SearchAndReplaceAll( "\\", "$/" );
     if ( !bDependsOnPlatform ) {
         sReturn = sTarget;
         sReturn += " :";
-        for ( ULONG i = 0; i < pDependencies->Count(); i++ ) {
-            ByteString sDependency( *pDependencies->GetObject( i ));
+        for ( size_t i = 0; i < pDependencies->size(); i++ ) {
+            ByteString sDependency( *(*pDependencies)[ i ] );
             sDependency.SearchAndReplaceAll( "\\", "$/" );
             sReturn += " ";
             sReturn += sDependency;
@@ -393,9 +388,8 @@ ByteString SourceDirectory::GetTarget()
         sOS2 += " :";
         BOOL bOS2 = FALSE;
 
-        for ( ULONG i = 0; i < pDependencies->Count(); i++ ) {
-            Dependency *pDependency =
-                ( Dependency * ) pDependencies->GetObject( i );
+        for ( size_t i = 0; i < pDependencies->size(); i++ ) {
+            Dependency *pDependency = (Dependency*)(*pDependencies)[ i ];
             ByteString sDependency( *pDependency );
             sDependency.SearchAndReplaceAll( "\\", "$/" );
 
@@ -441,16 +435,17 @@ ByteString SourceDirectory::GetSubDirsTarget()
 
     if ( pSubDirectories ) {
         BOOL bDependsOnPlatform = FALSE;
-        for ( ULONG i = 0; i < pSubDirectories->Count(); i++ )
-            if ((( SourceDirectory * ) pSubDirectories->GetObject( i ))->
-                GetOperatingSystems() != OS_ALL )
+        for ( size_t i = 0; i < pSubDirectories->size(); i++ ) {
+            if ( ((SourceDirectory*)(*pSubDirectories)[ i ])->GetOperatingSystems() != OS_ALL ) {
                 bDependsOnPlatform = TRUE;
+            }
+        }
 
         if ( !bDependsOnPlatform ) {
             sReturn = "RC_SUBDIRS = ";
 
-            for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
-                ByteString sSubDirectory( *pSubDirectories->GetObject( i ));
+            for ( size_t i = 0; i < pSubDirectories->size(); i++ ) {
+                ByteString sSubDirectory( *(*pSubDirectories)[ i ] );
                 sSubDirectory.SearchAndReplaceAll( "\\", "$/" );
                 sReturn += " \\\n\t";
                 sReturn += sSubDirectory;
@@ -470,9 +465,8 @@ ByteString SourceDirectory::GetSubDirsTarget()
             sOS2 += "RC_SUBDIRS = ";
             BOOL bOS2 = FALSE;
 
-            for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
-                SourceDirectory *pDirectory =
-                    ( SourceDirectory * ) pSubDirectories->GetObject( i );
+            for ( size_t i = 0; i < pSubDirectories->size(); i++ ) {
+                SourceDirectory *pDirectory = (SourceDirectory*)(*pSubDirectories)[ i ];
                 ByteString sDirectory( *pDirectory );
                 sDirectory.SearchAndReplaceAll( "\\", "$/" );
 
@@ -537,38 +531,10 @@ SourceDirectory *SourceDirectory::CreateRootDirectory(
     ByteString sStandLst( aIniManager.ToLocal( sDefLst ));
     String s = String( sStandLst, gsl_getSystemTextEncoding());
     InformationParser aParser;
-//	fprintf( stderr,
-//		"Reading database %s ...\n", sStandLst.GetBuffer());
-    GenericInformationList *pVerList = aParser.Execute(
-        s );
-
-/*
-    ByteString sPath( rVersion );
-#ifndef UNX
-    sPath += ByteString( "/settings/solarlist" );
-#else
-    sPath += ByteString( "/settings/unxsolarlist" );
-#endif
-    ByteString sSolarList( _SOLARLIST );
-
-    GenericInformation *pInfo = pVerList->GetInfo( sPath, TRUE );
-    if ( pInfo ) {
-        ByteString aIniRoot( GetIniRoot() );
-        DirEntry aIniEntry( String( aIniRoot, RTL_TEXTENCODING_ASCII_US ));
-        aIniEntry += DirEntry( String( pInfo->GetValue(), RTL_TEXTENCODING_ASCII_US )).GetBase( PATH_SEPARATOR );
-        sSolarList = ByteString( aIniEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
-    }
-
-    sSolarList = aIniManager.ToLocal( sSolarList );
-    fprintf( stderr,
-        "Reading directory information %s ...\n", sSolarList.GetBuffer()); 
-*/
+    GenericInformationList *pVerList = aParser.Execute( s );
 
     ByteString sVersion( rVersion );
     Star aStar( pVerList, sVersion, TRUE, rRoot.GetBuffer());
-//	fprintf( stderr,
-//		"Creating virtual directory tree ...\n" );
-
 
     SourceDirectory *pSourceRoot = new SourceDirectory( rRoot, OS_ALL );
 
@@ -588,8 +554,8 @@ SourceDirectory *SourceDirectory::CreateRootDirectory(
 
             SByteStringList *pPrjDependencies = pPrj->GetDependencies( FALSE );
             if ( pPrjDependencies )
-                for ( ULONG x = 0; x < pPrjDependencies->Count(); x++ )
-                    pProject->AddCodedDependency( *pPrjDependencies->GetObject( x ), OS_ALL );
+                for ( size_t x = 0; x < pPrjDependencies->size(); x++ )
+                    pProject->AddCodedDependency( *(*pPrjDependencies)[ x ], OS_ALL );
 
             pProject->AddCodedIdentifier( pPrj->GetProjectName(), OS_ALL );
 
@@ -603,8 +569,8 @@ SourceDirectory *SourceDirectory::CreateRootDirectory(
                         pSourceRoot->InsertFull( sDirPath, pData->GetOSType());
                     SByteStringList *pDependencies = pData->GetDependencies();
                     if ( pDependencies ) {
-                        for ( ULONG k = 0; k < pDependencies->Count(); k++ ) {
-                            ByteString sDependency(*pDependencies->GetObject( k ));
+                        for ( size_t k = 0; k < pDependencies->size(); k++ ) {
+                            ByteString sDependency( *(*pDependencies)[ k ] );
                             ByteString sDependExt(sDependency.GetToken( 1, '.' ));
                             sDependExt.ToUpperAscii();
                             pDirectory->AddCodedDependency(
@@ -631,18 +597,17 @@ BOOL SourceDirectory::RemoveDirectoryTreeAndAllDependencies()
         return FALSE;
 
     SourceDirectoryList *pParentContent = pParent->pSubDirectories;
-    ULONG i = 0;
-    while ( i < pParentContent->Count()) {
-        SourceDirectory *pCandidate =
-            ( SourceDirectory * )pParentContent->GetObject( i );
+    size_t i = 0;
+    while ( i < pParentContent->size() ) {
+        SourceDirectory *pCandidate = (SourceDirectory*)(*pParentContent)[ i ];
         if ( pCandidate == this ) {
-            pParentContent->Remove( i );
+            pParentContent->erase( i );
         }
         else {
             if ( pCandidate->pDependencies ) {
-                ULONG nPos = pCandidate->pDependencies->IsString( this );
+                size_t nPos = pCandidate->pDependencies->IsString( this );
                 if ( nPos != NOT_THERE )
-                    delete pCandidate->pDependencies->Remove( nPos );
+                    delete pCandidate->pDependencies->erase( nPos );
             }
             i++;
         }
@@ -667,17 +632,15 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds )
         return FALSE;
     }
 
-    ULONG j = 0;
-    while( j < pSubDirectories->Count()) {
+    size_t j = 0;
+    while( j < pSubDirectories->size()) {
         String sSubDirectory(
-            (( SourceDirectory * ) pSubDirectories->GetObject( j ))->
-                GetFullPath(),
+            ((SourceDirectory*)(*pSubDirectories)[ j ])->GetFullPath(),
             gsl_getSystemTextEncoding()
         );
         DirEntry aSubDirectory( sSubDirectory );
-        if ( !aSubDirectory.Exists())
-            (( SourceDirectory * ) pSubDirectories->GetObject( j ))->
-                RemoveDirectoryTreeAndAllDependencies();
+        if ( !aSubDirectory.Exists() )
+            ((SourceDirectory*)(*pSubDirectories)[ j ])->RemoveDirectoryTreeAndAllDependencies();
         else
             j++;
     }
@@ -867,11 +830,8 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds )
     );
     aMakefile.WriteLine( sComment );
 
-    for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
-        ByteString sTarget(
-            (( SourceDirectory * )pSubDirectories->GetObject( i ))->
-            GetTarget()
-        );
+    for ( size_t i = 0; i < pSubDirectories->size(); i++ ) {
+        ByteString sTarget( ((SourceDirectory*)(*pSubDirectories)[ i ])->GetTarget() );
         if ( sTarget.Len())
             aMakefile.WriteLine( sTarget );
     }
@@ -910,11 +870,14 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds )
     fprintf( stdout, "\n" );
 
     BOOL bSuccess = TRUE;
-    if ( bAllChilds )
-        for ( ULONG k = 0; k < pSubDirectories->Count(); k++ )
-            if  ( !(( SourceDirectory * ) pSubDirectories->GetObject( k ))->
-                CreateRecursiveMakefile( TRUE ))
+    if ( bAllChilds ) {
+        for ( size_t k = 0; k < pSubDirectories->size(); k++ ) {
+            if ( !((SourceDirectory*)(*pSubDirectories)[ k ])->CreateRecursiveMakefile( TRUE ) ) {
                 bSuccess = FALSE;
+                break;
+            }
+        }
+    }
 
     return bSuccess;
 }
@@ -927,8 +890,8 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds )
 SourceDirectoryList::~SourceDirectoryList()
 /*****************************************************************************/
 {
-    for ( ULONG i = 0; i < Count(); i++ )
-        delete GetObject( i );
+    for ( size_t i = 0; i < size(); i++ )
+        delete at( i );
 }
 
 /*****************************************************************************/
@@ -936,9 +899,9 @@ SourceDirectory *SourceDirectoryList::Search(
     const ByteString &rDirectoryName )
 /*****************************************************************************/
 {
-    ULONG nPos = IsString( ( ByteString * ) (&rDirectoryName) );
+    size_t nPos = IsString( ( ByteString * ) (&rDirectoryName) );
     if ( nPos != LIST_ENTRY_NOTFOUND )
-        return ( SourceDirectory * ) GetObject( nPos );
+        return ( SourceDirectory * ) at( nPos );
 
     return NULL;
 }
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index c2bc3a4..23808f9 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -187,11 +187,8 @@ CommandData::~CommandData()
 {
     if ( pDepList )
     {
-        ByteString *pString = pDepList->First();
-        while ( pString )
-        {
-            delete pString;
-            pString = pDepList->Next();
+        for ( size_t i = 0, n = pDepList->size(); i < n; ++i ) {
+            delete (*pDepList)[ i ];
         }
         delete pDepList;
 
@@ -314,27 +311,17 @@ Prj::~Prj()
             delete maList[ i ];
         maList.clear();
 
-        ByteString *pString = pPrjDepList->First();
-        while ( pString )
-        {
-            delete pString;
-            pString = pPrjDepList->Next();
-        }
+        for ( size_t i = 0, n = pPrjDepList->size(); i < n; ++i )
+            delete (*pPrjDepList)[ i ];
         delete pPrjDepList;
-
         pPrjDepList = NULL;
     }
 
     if ( pPrjInitialDepList )
     {
-        ByteString *pString = pPrjInitialDepList->First();
-        while ( pString )
-        {
-            delete pString;
-            pString = pPrjInitialDepList->Next();
-        }
+        for ( size_t i = 0, n = pPrjInitialDepList->size(); i < n; ++i )
+            delete (*pPrjInitialDepList)[ i ];
         delete pPrjInitialDepList;
-
         pPrjInitialDepList = NULL;
     }
 }
@@ -410,12 +397,12 @@ CommandData* Prj::RemoveDirectory ( ByteString aLogFileName )
             if ( pDataDeps )
             {
                 ByteString* pString;
-                ULONG nDataDepsCount = pDataDeps->Count();
-                for ( ULONG j = nDataDepsCount; j > 0; j-- )
+                size_t nDataDepsCount = pDataDeps->size();
+                for ( size_t j = nDataDepsCount; j > 0; )
                 {
-                    pString = pDataDeps->GetObject( j - 1 );
+                    pString = (*pDataDeps)[ --j ];
                     if ( pString->GetToken( 0, '.') == aLogFileName )
-                        pDataDeps->Remove( pString );
+                        pDataDeps->erase( j );
                 }
             }
         }
@@ -676,13 +663,13 @@ void Star::ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj )
     ByteString* pDepend;
     ByteString* pPutStr;
     Prj *pNextPrj = NULL;
-    ULONG i, nRetPos;
+    size_t i, nRetPos;
 
     if ( pPrjLst ) {
         pDepLst = pDepPrj->GetDependencies();
         if ( pDepLst ) {
-            for ( i = 0; i < pDepLst->Count(); i++ ) {
-                pDepend = pDepLst->GetObject( i );
+            for ( i = 0; i < pDepLst->size(); i++ ) {
+                pDepend = (*pDepLst)[ i ];
                 pPutStr = new ByteString( *pDepend );
                 nRetPos = pPrjLst->PutString( pPutStr );
                 if( nRetPos == NOT_THERE )
@@ -1175,8 +1162,8 @@ USHORT StarWriter::WritePrj( Prj *pPrj, SvFileStream& rStream )
             else
                 aDataString+= ByteString(":");
             aDataString += aTab;
-            for ( USHORT i = 0; i< pPrjDepList->Count(); i++ ) {
-                aDataString += *pPrjDepList->GetObject( i );
+            for ( size_t i = 0; i< pPrjDepList->size(); i++ ) {
+                aDataString += *(*pPrjDepList)[ i ];
                 aDataString += aSpace;
             }
             aDataString+= "NULL";
@@ -1222,8 +1209,8 @@ USHORT StarWriter::WritePrj( Prj *pPrj, SvFileStream& rStream )
 
                     pCmdDepList = pCmdData->GetDependencies();
                     if ( pCmdDepList )
-                        for ( USHORT i = 0; i< pCmdDepList->Count(); i++ ) {
-                            aDataString += *pCmdDepList->GetObject( i );
+                        for ( size_t i = 0; i< pCmdDepList->size(); i++ ) {
+                            aDataString += *(*pCmdDepList)[ i ];
                             aDataString += aSpace;
                     }
                     aDataString += "NULL";
@@ -1531,12 +1518,12 @@ Prj* StarWriter::RemoveProject ( ByteString aProjectName )
             if ( pPrjDeps )
             {
                 ByteString* pString;
-                ULONG nPrjDepsCount = pPrjDeps->Count();
-                for ( ULONG j = nPrjDepsCount; j > 0; j-- )
+                size_t nPrjDepsCount = pPrjDeps->size();
+                for ( ULONG j = nPrjDepsCount; j > 0; )
                 {
-                    pString = pPrjDeps->GetObject( j - 1 );
+                    pString = (*pPrjDeps)[ --j ];
                     if ( pString->GetToken( 0, '.') == aProjectName )
-                        pPrjDeps->Remove( pString );
+                        pPrjDeps->erase( j );
                 }
             }
         }
diff --git a/tools/bootstrp/sstring.cxx b/tools/bootstrp/sstring.cxx
index 5224b2c..792f02a 100644
--- a/tools/bootstrp/sstring.cxx
+++ b/tools/bootstrp/sstring.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -29,11 +29,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_tools.hxx"
 
-#ifndef _TOOLS_STRINGLIST
-#  define _TOOLS_STRINGLIST
-#endif
-
-#define ENABLE_BYTESTRING_STREAM_OPERATORS 
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
 #include <tools/stream.hxx>
 #include "bootstrp/sstring.hxx"
 
@@ -43,14 +39,39 @@ SByteStringList::SByteStringList()
 
 SByteStringList::~SByteStringList()
 {
+    CleanUp();
+}
+
+size_t SByteStringList::size() const {
+    return maList.size();
+}
+
+ByteString* SByteStringList::erase( size_t i ) {
+    ByteString* result = NULL;
+    if ( i < maList.size() ) {
+        ByteStringList::iterator it = maList.begin();
+        ::std::advance( it, i );
+        result = *it;
+        maList.erase( it );
+    }
+    return result;
+}
+
+
+ByteString* SByteStringList::operator[]( size_t i ) const {
+    return ( i < maList.size() ) ? maList[ i ] : NULL;
+}
+
+ByteString* SByteStringList::at( size_t i ) const {
+    return ( i < maList.size() ) ? maList[ i ] : NULL;
 }
 
-ULONG SByteStringList::IsString( ByteString* pStr )
+size_t SByteStringList::IsString( ByteString* pStr )
 {
-    ULONG nRet = NOT_THERE;
+    size_t nRet = NOT_THERE;
     if ( (nRet = GetPrevString( pStr )) != 0 )
     {
-        ByteString* pString = GetObject( nRet );
+        ByteString* pString = maList[ nRet ];
         if ( *pString == *pStr )
             return nRet;
         else
@@ -58,7 +79,7 @@ ULONG SByteStringList::IsString( ByteString* pStr )
     }
     else
     {
-        ByteString* pString = GetObject( 0 );
+        ByteString* pString = maList.empty() ? NULL : maList[ 0 ];
         if ( pString && (*pString == *pStr) )
             return 0;
         else
@@ -66,22 +87,22 @@ ULONG SByteStringList::IsString( ByteString* pStr )
     }
 }
 
-ULONG SByteStringList::GetPrevString( ByteString* pStr )
+size_t SByteStringList::GetPrevString( ByteString* pStr )
 {
-    ULONG nRet = 0;
+    size_t nRet = 0;
     BOOL bFound = FALSE;
-    ULONG nCountMember = Count();
-    ULONG nUpper = nCountMember;
-    ULONG nLower = 0;
-    ULONG nCurrent = nUpper / 2;
-    ULONG nRem = 0;
+    size_t nCountMember = maList.size();
+    size_t nUpper = nCountMember;
+    size_t nLower = 0;
+    size_t nCurrent = nUpper / 2;
+    size_t nRem = 0;
     ByteString* pString;
 
     do
     {
         if ( (nCurrent == nLower) || (nCurrent == nUpper) )
             return nLower;
-        pString = GetObject( nCurrent );
+        pString = maList[ nCurrent ];
         StringCompare nResult =  pStr->CompareTo( *pString );
         if ( nResult == COMPARE_LESS )
         {
@@ -110,30 +131,36 @@ ULONG SByteStringList::GetPrevString( ByteString* pStr )
 *
 **************************************************************************/
 
-ULONG SByteStringList::PutString( ByteString* pStr )
+size_t SByteStringList::PutString( ByteString* pStr )
 {
-    ULONG nPos = GetPrevString ( pStr );
-    if ( Count() )
+    size_t nPos = GetPrevString ( pStr );
+    if ( maList.size() )
     {
+        ByteString* pString = NULL;
+        pString = maList[ 0 ];
+        if ( pString->CompareTo( *pStr ) == COMPARE_GREATER )
         {
-            ByteString* pString = GetObject( 0 );
-            if ( pString->CompareTo( *pStr ) == COMPARE_GREATER )
-            {
-                Insert( pStr, (ULONG)0 );
-                return (ULONG)0;
-            }
+            maList.insert( maList.begin(), pStr );
+            return 0;
         }
-        ByteString* pString = GetObject( nPos );
+        pString = maList[ nPos ];
         if ( *pStr != *pString )
         {
-            Insert( pStr, nPos+1 );
-            return ( nPos +1 );
+            if ( ++nPos < maList.size() ) {
+                ByteStringList::iterator it = maList.begin();
+                ::std::advance( it, nPos );
+                maList.insert( it, pStr );
+                return nPos;
+            } else {
+                maList.push_back( pStr );
+                return maList.size() - 1;
+            }
         }
     }
     else
     {
-        Insert( pStr );
-        return (ULONG)0;
+        maList.push_back( pStr );
+        return 0;
     }
 
     return NOT_THERE;
@@ -141,61 +168,52 @@ ULONG SByteStringList::PutString( ByteString* pStr )
 
 ByteString* SByteStringList::RemoveString( const ByteString& rName )
 {
-    ULONG i;
-    ByteString* pReturn;
+    ByteString* pReturn = NULL;
 
-    for( i = 0 ; i < Count(); i++ )
+    for ( ByteStringList::iterator it = maList.begin(); it < maList.end(); ++it )
     {
-        if ( rName == *GetObject( i ) )
+        if ( rName == *(*it) )
         {
-            pReturn = GetObject(i);
-            Remove(i);
+            pReturn = *it;
+            maList.erase( it );
             return pReturn;
         }
     }
 
-    return NULL;
+    return pReturn;
 }
 
 void SByteStringList::CleanUp()
 {
-    ByteString* pByteString = First();
-    while (pByteString) {
-        delete pByteString;
-        pByteString = Next();
+    for ( size_t i = 0, n = maList.size(); i < n; ++i ) {
+        delete maList[ i ];
     }
-    Clear();
+    maList.clear();
 }
 
 SByteStringList& SByteStringList::operator<<  ( SvStream& rStream )
 {
     sal_uInt32 nListCount;
     rStream >> nListCount;
-    for ( USHORT i = 0; i < nListCount; i++ ) { 
+    for ( sal_uInt32 i = 0; i < nListCount; i++ ) {
         ByteString* pByteString = new ByteString();
         rStream >> *pByteString;
-        Insert (pByteString, LIST_APPEND);
+        maList.push_back( pByteString );
     }
     return *this;
 }
 
 SByteStringList& SByteStringList::operator>>  ( SvStream& rStream )
 {
-    sal_uInt32 nListCount = Count();
+    sal_uInt32 nListCount = maList.size();
     rStream << nListCount;
-    ByteString* pByteString = First();
-    while (pByteString) {
-        rStream << *pByteString;
-        pByteString = Next();
+    for ( size_t i = 0; i < nListCount; ++i ) {
+        rStream << *( maList[ i ] );
     }
     return *this;
 }
 
-
-
-
-
-
+//=============================================================================
 
 SUniStringList::SUniStringList()
 {
diff --git a/tools/inc/bootstrp/mkcreate.hxx b/tools/inc/bootstrp/mkcreate.hxx
index ee89c00..48f8122 100644
--- a/tools/inc/bootstrp/mkcreate.hxx
+++ b/tools/inc/bootstrp/mkcreate.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -285,7 +285,7 @@ public:
 
     /* insert a new directory
      */
-    ULONG InsertSorted(
+    size_t InsertSorted(
         SourceDirectory *pDirectory 	// directory
     )
     {
diff --git a/tools/inc/bootstrp/sstring.hxx b/tools/inc/bootstrp/sstring.hxx
index 8e21af0..a8fc4ac 100644
--- a/tools/inc/bootstrp/sstring.hxx
+++ b/tools/inc/bootstrp/sstring.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -31,13 +31,14 @@
 
 #include <tools/string.hxx>
 #include <tools/list.hxx>
+#include <vector>
 
 #define NOT_THERE		LIST_ENTRY_NOTFOUND
 
-#define  SStringList SUniStringList 
-#define  StringList UniStringList 
+#define  SStringList SUniStringList
+#define  StringList UniStringList
 
-DECLARE_LIST( ByteStringList, ByteString* )
+typedef ::std::vector< ByteString* > ByteStringList;
 DECLARE_LIST( UniStringList, UniString* )
 
 class SvStream;
@@ -46,27 +47,34 @@ class SvStream;
 // - class SStringList -
 // ---------------------
 
-class SByteStringList : public ByteStringList
+class SByteStringList
 {
+private:
+    ByteStringList  maList;
+
 public:
                 SByteStringList();
                 ~SByteStringList();
 
                 // neuen ByteString in Liste einfuegen
-    ULONG		PutString( ByteString* );
-    ByteString* 	RemoveString( const ByteString& rName );
+    size_t      PutString( ByteString* );
+    ByteString* RemoveString( const ByteString& rName );
 
                 // Position des ByteString in Liste, wenn nicht enthalten, dann
                 // return = NOT_THERE
-    ULONG		IsString( ByteString* );
+    size_t		IsString( ByteString* );
 
                 // Vorgaenger ermitteln ( auch wenn selbst noch nicht in
                 // Liste enthalten
-    ULONG		GetPrevString( ByteString* );
+    size_t      GetPrevString( ByteString* );
     void		CleanUp();
+    size_t      size() const;
+    ByteString* erase( size_t i );
 
-    SByteStringList& operator<<  ( SvStream& rStream );
-    SByteStringList& operator>>  ( SvStream& rStream );
+    SByteStringList&    operator<<  ( SvStream& rStream );
+    SByteStringList&    operator>>  ( SvStream& rStream );
+    ByteString*         operator[]( size_t i ) const;
+    ByteString*         at( size_t i ) const;
 };
 
 // ---------------------
commit 6ee3a0521bf60a49e7c3d35c7c2428799aa4eedb
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Feb 12 06:32:42 2011 -0800

    Remove some unneeded CDEFS+=-D_TOOLS_STRINGLIST
    
    The only source code that referenced _TOOLS_STRINGLIST was sstring.cxx and
    all it did was define it if it wasn't already defined.

diff --git a/tools/bootstrp/addexes/makefile.mk b/tools/bootstrp/addexes/makefile.mk
index 324de94..45ba147 100644
--- a/tools/bootstrp/addexes/makefile.mk
+++ b/tools/bootstrp/addexes/makefile.mk
@@ -1,7 +1,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2000, 2010 Oracle and/or its affiliates.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -35,8 +35,6 @@ TARGETTYPE=CUI
 
 .INCLUDE :  settings.mk
 
-CDEFS+=-D_TOOLS_STRINGLIST
-
 # --- Files --------------------------------------------------------
 
 APP1TARGET= txtrepl
diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk
index 06162f0..b4508e1 100644
--- a/tools/bootstrp/makefile.mk
+++ b/tools/bootstrp/makefile.mk
@@ -1,7 +1,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2000, 2010 Oracle and/or its affiliates.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -36,8 +36,6 @@ LIBTARGET=NO
 
 .INCLUDE :  settings.mk
 
-CDEFS+=-D_TOOLS_STRINGLIST
-
 .IF "$(HAVE_GETOPT)" == "YES"
 CDEFS += -DHAVE_GETOPT
 .ENDIF


More information about the Libreoffice-commits mailing list