[Libreoffice-commits] .: rsc/inc rsc/source

Joseph Powers jpowers at kemper.freedesktop.org
Wed Jan 26 05:44:16 PST 2011


 rsc/inc/rscrsc.hxx       |   20 +++++++++-----------
 rsc/inc/rsctools.hxx     |    7 +++++--
 rsc/source/prj/start.cxx |   36 +++++++++++++-----------------------
 rsc/source/rsc/rsc.cxx   |   41 ++++++++++-------------------------------
 4 files changed, 37 insertions(+), 67 deletions(-)

New commits:
commit 88c0057434e9ee202a55b25b88dcc53a8cdaceb2
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Tue Jan 25 21:52:10 2011 -0800

    Remove DECLARE_LIST( RscStrList, ByteString * )

diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx
index 465c088..79b16f5 100644
--- a/rsc/inc/rscrsc.hxx
+++ b/rsc/inc/rscrsc.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
@@ -49,9 +49,8 @@ class RscCmdLine
     void		Init();
 
 public:
-    
+
     RscStrList			aInputList; 	// Liste der Quelldateien
-    RscStrList			aSymbolList;	// Liste der Symbole
     ByteString			aPath;		    // Liste der Pfade
     RSCBYTEORDER_TYPE	nByteOrder;
     unsigned short		nCommands;		// Steuerbits
@@ -69,11 +68,11 @@ public:
         ByteString			         aLangName;			// language name
         ByteString			         aOutputRc;			// target file
         ByteString			         aLangSearchPath;	// language specific search path
-        ::std::list< ByteString >    aSysSearchDirs;    // pathes to search for images         
-        
+        ::std::list< ByteString >    aSysSearchDirs;    // pathes to search for images
+
         OutputFile() {}
     };
-    
+
     std::list<OutputFile>						            m_aOutputFiles;
     std::list< std::pair< rtl::OString, rtl::OString > >    m_aReplacements;
 
@@ -81,7 +80,7 @@ public:
                     RscCmdLine();
 
                     ~RscCmdLine();
-                        
+
   ::rtl::OString     substitutePaths( const ::rtl::OString& rIn );
 };
 /****************** R s c ************************************************/
@@ -91,7 +90,6 @@ struct WriteRcContext;
 class RscCompiler
 {
 private:
-    RscStrList		aTmpFileList;	// Liste der Tmp-Dateien
     ByteString		aTmpOutputHxx;	// Name der TempHxx-Ausgabedatei
     ByteString		aTmpOutputCxx;	// Name der TempCxx-Ausgabedatei
     ByteString		aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei
@@ -100,15 +98,15 @@ private:
     void			CreateResFile( const char * pRc );
     void			Append( const ByteString& rOutputSrs, const ByteString& rTmpFile );
     void			OpenInput( const ByteString& rInput );
-    
+
     bool 			GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile,
                                        const WriteRcContext& rContext,
-                                    const ByteString& rBaseFileName, 
+                                    const ByteString& rBaseFileName,
                                     ByteString& rImagePath,
                                     FILE* pSysListFile );
     void			PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
                                           const WriteRcContext& rContext,
-                                         const DirEntry& rSrsInPath, 
+                                         const DirEntry& rSrsInPath,
                                          const DirEntry& rSrsOutPath );
 
 public:
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
index 9558826..55b5ead 100644
--- a/rsc/inc/rsctools.hxx
+++ b/rsc/inc/rsctools.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
@@ -37,6 +37,7 @@ class  RscPtrPtr;
 #include <stdio.h>
 #include <tools/string.hxx>
 #include <tools/list.hxx>
+#include <vector>
 
 /******************* T y p e s *******************************************/
 // Zeichensatz
@@ -63,7 +64,9 @@ int rsc_stricmp( const char *string1, const char *string2 );
 char* rsc_strdup( const char* );
 
 /****************** C L A S S E S ****************************************/
-DECLARE_LIST( RscStrList, ByteString * )
+
+typedef ::std::vector< ByteString* > RscStrList;
+
 /*********** R s c C h a r ***********************************************/
 class RscChar
 {
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index 21f5895..55a8b55 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.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
@@ -262,15 +262,14 @@ static BOOL CallRsc2( ByteString aRsc2Name,
         fprintf( fRspFile, "%s", aSrsName.GetBuffer() );
 #endif
 
-        pString = pInputList->First();
-        while( pString )
+        for ( size_t i = 0, n = pInputList->size(); i < n; ++i )
         {
+            pString = (*pInputList)[ i ];
 #ifdef OS2
             fprintf( fRspFile, "%s\n", pString->GetBuffer() );
 #else
             fprintf( fRspFile, " %s", pString->GetBuffer() );
 #endif
-            pString = pInputList->Next();
         };
 
         fclose( fRspFile );
@@ -403,21 +402,21 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         else
         {
             // Eingabedatei
-            aInputList.Insert( new ByteString( *ppStr ), CONTAINER_APPEND );
+            aInputList.push_back( new ByteString( *ppStr ) );
         }
         ppStr++;
         i++;
     }
 
-    if( aInputList.Count() )
+    if( !aInputList.empty() )
     {
         /* build the output file names			*/
         if( ! aResName.Len() )
-            aResName = OutputFile( *aInputList.First(), "res" );
+            aResName = OutputFile( *aInputList[ 0 ], "res" );
         if( ! bSetSrs )
         {
             aSrsName = "-fp=";
-            aSrsName += OutputFile( *aInputList.First(), "srs" );
+            aSrsName += OutputFile( *aInputList[ 0 ], "srs" );
         }
     };
 
@@ -426,13 +425,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         bPrePro = FALSE;
         bResFile = FALSE;
     };
-    if( bPrePro && aInputList.Count() )
+    if( bPrePro && !aInputList.empty() )
     {
         ByteString aTmpName;
 
-        pString = aInputList.First();
-        while( pString )
+        for ( size_t i = 0, n = aInputList.size(); i < n; ++i )
         {
+            pString = aInputList[ i ];
             aTmpName = ::GetTmpFileName();
             if( !CallPrePro( aPrePro, *pString, aTmpName, &aCmdLine, bResponse ) )
             {
@@ -440,8 +439,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                 bError = TRUE;
                 break;
             }
-            aTmpList.Insert( new ByteString( aTmpName ), CONTAINER_APPEND );
-            pString = aInputList.Next();
+            aTmpList.push_back( new ByteString( aTmpName ) );
         };
     };
 
@@ -458,16 +456,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         };
     };
 
-    pString = aTmpList.First();
-    while( pString )
-    {
-        #if OSL_DEBUG_LEVEL > 5
-        fprintf( stderr, "leaving temp file %s\n", pString->GetBuffer() );
-        #else
-        unlink( pString->GetBuffer() );
-        #endif
-        pString = aTmpList.Next();
-    };
+    for ( size_t i = 0, n = aTmpList.size(); i < n; ++i )
+        unlink( aTmpList[ i ]->GetBuffer() );
 
     return( bError );
 }
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index b1daba7..dd4dc87 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -216,7 +216,6 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
             else if( !rsc_strnicmp( (*ppStr) + 1, "d", 1 ) )
             { // Symbole definieren
                 nCommands |= DEFINE_FLAG;
-                aSymbolList.Insert( new ByteString( (*ppStr) + 2 ), 0xFFFF );
             }
             else if( !rsc_strnicmp( (*ppStr) + 1, "i", 1 ) )
             { // Include-Pfade definieren
@@ -304,7 +303,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
         else
         {
             // Eingabedatei
-            aInputList.Insert( new ByteString( *ppStr ), 0xFFFF );
+            aInputList.push_back( new ByteString( *ppStr ) );
         }
         ppStr++;
         i++;
@@ -313,16 +312,16 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
     if( nCommands & HELP_FLAG )
         pEH->FatalError( ERR_USAGE, RscId() );
     // was an inputted file specified
-    else if( aInputList.Count() )
+    else if( !aInputList.empty() )
     {
         ::std::list<OutputFile>::iterator it;
         for( it = m_aOutputFiles.begin(); it != m_aOutputFiles.end(); ++it )
         {
             if( ! it->aOutputRc.Len() )
-                it->aOutputRc  = ::OutputFile( *aInputList.First(), "rc"  );
+                it->aOutputRc  = ::OutputFile( *aInputList.front(), "rc"  );
         }
         if( ! bOutputSrsIsSet )
-            aOutputSrs = ::OutputFile( *aInputList.First(), "srs" );
+            aOutputSrs = ::OutputFile( *aInputList.front(), "srs" );
     }
     else if( !(nCommands & PRINTSYNTAX_FLAG) )
         pEH->FatalError( ERR_NOINPUT, RscId() );
@@ -337,12 +336,9 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH )
 *************************************************************************/
 RscCmdLine::~RscCmdLine()
 {
-    ByteString	*pString;
-
-    while( NULL != (pString = aInputList.Remove( (ULONG)0 )) )
-        delete pString;
-    while( NULL != (pString = aSymbolList.Remove( (ULONG)0 )) )
-        delete pString;
+    for ( size_t i = 0, n = aInputList.size(); i < n; ++i )
+        delete aInputList[ i ];
+    aInputList.clear();
 }
 
 /*************************************************************************
@@ -418,17 +414,6 @@ RscCompiler::RscCompiler( RscCmdLine * pLine, RscTypCont * pTypCont )
 *************************************************************************/
 RscCompiler::~RscCompiler()
 {
-    ByteString* pString;
-
-    // Dateien loeschen
-    pString = aTmpFileList.First();
-    while( pString )
-    {
-        unlink( pString->GetBuffer() );
-        delete pString;
-        pString = aTmpFileList.Next();
-    }
-
     pTC->pEH->SetListFile( NULL );
 
     if( fListing )
@@ -456,7 +441,6 @@ RscCompiler::~RscCompiler()
 ERRTYPE RscCompiler::Start()
 {
     ERRTYPE 		aError;
-    ByteString* 	pString;
     RscFile*		pFName;
 
     if( PRINTSYNTAX_FLAG & pCL->nCommands )
@@ -469,15 +453,11 @@ printf( "khg\n" );
     }
 
     // Kein Parameter, dann Hilfe
-    pString = pCL->aInputList.First();
-    if( !pString )
+    if( pCL->aInputList.empty() )
         pTC->pEH->FatalError( ERR_NOINPUT, RscId() );
 
-    while( pString )
-    {
-        pTC->aFileTab.NewCodeFile( *pString );
-        pString = pCL->aInputList.Next();
-    }
+    for( size_t i = 0, n = pCL->aInputList.size(); i < n; ++i )
+        pTC->aFileTab.NewCodeFile( *pCL->aInputList[ i ] );
 
     if( !(pCL->nCommands & NOSYNTAX_FLAG) )
     {
@@ -1096,7 +1076,6 @@ ByteString RscCompiler::GetTmpFileName()
     ByteString aFileName;
 
     aFileName = ::GetTmpFileName();
-    aTmpFileList.Insert( new ByteString( aFileName ) );
     return( aFileName );
 }
 


More information about the Libreoffice-commits mailing list