diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bootstrp/prj.cxx | 23 | ||||
-rw-r--r-- | tools/inc/bootstrp/listmacr.hxx | 53 | ||||
-rw-r--r-- | tools/inc/bootstrp/prj.hxx | 137 | ||||
-rw-r--r-- | tools/prj/d.lst | 1 |
4 files changed, 133 insertions, 81 deletions
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index 8dfd3c421aff..0119e4a5fdec 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -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 @@ -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(); } /*****************************************************************************/ @@ -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 ; } @@ -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 ) diff --git a/tools/inc/bootstrp/listmacr.hxx b/tools/inc/bootstrp/listmacr.hxx deleted file mode 100644 index 6cee0b5ad3ed..000000000000 --- 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 e45fd11b0495..9afe3d70d8a2 100644 --- a/tools/inc/bootstrp/prj.hxx +++ b/tools/inc/bootstrp/prj.hxx @@ -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; + BOOL bHardDependencies; + BOOL bSorted; public: - Prj(); - Prj( ByteString aName ); - ~Prj(); - void SetPreFix( ByteString aPre ){aProjectPrefix = aPre;} + 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 ); @@ -217,9 +220,55 @@ public: { return GetDirectoryData( aLogFileName ); }; SByteStringList* GetDependencies( BOOL bExpanded = TRUE ); - void AddDependencies( ByteString aStr ); - void HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; } - BOOL HasHardDependencies() { return bHardDependencies; } + 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,7 +279,6 @@ public: * *********************************************************************/ -DECL_DEST_LIST ( StarList_tmp, StarList, Prj* ) DECLARE_LIST ( SolarFileList, String* ) class StarFile @@ -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 4a705025a89e..1b145ec860b0 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 |