Ignore:
Timestamp:
Jun 12, 2007, 6:42:53 PM (17 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/FileClasses/_DataTypes.pas

    r207 r212  
    1414      FDataLength: Integer;
    1515      FParentFile: TObject;
     16      FParentField: TDataField;
    1617      FChanged: Boolean;
    1718      function GetValueAsString: String; virtual; abstract;
    1819    public
    19       constructor Create(ParentFile: TObject; Offset: Integer;
    20           Name, Description: String; ExtraArgs: Pointer); virtual;
     20      constructor Create(ParentFile: TObject; ParentField: TDataField;
     21          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); virtual;
    2122
    2223      procedure Update(Offset, Length: Integer); virtual; abstract;
     
    4041    public
    4142      // ExtraArgs: keine
    42       constructor Create(ParentFile: TObject; Offset: Integer;
    43           Name, Description: String; ExtraArgs: Pointer); override;
     43      constructor Create(ParentFile: TObject; ParentField: TDataField;
     44          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    4445      procedure Update(Offset, Length: Integer); override;
    4546      property FieldByOffset[Offset: Integer]: TDataField read GetFieldByOffset;
     
    4748      property FieldCount: Integer read GetFieldCount;
    4849
    49       procedure AddField(fieldtype: TFieldType; Offset: Integer;
    50           Name, Description: String; ExtraArgs: Pointer);
     50      function AddField(fieldtype: TFieldType; Offset: Integer;
     51          Name, Description: String; ExtraArgs: Pointer): TDataField;
    5152  end;
    5253
     
    5859    public
    5960      // ExtraArgs: Pointer auf Integer: Bytes of TInt
    60       constructor Create(ParentFile: TObject; Offset: Integer;
    61           Name, Description: String; ExtraArgs: Pointer); override;
     61      constructor Create(ParentFile: TObject; ParentField: TDataField;
     62          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    6263      procedure Update(Offset, Length: Integer); override;
    6364  end;
     
    7172    public
    7273      // ExtraArgs: Pointer auf TStringList
    73       constructor Create(ParentFile: TObject; Offset: Integer;
    74           Name, Description: String; ExtraArgs: Pointer); override;
     74      constructor Create(ParentFile: TObject; ParentField: TDataField;
     75          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    7576      procedure Update(Offset, Length: Integer); override;
    7677  end;
     
    8384    public
    8485      // ExtraArgs: keine
    85       constructor Create(ParentFile: TObject; Offset: Integer;
    86           Name, Description: String; ExtraArgs: Pointer); override;
     86      constructor Create(ParentFile: TObject; ParentField: TDataField;
     87          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    8788      procedure Update(Offset, Length: Integer); override;
    8889  end;
     
    9596    public
    9697      // ExtraArgs: keine
    97       constructor Create(ParentFile: TObject; Offset: Integer;
    98           Name, Description: String; ExtraArgs: Pointer); override;
     98      constructor Create(ParentFile: TObject; ParentField: TDataField;
     99          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    99100      procedure Update(Offset, Length: Integer); override;
    100101  end;
     
    108109    public
    109110      // ExtraArgs: Pointer auf String: Possible Exts
    110       constructor Create(ParentFile: TObject; Offset: Integer;
    111           Name, Description: String; ExtraArgs: Pointer); override;
     111      constructor Create(ParentFile: TObject; ParentField: TDataField;
     112          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    112113      procedure Update(Offset, Length: Integer); override;
    113114  end;
     
    120121    public
    121122      // ExtraArgs: Pointer auf Integer: Length
    122       constructor Create(ParentFile: TObject; Offset: Integer;
    123           Name, Description: String; ExtraArgs: Pointer); override;
     123      constructor Create(ParentFile: TObject; ParentField: TDataField;
     124          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    124125      procedure Update(Offset, Length: Integer); override;
    125126  end;
     
    134135    public
    135136      // ExtraArgs: Pointer auf 2 Integer: Length+Count (packed record...)
    136       constructor Create(ParentFile: TObject; Offset: Integer;
    137           Name, Description: String; ExtraArgs: Pointer); override;
     137      constructor Create(ParentFile: TObject; ParentField: TDataField;
     138          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    138139      procedure Update(Offset, Length: Integer); override;
    139140      property FieldByOffset[Offset: Integer]: TDataField read GetFieldByOffset;
     
    141142      property FieldCount: Integer read GetFieldCount;
    142143
    143       procedure AddField(fieldtype: TFieldType; Offset: Integer;
    144           Name, Description: String; ExtraArgs: Pointer);
     144      function AddField(fieldtype: TFieldType; Offset: Integer;
     145          Name, Description: String; ExtraArgs: Pointer): TDataField;
    145146  end;
    146147
     
    152153    public
    153154      // ExtraArgs: keine
    154       constructor Create(ParentFile: TObject; Offset: Integer;
    155           Name, Description: String; ExtraArgs: Pointer); override;
     155      constructor Create(ParentFile: TObject; ParentField: TDataField;
     156          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    156157      procedure Update(Offset, Length: Integer); override;
    157158  end;
     
    163164    public
    164165      // ExtraArgs: Pointer auf Integer: Length
    165       constructor Create(ParentFile: TObject; Offset: Integer;
    166           Name, Description: String; ExtraArgs: Pointer); override;
     166      constructor Create(ParentFile: TObject; ParentField: TDataField;
     167          Offset: Integer; Name, Description: String; ExtraArgs: Pointer); override;
    167168      procedure Update(Offset, Length: Integer); override;
    168169  end;
     
    181182{ TDataType }
    182183
    183 constructor TDataField.Create(ParentFile: TObject; Offset: Integer;
    184     Name, Description: String; ExtraArgs: Pointer);
     184constructor TDataField.Create(ParentFile: TObject; ParentField: TDataField;
     185    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
    185186begin
    186187  FOffset := Offset;
    187188  FName := Name;
    188189  FDescription := Description;
    189   FParentFile := ParentFile;
     190  FParentFile := ParentFile;
     191  FParentField := ParentField;
    190192end;
    191193
     
    194196{ TString }
    195197
    196 constructor TString.Create(ParentFile: TObject; Offset: Integer;
    197     Name, Description: String; ExtraArgs: Pointer);
     198constructor TString.Create(ParentFile: TObject; ParentField: TDataField;
     199    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
    198200var
    199201  fstream: TMemoryStream;
    200202  i: Integer;
    201203begin
    202   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     204  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    203205  FDataLength := Integer(ExtraArgs^);
    204206  fstream := TFile(ParentFile).FileStream;
     
    228230{ TInt }
    229231
    230 constructor TInt.Create(ParentFile: TObject; Offset: Integer;
    231     Name, Description: String; ExtraArgs: Pointer);
    232 var
    233   fstream: TMemoryStream;
    234 begin
    235   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     232constructor TInt.Create(ParentFile: TObject; ParentField: TDataField;
     233    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     234var
     235  fstream: TMemoryStream;
     236begin
     237  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    236238  FDataLength := Integer(ExtraArgs^);
    237239  FInt := 0;
     
    255257{ TArray }
    256258
    257 procedure TArray.AddField(fieldtype: TFieldType; Offset: Integer;
    258           Name, Description: String; ExtraArgs: Pointer);
    259 begin
    260   Exit;
    261 end;
    262 
    263 constructor TArray.Create(ParentFile: TObject; Offset: Integer;
    264     Name, Description: String; ExtraArgs: Pointer);
    265 begin
    266   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     259function TArray.AddField(fieldtype: TFieldType; Offset: Integer;
     260    Name, Description: String; ExtraArgs: Pointer): TDataField;
     261begin
     262  Exit;
     263end;
     264
     265constructor TArray.Create(ParentFile: TObject; ParentField: TDataField;
     266    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     267begin
     268  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    267269end;
    268270
     
    305307{ TBlock }
    306308
    307 procedure TBlock.AddField(fieldtype: TFieldType; Offset: Integer; Name,
    308   Description: String; ExtraArgs: Pointer);
     309function TBlock.AddField(fieldtype: TFieldType; Offset: Integer; Name,
     310    Description: String; ExtraArgs: Pointer): TDataField;
    309311var
    310312  i: Integer;
     
    323325  SetLength(FDataFields, Length(FDataFields) + 1);
    324326  FDataFields[High(FDataFields)] := TFieldType(fieldtype).Create(
    325       FParentFile, Offset, Name, Description, ExtraArgs);
    326 end;
    327 
    328 constructor TBlock.Create(ParentFile: TObject; Offset: Integer;
    329     Name, Description: String; ExtraArgs: Pointer);
    330 begin
    331   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     327      FParentFile, Self, Offset, Name, Description, ExtraArgs);
     328  Result := FDataFields[High(FDataFields)];
     329end;
     330
     331constructor TBlock.Create(ParentFile: TObject; ParentField: TDataField;
     332    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     333begin
     334  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    332335end;
    333336
     
    356359{ TLevelID }
    357360
    358 constructor TLevelID.Create(ParentFile: TObject; Offset: Integer;
    359     Name, Description: String; ExtraArgs: Pointer);
    360 var
    361   fstream: TMemoryStream;
    362 begin
    363   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     361constructor TLevelID.Create(ParentFile: TObject; ParentField: TDataField;
     362    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     363var
     364  fstream: TMemoryStream;
     365begin
     366  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    364367  FDataLength := 4;
    365368  fstream := TFile(ParentFile).FileStream;
     
    383386{ TFileID }
    384387
    385 constructor TFileID.Create(ParentFile: TObject; Offset: Integer;
    386     Name, Description: String; ExtraArgs: Pointer);
    387 var
    388   fstream: TMemoryStream;
    389 begin
    390   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     388constructor TFileID.Create(ParentFile: TObject; ParentField: TDataField;
     389    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     390var
     391  fstream: TMemoryStream;
     392begin
     393  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    391394  FDataLength := 4;
    392395  fstream := TFile(ParentFile).FileStream;
     
    413416{ TLinkByID }
    414417
    415 constructor TLinkByID.Create(ParentFile: TObject; Offset: Integer; Name,
    416   Description: String; ExtraArgs: Pointer);
    417 var
    418   fstream: TMemoryStream;
    419 begin
    420   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     418constructor TLinkByID.Create(ParentFile: TObject; ParentField: TDataField;
     419    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     420var
     421  fstream: TMemoryStream;
     422begin
     423  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    421424  FDataLength := 4;
    422425  FPosExts := String(ExtraArgs^);
     
    444447{ TRawLink }
    445448
    446 constructor TRawLink.Create(ParentFile: TObject; Offset: Integer; Name,
    447   Description: String; ExtraArgs: Pointer);
    448 var
    449   fstream: TMemoryStream;
    450 begin
    451   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     449constructor TRawLink.Create(ParentFile: TObject; ParentField: TDataField;
     450    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     451var
     452  fstream: TMemoryStream;
     453begin
     454  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    452455  FDataLength := 4;
    453456  fstream := TFile(ParentFile).FileStream;
     
    470473{ TUnused }
    471474
    472 constructor TUnused.Create(ParentFile: TObject; Offset: Integer; Name,
    473   Description: String; ExtraArgs: Pointer);
    474 begin
    475   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     475constructor TUnused.Create(ParentFile: TObject; ParentField: TDataField;
     476    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     477begin
     478  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    476479  FDataLength := Integer(ExtraArgs^);
    477480end;
     
    491494{ TBitSet }
    492495
    493 constructor TBitSet.Create(ParentFile: TObject; Offset: Integer; Name,
    494   Description: String; ExtraArgs: Pointer);
    495 var
    496   fstream: TMemoryStream;
    497 begin
    498   inherited Create(ParentFile, Offset, Name, Description, ExtraArgs);
     496constructor TBitSet.Create(ParentFile: TObject; ParentField: TDataField;
     497    Offset: Integer; Name, Description: String; ExtraArgs: Pointer);
     498var
     499  fstream: TMemoryStream;
     500begin
     501  inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs);
    499502  FNames := TStringList.Create;
    500503  FNames.AddStrings(TStringList(ExtraArgs^));
Note: See TracChangeset for help on using the changeset viewer.