home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 October / Chip_2002-10_cd1.bin / zkuste / delphi / kolekce / d56 / FLEXCEL.ZIP / BiffEdit / UBiffData.pas < prev    next >
Pascal/Delphi Source File  |  2002-05-12  |  1KB  |  65 lines

  1. unit UBiffData;
  2.  
  3. interface
  4. uses classes;
  5. type
  6.   TRecord= record
  7.     Id:word;
  8.     Size: int64;
  9.     IdName: string;
  10.     Data: string;
  11.     HexData: string;
  12.     Offset: int64;
  13.     Version: word; //only for Escher records
  14.   end;
  15.   PRecord=^TRecord;
  16.  
  17.   TRecordList=class(TList)
  18.   private
  19.     function GetItem(Index: Integer): PRecord;
  20.     procedure SetItem(Index: Integer; const Value: PRecord);
  21.   protected
  22.     procedure Notify(Ptr: Pointer; Action: TListNotification); override;
  23.     property Items[Index: Integer]: PRecord read GetItem write SetItem; default;
  24.  
  25. end;
  26.  
  27. procedure CopyRecord (const Source, Dest: PRecord);
  28.  
  29. implementation
  30.  
  31. { TRecordList }
  32.  
  33. function TRecordList.GetItem(Index: Integer): PRecord;
  34. begin
  35.   Result:=PRecord(inherited Items[Index]);
  36. end;
  37.  
  38. procedure TRecordList.Notify(Ptr: Pointer; Action: TListNotification);
  39. begin
  40.   if Action = lnDeleted then
  41.   begin
  42.     //The cast to PRecord is to finalize strings
  43.     Dispose(PRecord(Ptr));
  44.   end;
  45.   inherited Notify(Ptr, Action);
  46. end;
  47.  
  48. procedure TRecordList.SetItem(Index: Integer; const Value: PRecord);
  49. begin
  50.   inherited Items[Index]:= value;
  51. end;
  52.  
  53. procedure CopyRecord (const Source, Dest: PRecord);
  54. begin
  55.   Dest.Id:=Source.Id;
  56.   Dest.Size:= Source.Size;
  57.   Dest.IdName:= Source.IdName;
  58.   Dest.Data:= Source.Data;
  59.   Dest.HexData:= Source.HexData;
  60.   Dest.Offset:= Source.Offset;
  61.   Dest.Version:=Source.Version;
  62. end;
  63.  
  64. end.
  65.