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

Joseph Powers jpowers at kemper.freedesktop.org
Sat Jan 15 08:10:04 PST 2011


 tools/bootstrp/prj.cxx          |   37 +++++----
 tools/inc/bootstrp/listmacr.hxx |   53 -------------
 tools/inc/bootstrp/prj.hxx      |  157 ++++++++++++++++++++++++++++++++--------
 tools/prj/d.lst                 |    1 
 4 files changed, 150 insertions(+), 98 deletions(-)

New commits:
commit 25544f59773d8e3160fc4156d38205c441fcb53a
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Jan 15 08:09:38 2011 -0800

    Remove DECL_DEST_LIST()
    
    There where only 2 of them

diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index 5f232cd..9ef259c 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.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
@@ -141,7 +141,6 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments )
 
     aTmpStr = aTmpStr.EraseLeadingChars();
     aTmpStr = aTmpStr.EraseTrailingChars();
-//	while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (USHORT)-1 );
     int nLength = aTmpStr.Len();
     ByteString aEraseString;
     BOOL bFirstTab = TRUE;
@@ -311,6 +310,10 @@ Prj::~Prj()
 {
     if ( pPrjDepList )
     {
+        for ( size_t i = 0, n = maList.size(); i < n; ++i )
+            delete maList[ i ];
+        maList.clear();
+
         ByteString *pString = pPrjDepList->First();
         while ( pString )
         {
@@ -379,7 +382,7 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat,
     pData->SetLogFile( aLogFileName );
     pData->SetClientRestriction( rClientRestriction );
 
-    Insert( pData );
+    maList.push_back( pData );
 
     return FALSE;
 }
@@ -391,14 +394,14 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat,
 CommandData* Prj::RemoveDirectory ( ByteString aLogFileName )
 /*****************************************************************************/
 {
-    ULONG nCountMember = Count();
+    size_t nCountMember = maList.size();
     CommandData* pData;
     CommandData* pDataFound = NULL;
     SByteStringList* pDataDeps;
 
-    for ( USHORT i = 0; i < nCountMember; i++ )
+    for ( size_t i = 0; i < nCountMember; i++ )
     {
-        pData = GetObject( i );
+        pData = maList[ i ];
         if ( pData->GetLogFile() == aLogFileName )
             pDataFound = pData;
         else
@@ -452,7 +455,7 @@ Star::Star( SolarFileList *pSolarFiles )
 }
 
 /*****************************************************************************/
-Star::Star( GenericInformationList *pStandLst, ByteString &rVersion, 
+Star::Star( GenericInformationList *pStandLst, ByteString &rVersion,
     BOOL bLocal, const char *pSourceRoot )
 /*****************************************************************************/
 {
@@ -546,7 +549,7 @@ Star::Star( GenericInformationList *pStandLst, ByteString &rVersion,
                                     aPrjEntry += DirEntry( sPrjDir );
                                     aPrjEntry += DirEntry( sSolarFile );
 
-                                    pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND );										   
+                                    pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND );
 
                                     ByteString sFile( aPrjEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
                                 }
@@ -564,6 +567,9 @@ Star::Star( GenericInformationList *pStandLst, ByteString &rVersion,
 Star::~Star()
 /*****************************************************************************/
 {
+    for ( size_t i = 0, n = maStarList.size(); i < n; ++i )
+        delete maStarList[ i ];
+    maStarList.clear();
 }
 
 /*****************************************************************************/
@@ -582,7 +588,7 @@ BOOL Star::NeedsUpdate()
 }
 
 /*****************************************************************************/
-void Star::Read( String &rFileName ) 
+void Star::Read( String &rFileName )
 /*****************************************************************************/
 {
     ByteString aString;
@@ -613,7 +619,7 @@ void Star::Read( String &rFileName )
 void Star::Read( SolarFileList *pSolarFiles )
 /*****************************************************************************/
 {
-    while(  pSolarFiles->Count()) {
+    while(  pSolarFiles->Count() ) {
         ByteString aString;
 
         StarFile *pFile = new StarFile( *pSolarFiles->GetObject(( ULONG ) 0 ));
@@ -938,7 +944,6 @@ Prj* Star::GetPrj ( ByteString aProjectName )
         if ( pPrj->GetProjectName().EqualsIgnoreCaseAscii(aProjectName) )
             return pPrj;
     }
-//	return (Prj*)NULL;
     return 0L ;
 }
 
@@ -983,7 +988,7 @@ StarWriter::StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments )
 }
 
 /*****************************************************************************/
-StarWriter::StarWriter( GenericInformationList *pStandLst, ByteString &rVersion,         
+StarWriter::StarWriter( GenericInformationList *pStandLst, ByteString &rVersion,
     BOOL bLocal, const char *pSourceRoot )
 /*****************************************************************************/
 {
@@ -1077,7 +1082,7 @@ StarWriter::StarWriter( GenericInformationList *pStandLst, ByteString &rVersion,
                                     aPrjEntry += DirEntry( sPrjDir );
                                     aPrjEntry += DirEntry( sSolarFile );
 
-                                    pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND );										   
+                                    pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND );
 
                                     ByteString sFile( aPrjEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
                                     fprintf( stdout, "%s\n", sFile.GetBuffer());
@@ -1529,12 +1534,12 @@ BOOL StarWriter::InsertProject ( Prj* )
 Prj* StarWriter::RemoveProject ( ByteString aProjectName )
 /*****************************************************************************/
 {
-    ULONG nCountMember = Count();
+    size_t nCountMember = Count();
     Prj* pPrj;
     Prj* pPrjFound = NULL;
     SByteStringList* pPrjDeps;
 
-    for ( USHORT i = 0; i < nCountMember; i++ )
+    for ( size_t i = 0; i < nCountMember; i++ )
     {
         pPrj = GetObject( i );
         if ( pPrj->GetProjectName() == aProjectName )
@@ -1592,7 +1597,7 @@ BOOL StarFile::NeedsUpdate()
             return TRUE;
         }
         FileStat aStat( aEntry );
-        if (( aStat.DateModified() > aDate ) || 
+        if (( aStat.DateModified() > aDate ) ||
             (( aStat.DateModified() == aDate ) && ( aStat.TimeModified() > aTime )))
             return TRUE;
     }
diff --git a/tools/inc/bootstrp/listmacr.hxx b/tools/inc/bootstrp/listmacr.hxx
deleted file mode 100644
index 26a39bb..0000000
--- a/tools/inc/bootstrp/listmacr.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _LISTMACR_HXX
-#define _LISTMACR_HXX
-
-#define DECL_DEST_LIST( TmpListType, ListType, PointerType )	\
-DECLARE_LIST(TmpListType, PointerType)							\
-class ListType : public TmpListType								\
-{                                                           	\
-public:															\
-    void ClearAndDelete()                                       \
-    {                                                       	\
-        while ( Count()) {                                  	\
-            PointerType pTmp = GetObject(( ULONG ) 0 );     	\
-            delete pTmp;                                    	\
-            Remove(( ULONG ) 0 );                           	\
-        }                                                   	\
-    }                                                       	\
-    ~ListType()                                             	\
-    {                                                       	\
-        ClearAndDelete();										\
-    }                                                   		\
-};																\
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx
index 5b620af..05fe155 100644
--- a/tools/inc/bootstrp/prj.hxx
+++ b/tools/inc/bootstrp/prj.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,8 +31,8 @@
 
 #include <tools/fsys.hxx>
 #include <tools/stream.hxx>
-#include "bootstrp/listmacr.hxx"
 #include <osl/mutex.hxx>
+#include <vector>
 
 #define OS_NONE				0x0000
 #define OS_WIN16			0x0001
@@ -180,34 +180,37 @@ public:
 *
 *********************************************************************/
 
-DECL_DEST_LIST ( PrjList_tmp, PrjList, CommandData * )
+typedef ::std::vector< CommandData* > PrjList;
 
 class Star;
-class Prj : public PrjList
+class Prj
 {
 friend class Star;
 private:
-    BOOL			bVisited;
+    PrjList             maList;
+    size_t              maCurrent;
+
+    BOOL                bVisited;
 
-    ByteString			aPrjPath;
-    ByteString			aProjectName;
-    ByteString			aProjectPrefix;		// max. 2-buchstabige Abk.
-    SByteStringList*	pPrjInitialDepList;
-    SByteStringList*	pPrjDepList;
-    BOOL			bHardDependencies;
-    BOOL			bSorted;
+    ByteString          aPrjPath;
+    ByteString          aProjectName;
+    ByteString          aProjectPrefix;		// max. 2-buchstabige Abk.
+    SByteStringList*    pPrjInitialDepList;
+    SByteStringList*    pPrjDepList;
+    BOOL                bHardDependencies;
+    BOOL                bSorted;
 
 public:
-                    Prj();
-                    Prj( ByteString aName );
-                    ~Prj();
-    void			SetPreFix( ByteString aPre ){aProjectPrefix = aPre;}
-    ByteString			GetPreFix(){return aProjectPrefix;}
-    ByteString			GetProjectName()
+                        Prj();
+                        Prj( ByteString aName );
+                        ~Prj();
+    void                SetPreFix( ByteString aPre ){aProjectPrefix = aPre;}
+    ByteString          GetPreFix(){return aProjectPrefix;}
+    ByteString          GetProjectName()
                             {return aProjectName;}
-    void			SetProjectName(ByteString aName)
+    void                SetProjectName(ByteString aName)
                             {aProjectName = aName;}
-    BOOL			InsertDirectory( ByteString aDirName , USHORT aWhat,
+    BOOL                InsertDirectory( ByteString aDirName , USHORT aWhat,
                                     USHORT aWhatOS, ByteString aLogFileName,
                                     const ByteString &rClientRestriction );
     CommandData*	RemoveDirectory( ByteString aLogFileName );
@@ -216,10 +219,56 @@ public:
     inline CommandData*	GetData( ByteString aLogFileName )
                             { return GetDirectoryData( aLogFileName ); };
 
-    SByteStringList* 	GetDependencies( BOOL bExpanded = TRUE );
-    void			AddDependencies( ByteString aStr );
-    void			HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; }
-    BOOL			HasHardDependencies() { return bHardDependencies; }
+    SByteStringList*    GetDependencies( BOOL bExpanded = TRUE );
+    void                AddDependencies( ByteString aStr );
+    void                HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; }
+    BOOL                HasHardDependencies() { return bHardDependencies; }
+
+    size_t              Count() const { return maList.size(); }
+
+    CommandData*        GetObject( size_t i ) { return ( i < maList.size() ) ? maList[ i ] : NULL; }
+
+    void                Insert( CommandData* item, size_t i )
+                        {
+                            if ( i < maList.size() )
+                            {
+                                PrjList::iterator it = maList.begin();
+                                ::std::advance( it, i );
+                                maList.insert( it, item );
+                                maCurrent = i;
+                            }
+                            else
+                            {
+                                maCurrent = maList.size();
+                                maList.push_back( item );
+                            }
+                        }
+
+    CommandData*        First()
+                        {
+                            maCurrent = 0;
+                            return maList.empty() ? NULL : maList[ 0 ];
+                        }
+
+    CommandData*        Next()
+                        {
+                            if ( maCurrent+1 >= maList.size() ) return NULL;
+                            maCurrent++;
+                            return maList[ maCurrent ];
+                        }
+
+    CommandData*        Remove( CommandData* item )
+                        {
+                            for ( PrjList::iterator it = maList.begin(); it < maList.end(); ++it  )
+                            {
+                                if ( *it == item )
+                                {
+                                    maList.erase( it );
+                                    return item;
+                                }
+                            }
+                            return NULL;
+                        }
 };
 
 /*********************************************************************
@@ -230,10 +279,9 @@ public:
 *
 *********************************************************************/
 
-DECL_DEST_LIST ( StarList_tmp, StarList, Prj* )
 DECLARE_LIST ( SolarFileList, String* )
 
-class StarFile 
+class StarFile
 {
 private:
     String aFileName;
@@ -258,9 +306,14 @@ DECLARE_LIST( StarFileList, StarFile * )
 #define STAR_MODE_RECURSIVE_PARSE		0x0001
 #define STAR_MODE_MULTIPLE_PARSE 		0x0002
 
-class Star : public StarList
+typedef ::std::vector< Prj* > StarList;
+
+class Star
 {
 private:
+    StarList        maStarList;
+    size_t          maCurrent;
+
     ByteString		aStarName;
 
     static Link aDBNotFoundHdl;
@@ -303,6 +356,54 @@ public:
     BOOL			NeedsUpdate();
 
     USHORT			GetMode() { return nStarMode; }
+
+    size_t          Count() const { return maStarList.size(); }
+
+    Prj*            GetObject( size_t i )
+                        { return ( i < maStarList.size() ) ? maStarList[ i ] : NULL; }
+
+    void            Insert( Prj* item, size_t i )
+                    {
+                        if ( i < maStarList.size() )
+                        {
+                            StarList::iterator it = maStarList.begin();
+                            ::std::advance( it, i );
+                            maStarList.insert( it, item );
+                            maCurrent = i;
+                        }
+                        else
+                        {
+                            maCurrent = maStarList.size();
+                            maStarList.push_back( item );
+                        }
+                    }
+
+    Prj*            First()
+                    {
+                        maCurrent = 0;
+                        return maStarList.empty() ? NULL : maStarList[ 0 ];
+                    }
+
+    Prj*            Next()
+                    {
+                        if ( maCurrent+1 >= maStarList.size() ) return NULL;
+                        maCurrent++;
+                        return maStarList[ maCurrent ];
+                    }
+
+    Prj*            Remove( Prj* item )
+                    {
+                        for ( StarList::iterator it = maStarList.begin(); it < maStarList.end(); ++it  )
+                        {
+                            if ( *it == item )
+                            {
+                                maStarList.erase( it );
+                                return item;
+                            }
+                        }
+                        return NULL;
+                    }
+
 };
 
 class StarWriter : public Star
@@ -322,7 +423,7 @@ public:
     Prj*			RemoveProject ( ByteString aProjectName );
 
     USHORT			Read( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE  );
-       USHORT		   	Read( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE );
+    USHORT		   	Read( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE );
     USHORT			Write( String aFileName );
     USHORT			WriteMultiple( String rSourceRoot );
 
diff --git a/tools/prj/d.lst b/tools/prj/d.lst
index 4a70502..1b145ec 100644
--- a/tools/prj/d.lst
+++ b/tools/prj/d.lst
@@ -19,7 +19,6 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp
 
 ..\inc\bootstrp\command.hxx %_DEST%\inc%_EXT%\bootstrp\command.hxx
 ..\inc\bootstrp\inimgr.hxx %_DEST%\inc%_EXT%\bootstrp\inimgr.hxx
-..\inc\bootstrp\listmacr.hxx %_DEST%\inc%_EXT%\bootstrp\listmacr.hxx
 ..\inc\bootstrp\mkcreate.hxx %_DEST%\inc%_EXT%\bootstrp\mkcreate.hxx
 ..\inc\bootstrp\prj.hxx %_DEST%\inc%_EXT%\bootstrp\prj.hxx
 ..\inc\bootstrp\sstring.hxx %_DEST%\inc%_EXT%\bootstrp\sstring.hxx


More information about the Libreoffice-commits mailing list