//TH-Header //***************************************************************************************** // Copyright (c) 2001 Udo Haemel // All rights reserved. // If you want to use this source in your applications conatct: // // $FileName : cIndexList.pkg // $ProjectName : The Hammer // $Author : Udo Haemel // $Created : 26.06.2001 20:15 // // Contents: // Holds a list of Indexes for a given DF-Table //***************************************************************************************** //TH-RevisionStart // 22.06.2001 20:21 Added a Interface Array Object into Mk SERVER // cIndexList which contains simply the // Index string which I would like to // see shown in the Hammer. // 26.06.2001 20:30 Cild-Classes of "cFileOperations" Uh // now react with new default behaviour. // When the data could not be retrieved, // they reset to zero (empty props and // empty data-structures. // 26.06.2001 20:30 Creation of empty objects without Uh // any paramaters is now possible. // Objects likes this will act with // default behaviour (see above) //TH-RevisionEnd Use cFileOperations.pkg Use cIndex.pkg Class cIndexList Is A cFileOperations // Uh 26.06.2001 Allow creation of objects without parameters Procedure Construct_Object Integer iFile Forward Send Construct_Object Integer iFileSend Property Integer pFile 0 // defines file for index Property String pIndexes '' // fast way to determin if index exists Property Integer pbFillIndexString 0 // Will set to true in the Hammer. // MK for an easier acces in the Hammer, becoue the standard list in the // Hammer uses a simple array which should contain the items of the list. Object oIndexStrings Is a Array End_Object If (Num_Arguments > 0) ; Move iFile To iFileSend Send mInitObject iFileSend End_Procedure // Construct_Object // Delviers the Object ID of the oIndexStrings Function fhoIndexArray Returns Integer Function_Return (oIndexStrings(Self)) End_Function // Uh 26.06.2001 Implemented default behaviour Procedure mInitObject Integer iFile Integer iNoPrefix Integer bOpen Integer bReopen Integer iSegmentsCount Integer iIndexCount Integer iIndex Integer iIndexObj String sIndexes Integer bFillStrings Get pbFillIndexString To bFillStrings Get pOpen iFile To bOpen // check or try to open file If (bOpen=1) Begin Close iFile Get pOpen iFile To bOpen // check or try to open file Move 1 To bReOpen End If (bOpen) Begin Send Delete_Data If bFillStrings Send Delete_Data To (oIndexStrings(Self)) Get_Attribute DF_FILE_LAST_INDEX_NUMBER Of iFile To iIndexCount For iIndex From 0 To iIndexCount Get_Attribute DF_INDEX_NUMBER_SEGMENTS Of iFile iIndex To iSegmentsCount Get Integer_Value Item iIndex To iIndexObj If (iSegmentsCount) Begin Move (sIndexes + "1") To sIndexes // create new index-object if needed If (Not(iIndexObj)) Begin Object oNew$Index Is A cIndex iFile iIndex Move Self To iIndexObj End_Object Set Array_Value Item iIndex To iIndexObj End Else Begin Send mInitObject To iIndexObj iFile iIndex End End Else Begin Move (sIndexes + "0") To sIndexes If (iIndexObj) Begin Send mInitObject To iIndexObj 0 0 End End If bFillStrings If iIndexObj Begin Set value Of (oIndexStrings(Self)) Item (Item_Count(oIndexStrings(Self))) To (fsIndexString(iIndexObj,iNoPrefix)) End Loop Set pFile To iFile Set pIndexes To sIndexes Send pClose iFile bOpen // close file, if needed End Else Begin Send Delete_Data Send Delete_Data To (oIndexStrings(Self)) Set pFile To 0 Set pIndexes To "" End End_Procedure // Test, if file has the given index // Function pHasIndex Integer iIndex ; Returns Integer String sIndexes Get pIndexes To sIndexes Function_Return (Integer(Mid(sIndexes, 1, iIndex))) End_Function End_Class // cIndexList