Kaydet (Commit) 5b039728 authored tarafından Joseph Powers's avatar Joseph Powers

Remove DECL_DEST_LIST()

There where only 2 of them
üst dbde7b19
...@@ -141,7 +141,6 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) ...@@ -141,7 +141,6 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments )
aTmpStr = aTmpStr.EraseLeadingChars(); aTmpStr = aTmpStr.EraseLeadingChars();
aTmpStr = aTmpStr.EraseTrailingChars(); aTmpStr = aTmpStr.EraseTrailingChars();
// while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (USHORT)-1 );
int nLength = aTmpStr.Len(); int nLength = aTmpStr.Len();
ByteString aEraseString; ByteString aEraseString;
BOOL bFirstTab = TRUE; BOOL bFirstTab = TRUE;
...@@ -311,6 +310,10 @@ Prj::~Prj() ...@@ -311,6 +310,10 @@ Prj::~Prj()
{ {
if ( pPrjDepList ) if ( pPrjDepList )
{ {
for ( size_t i = 0, n = maList.size(); i < n; ++i )
delete maList[ i ];
maList.clear();
ByteString *pString = pPrjDepList->First(); ByteString *pString = pPrjDepList->First();
while ( pString ) while ( pString )
{ {
...@@ -379,7 +382,7 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat, ...@@ -379,7 +382,7 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat,
pData->SetLogFile( aLogFileName ); pData->SetLogFile( aLogFileName );
pData->SetClientRestriction( rClientRestriction ); pData->SetClientRestriction( rClientRestriction );
Insert( pData ); maList.push_back( pData );
return FALSE; return FALSE;
} }
...@@ -391,14 +394,14 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat, ...@@ -391,14 +394,14 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat,
CommandData* Prj::RemoveDirectory ( ByteString aLogFileName ) CommandData* Prj::RemoveDirectory ( ByteString aLogFileName )
/*****************************************************************************/ /*****************************************************************************/
{ {
ULONG nCountMember = Count(); size_t nCountMember = maList.size();
CommandData* pData; CommandData* pData;
CommandData* pDataFound = NULL; CommandData* pDataFound = NULL;
SByteStringList* pDataDeps; 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 ) if ( pData->GetLogFile() == aLogFileName )
pDataFound = pData; pDataFound = pData;
else else
...@@ -564,6 +567,9 @@ Star::Star( GenericInformationList *pStandLst, ByteString &rVersion, ...@@ -564,6 +567,9 @@ Star::Star( GenericInformationList *pStandLst, ByteString &rVersion,
Star::~Star() 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 ) ...@@ -613,7 +619,7 @@ void Star::Read( String &rFileName )
void Star::Read( SolarFileList *pSolarFiles ) void Star::Read( SolarFileList *pSolarFiles )
/*****************************************************************************/ /*****************************************************************************/
{ {
while( pSolarFiles->Count()) { while( pSolarFiles->Count() ) {
ByteString aString; ByteString aString;
StarFile *pFile = new StarFile( *pSolarFiles->GetObject(( ULONG ) 0 )); StarFile *pFile = new StarFile( *pSolarFiles->GetObject(( ULONG ) 0 ));
...@@ -938,7 +944,6 @@ Prj* Star::GetPrj ( ByteString aProjectName ) ...@@ -938,7 +944,6 @@ Prj* Star::GetPrj ( ByteString aProjectName )
if ( pPrj->GetProjectName().EqualsIgnoreCaseAscii(aProjectName) ) if ( pPrj->GetProjectName().EqualsIgnoreCaseAscii(aProjectName) )
return pPrj; return pPrj;
} }
// return (Prj*)NULL;
return 0L ; return 0L ;
} }
...@@ -1529,12 +1534,12 @@ BOOL StarWriter::InsertProject ( Prj* ) ...@@ -1529,12 +1534,12 @@ BOOL StarWriter::InsertProject ( Prj* )
Prj* StarWriter::RemoveProject ( ByteString aProjectName ) Prj* StarWriter::RemoveProject ( ByteString aProjectName )
/*****************************************************************************/ /*****************************************************************************/
{ {
ULONG nCountMember = Count(); size_t nCountMember = Count();
Prj* pPrj; Prj* pPrj;
Prj* pPrjFound = NULL; Prj* pPrjFound = NULL;
SByteStringList* pPrjDeps; SByteStringList* pPrjDeps;
for ( USHORT i = 0; i < nCountMember; i++ ) for ( size_t i = 0; i < nCountMember; i++ )
{ {
pPrj = GetObject( i ); pPrj = GetObject( i );
if ( pPrj->GetProjectName() == aProjectName ) if ( pPrj->GetProjectName() == aProjectName )
......
/* -*- 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: */
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include <tools/fsys.hxx> #include <tools/fsys.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include "bootstrp/listmacr.hxx"
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <vector>
#define OS_NONE 0x0000 #define OS_NONE 0x0000
#define OS_WIN16 0x0001 #define OS_WIN16 0x0001
...@@ -180,34 +180,37 @@ public: ...@@ -180,34 +180,37 @@ public:
* *
*********************************************************************/ *********************************************************************/
DECL_DEST_LIST ( PrjList_tmp, PrjList, CommandData * ) typedef ::std::vector< CommandData* > PrjList;
class Star; class Star;
class Prj : public PrjList class Prj
{ {
friend class Star; friend class Star;
private: private:
BOOL bVisited; PrjList maList;
size_t maCurrent;
BOOL bVisited;
ByteString aPrjPath; ByteString aPrjPath;
ByteString aProjectName; ByteString aProjectName;
ByteString aProjectPrefix; // max. 2-buchstabige Abk. ByteString aProjectPrefix; // max. 2-buchstabige Abk.
SByteStringList* pPrjInitialDepList; SByteStringList* pPrjInitialDepList;
SByteStringList* pPrjDepList; SByteStringList* pPrjDepList;
BOOL bHardDependencies; BOOL bHardDependencies;
BOOL bSorted; BOOL bSorted;
public: public:
Prj(); Prj();
Prj( ByteString aName ); Prj( ByteString aName );
~Prj(); ~Prj();
void SetPreFix( ByteString aPre ){aProjectPrefix = aPre;} void SetPreFix( ByteString aPre ){aProjectPrefix = aPre;}
ByteString GetPreFix(){return aProjectPrefix;} ByteString GetPreFix(){return aProjectPrefix;}
ByteString GetProjectName() ByteString GetProjectName()
{return aProjectName;} {return aProjectName;}
void SetProjectName(ByteString aName) void SetProjectName(ByteString aName)
{aProjectName = aName;} {aProjectName = aName;}
BOOL InsertDirectory( ByteString aDirName , USHORT aWhat, BOOL InsertDirectory( ByteString aDirName , USHORT aWhat,
USHORT aWhatOS, ByteString aLogFileName, USHORT aWhatOS, ByteString aLogFileName,
const ByteString &rClientRestriction ); const ByteString &rClientRestriction );
CommandData* RemoveDirectory( ByteString aLogFileName ); CommandData* RemoveDirectory( ByteString aLogFileName );
...@@ -217,9 +220,55 @@ public: ...@@ -217,9 +220,55 @@ public:
{ return GetDirectoryData( aLogFileName ); }; { return GetDirectoryData( aLogFileName ); };
SByteStringList* GetDependencies( BOOL bExpanded = TRUE ); SByteStringList* GetDependencies( BOOL bExpanded = TRUE );
void AddDependencies( ByteString aStr ); void AddDependencies( ByteString aStr );
void HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; } void HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; }
BOOL HasHardDependencies() { return bHardDependencies; } 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: ...@@ -230,7 +279,6 @@ public:
* *
*********************************************************************/ *********************************************************************/
DECL_DEST_LIST ( StarList_tmp, StarList, Prj* )
DECLARE_LIST ( SolarFileList, String* ) DECLARE_LIST ( SolarFileList, String* )
class StarFile class StarFile
...@@ -258,9 +306,14 @@ DECLARE_LIST( StarFileList, StarFile * ) ...@@ -258,9 +306,14 @@ DECLARE_LIST( StarFileList, StarFile * )
#define STAR_MODE_RECURSIVE_PARSE 0x0001 #define STAR_MODE_RECURSIVE_PARSE 0x0001
#define STAR_MODE_MULTIPLE_PARSE 0x0002 #define STAR_MODE_MULTIPLE_PARSE 0x0002
class Star : public StarList typedef ::std::vector< Prj* > StarList;
class Star
{ {
private: private:
StarList maStarList;
size_t maCurrent;
ByteString aStarName; ByteString aStarName;
static Link aDBNotFoundHdl; static Link aDBNotFoundHdl;
...@@ -303,6 +356,54 @@ public: ...@@ -303,6 +356,54 @@ public:
BOOL NeedsUpdate(); BOOL NeedsUpdate();
USHORT GetMode() { return nStarMode; } 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 class StarWriter : public Star
...@@ -322,7 +423,7 @@ public: ...@@ -322,7 +423,7 @@ public:
Prj* RemoveProject ( ByteString aProjectName ); Prj* RemoveProject ( ByteString aProjectName );
USHORT Read( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); 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 Write( String aFileName );
USHORT WriteMultiple( String rSourceRoot ); USHORT WriteMultiple( String rSourceRoot );
......
...@@ -19,7 +19,6 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ...@@ -19,7 +19,6 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp
..\inc\bootstrp\command.hxx %_DEST%\inc%_EXT%\bootstrp\command.hxx ..\inc\bootstrp\command.hxx %_DEST%\inc%_EXT%\bootstrp\command.hxx
..\inc\bootstrp\inimgr.hxx %_DEST%\inc%_EXT%\bootstrp\inimgr.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\mkcreate.hxx %_DEST%\inc%_EXT%\bootstrp\mkcreate.hxx
..\inc\bootstrp\prj.hxx %_DEST%\inc%_EXT%\bootstrp\prj.hxx ..\inc\bootstrp\prj.hxx %_DEST%\inc%_EXT%\bootstrp\prj.hxx
..\inc\bootstrp\sstring.hxx %_DEST%\inc%_EXT%\bootstrp\sstring.hxx ..\inc\bootstrp\sstring.hxx %_DEST%\inc%_EXT%\bootstrp\sstring.hxx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment