source: oup/current/FileClasses/_FileTypes.pas@ 125

Last change on this file since 125 was 124, checked in by alloc, 18 years ago
File size: 1.2 KB
Line 
1unit _FileTypes;
2
3interface
4
5uses
6 TypeDefs, _DataTypes;
7
8
9type
10 TFileType = class
11 private
12 FDatLinks: TDatLinkList;
13 FDataFields: TDataFields;
14 function GetDatLink(Offset: Integer): TDatLink;
15 function GetField(Offset: Integer): TDataField;
16 public
17 property LinksByID[Offset: Integer]: TDatLink read GetDatLink;
18 property Fields[Offset: Integer]: TDataField read GetField;
19 end;
20
21
22implementation
23
24{ TFileType }
25
26function TFileType.GetDatLink(Offset: Integer): TDatLink;
27var
28 i: Integer;
29begin
30 Result.SrcOffset := -1;
31 Result.DestID := -1;
32 Result.PosDestExts := '';
33
34 if Length(FDatLinks) > 0 then
35 begin
36 for i := 0 to High(FDatLinks) do
37 if FDatLinks[i].SrcOffset = Offset then
38 break;
39 if i < Length(FDatLinks) then
40 Result := FDatLinks[i];
41 end;
42end;
43
44function TFileType.GetField(Offset: Integer): TDataField;
45var
46 i: Integer;
47begin
48 Result.Offset := -1;
49 Result.Data := nil;
50
51 if Length(FDataFields) > 0 then
52 begin
53 for i := 0 to High(FDataFields) do
54 if FDataFields[i].Offset = Offset then
55 break;
56 if i < Length(FDataFields) then
57 Result := FDataFields[i];
58 end;
59end;
60
61end.
Note: See TracBrowser for help on using the repository browser.