From 0e6633d40e720360f357518d033307b1ab40e93a Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Fri, 8 Jan 2010 18:41:41 +0100 Subject: bserver50: #161439# add a broadcast to insert jobs into a module --- soldep/bootstrp/prj.cxx | 120 +++++++++++++++++++++++++++++++++++++++++++--- soldep/inc/soldep/prj.hxx | 14 ++++++ 2 files changed, 127 insertions(+), 7 deletions(-) (limited to 'soldep') diff --git a/soldep/bootstrp/prj.cxx b/soldep/bootstrp/prj.cxx index c26f50ae3f7c..5e93c1142673 100644 --- a/soldep/bootstrp/prj.cxx +++ b/soldep/bootstrp/prj.cxx @@ -216,6 +216,7 @@ CommandData::CommandData() nOSType = 0; nCommand = 0; pDepList = 0; + pCommandList = 0; } /*****************************************************************************/ @@ -234,6 +235,18 @@ CommandData::~CommandData() pDepList = NULL; } + if ( pCommandList ) + { + ByteString *pString = pCommandList->First(); + while ( pString ) + { + delete pString; + pString = pCommandList->Next(); + } + delete pCommandList; + + pCommandList = NULL; + } } /*****************************************************************************/ @@ -295,6 +308,15 @@ ByteString CommandData::GetCommandTypeString() return aRetStr; } +/*****************************************************************************/ +void CommandData::AddCommand(ByteString* pCommand) +/*****************************************************************************/ +{ + if (!pCommandList) + pCommandList = new SByteStringList(); + pCommandList->Insert(pCommand, LIST_APPEND); +} + /*****************************************************************************/ CommandData& CommandData::operator>> ( SvStream& rStream ) /*****************************************************************************/ @@ -325,6 +347,14 @@ CommandData& CommandData::operator>> ( SvStream& rStream ) else rStream << sal_False; + if (pCommandList) + { + rStream << sal_True; + *pCommandList >> rStream; + } + else + rStream << sal_False; + return *this; } @@ -361,7 +391,26 @@ CommandData& CommandData::operator<< ( SvStream& rStream ) *pDepList << rStream; } else + { + if (pDepList) DELETEZ (pDepList); + } + + BOOL bCommandList; + rStream >> bCommandList; + if (pCommandList) + pCommandList->CleanUp(); + if (bCommandList) + { + if (!pCommandList) + pCommandList = new SByteStringList(); + *pCommandList << rStream; + } + else + { + if (pCommandList) + DELETEZ (pCommandList); + } return *this; } @@ -751,11 +800,12 @@ CommandData* Prj::GetDirectoryList ( USHORT nWhatOS, USHORT nCommand ) CommandData* Prj::GetDirectoryData( ByteString aLogFileName ) /*****************************************************************************/ { + PrjList* pPrjList = GetCommandDataList (); CommandData *pData = NULL; - ULONG nCount_l = Count(); + ULONG nCount_l = pPrjList->Count(); for ( ULONG i=0; iGetObject(i); if ( pData->GetLogFile() == aLogFileName ) return pData; } @@ -775,7 +825,9 @@ Prj::Prj() : bHardDependencies( FALSE ), bFixedDependencies( FALSE ), bVisited( FALSE ), - bIsAvailable( TRUE ) + bIsAvailable( TRUE ), + pTempCommandDataList (0), + bTempCommandDataListPermanent (FALSE) /*****************************************************************************/ { } @@ -790,7 +842,9 @@ Prj::Prj( ByteString aName ) : bHardDependencies( FALSE ), bFixedDependencies( FALSE ), bVisited( FALSE ), - bIsAvailable( TRUE ) + bIsAvailable( TRUE ), + pTempCommandDataList (0), + bTempCommandDataListPermanent (FALSE) /*****************************************************************************/ { } @@ -954,7 +1008,8 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat, pData->SetLogFile( aLogFileName ); pData->SetClientRestriction( rClientRestriction ); - Insert( pData ); + PrjList* pPrjList = GetCommandDataList (); + pPrjList->Insert( pData ); return FALSE; } @@ -966,14 +1021,15 @@ BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat, CommandData* Prj::RemoveDirectory ( ByteString aLogFileName ) /*****************************************************************************/ { - ULONG nCount_l = Count(); + PrjList* pPrjList = GetCommandDataList (); + ULONG nCount_l = pPrjList->Count(); CommandData* pData; CommandData* pDataFound = NULL; SByteStringList* pDataDeps; for ( USHORT i = 0; i < nCount_l; i++ ) { - pData = GetObject( i ); + pData = pPrjList->GetObject( i ); if ( pData->GetLogFile() == aLogFileName ) pDataFound = pData; else @@ -1032,6 +1088,56 @@ void Prj::ExtractDependencies() } } +/*****************************************************************************/ +PrjList* Prj::GetCommandDataList () +/*****************************************************************************/ +{ + if (pTempCommandDataList) + return pTempCommandDataList; + else + return (PrjList*)this; +} + +/*****************************************************************************/ +void Prj::RemoveTempCommandDataList() +/*****************************************************************************/ +{ + if (pTempCommandDataList) + { + delete pTempCommandDataList; // this list remove the elements by itself + pTempCommandDataList = NULL; + } +} + +/*****************************************************************************/ +void Prj::GenerateTempCommandDataList() +/*****************************************************************************/ +{ + if (pTempCommandDataList) + RemoveTempCommandDataList(); + pTempCommandDataList = new PrjList(); + CommandData* pCommandData = First(); + while (pCommandData) { + SvMemoryStream* pStream = new SvMemoryStream(); + *pCommandData >> *pStream; + CommandData* pNewCommandData = new CommandData(); + pStream->Seek( STREAM_SEEK_TO_BEGIN ); + *pNewCommandData << *pStream; + pTempCommandDataList->Insert(pNewCommandData, LIST_APPEND); + delete pStream; + pCommandData = Next(); + } +} + +/*****************************************************************************/ +void Prj::GenerateEmptyTempCommandDataList() +/*****************************************************************************/ +{ + if (pTempCommandDataList) + RemoveTempCommandDataList(); + pTempCommandDataList = new PrjList(); +} + /*****************************************************************************/ Prj& Prj::operator>> ( SvStream& rStream ) /*****************************************************************************/ diff --git a/soldep/inc/soldep/prj.hxx b/soldep/inc/soldep/prj.hxx index 858afac2d56a..bd94a3e87f9a 100644 --- a/soldep/inc/soldep/prj.hxx +++ b/soldep/inc/soldep/prj.hxx @@ -87,6 +87,7 @@ class CommandData ByteString aComment; ByteString sClientRestriction; SByteStringList *pDepList; + SByteStringList *pCommandList; USHORT nOSType; USHORT nCommand; @@ -131,6 +132,9 @@ public: void AddDepth(){nDepth++;} ULONG GetDepth(){return nDepth;} + void AddCommand(ByteString* pCommand); + SByteStringList* GetCommandList() {return pCommandList;} + CommandData& operator<< ( SvStream& rStream ); CommandData& operator>> ( SvStream& rStream ); }; @@ -284,6 +288,8 @@ private: BOOL bIsAvailable; SByteStringList* RemoveStringList(SByteStringList* pStringList ); SDepInfoList* RemoveDepInfoList(SDepInfoList* pInfoList ); + PrjList* pTempCommandDataList; + BOOL bTempCommandDataListPermanent; public: Prj(); Prj( ByteString aName ); @@ -318,6 +324,14 @@ public: void ExtractDependencies(); + PrjList* GetCommandDataList (); + void RemoveTempCommandDataList(); + void GenerateTempCommandDataList(); + void GenerateEmptyTempCommandDataList(); + BOOL HasTempCommandDataList() {return pTempCommandDataList != NULL;} + void SetTempCommandDataListPermanent (BOOL bVar = TRUE) {bTempCommandDataListPermanent = bVar;} + BOOL IsTempCommandDataListPermanent() {return bTempCommandDataListPermanent;} + Prj& operator<< ( SvStream& rStream ); Prj& operator>> ( SvStream& rStream ); }; -- cgit