Ignore:
Timestamp:
Jul 18, 2007, 12:27:16 AM (17 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

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

    r240 r241  
    1010 
    1111  TDataField = class(TTreeElement)
    12       function GetChildCount: Integer; override;
    13       function GetChild(ID: Integer): TTreeElement; override;
    14       function GetCaption: String; override;
    1512    protected
    1613      FOffset: Integer;
    1714      FName:   String;
     15      FType:   String;
    1816      FDescription: String;
    1917      FDataLength: Integer;
     
    2220      FChanged: Boolean;
    2321      FExtraArgs: array of TVarRec;
     22      function GetChildCount: Integer; override;
     23      function GetChild(ID: Integer): TTreeElement; override;
     24      function GetCaption: String; override;
     25      function GetType: String; override;
    2426      function GetValueAsString: String; virtual;
    2527    public
     
    4749
    4850  TBlock = class(TContainer)
    49     private
     51    protected
    5052      FDataFields: array of TDataField;
    5153      function GetChildCount: Integer; override;
     
    6769
    6870  TInt = class(TDataField)
    69     private
     71    protected
    7072      FInt: Integer;
    7173      function GetValueAsString: String; override;
     
    8082
    8183  TFloat = class(TDataField)
    82     private
     84    protected
    8385      FFloat: Single;
    8486      function GetValueAsString: String; override;
     
    9395
    9496  TBitSet = class(TDataField)
    95     private
     97    protected
    9698      FBits: Byte;
    9799      FNames: TStringList;
     
    107109
    108110  TLevelID = class(TDataField)
    109     private
     111    protected
    110112      FLevelID: Integer;
    111113      function GetValueAsString: String; override;
     
    120122
    121123  TFileID = class(TDataField)
    122     private
     124    protected
    123125      FFileID: Integer;
    124126      function GetValueAsString: String; override;
     
    133135
    134136  TDatLink = class(TDataField)
    135     private
     137    protected
     138      FPosExts: String;
    136139      function GetTarget: TObject; virtual; abstract;
    137140    public
     141      property PosExts: String read FPosExts;
    138142      property TargetFile: TObject read GetTarget;
    139143  end;
     
    141145
    142146  TLinkByID = class(TDatLink)
     147    protected
     148      FFileID: Integer;
    143149      function GetChildCount: Integer; override;
    144150      function GetChild(ID: Integer): TTreeElement; override;
    145     private
    146       FFileID: Integer;
    147       FPosExts: String;
    148151      function GetValueAsString: String; override;
    149152      function GetTarget: TObject; override;
     
    158161
    159162  TString = class(TDataField)
    160     private
     163    protected
    161164      FString: String;
    162165      function GetValueAsString: String; override;
     
    171174
    172175  TArray = class(TContainer)
    173     private
     176    protected
    174177      FDataFields: array of TBlock;
    175178      FTemplate: TBlock;
     
    197200
    198201  TRawLink = class(TDataField)
    199     private
     202    protected
    200203      FRawAddress: Integer;
     204      FRawType:    String;
     205      FSep:        Boolean;
    201206      function GetValueAsString: String; override;
    202207    public
    203       // ExtraArgs: keine
    204       constructor Create(ParentFile: TObject; ParentBlock: TContainer;
    205           Name, Description: String; ExtraArgs: array of const); override;
    206       procedure Update(Offset, Length: Integer); override;
    207       procedure WriteData(stream: TStream); override;
     208      // ExtraArgs: String: RawType; Bool: Sep
     209      constructor Create(ParentFile: TObject; ParentBlock: TContainer;
     210          Name, Description: String; ExtraArgs: array of const); override;
     211      procedure Update(Offset, Length: Integer); override;
     212      procedure WriteData(stream: TStream); override;
     213
     214      property RawType: String read FRawType;
    208215  end;
    209216
    210217
    211218  TUnused = class(TDataField)
    212     private
     219    protected
    213220      function GetValueAsString: String; override;
    214221    public
     
    268275end;
    269276
     277function TDataField.GetType: String;
     278begin
     279  Result := FType;
     280end;
     281
    270282function TDataField.GetValueAsString: String;
    271283begin
     
    280292  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    281293  FDataLength := ExtraArgs[0].VInteger;
     294  FType := 'String[' + IntToStr(FDataLength) + ']';
    282295end;
    283296
     
    325338  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    326339  FDataLength := ExtraArgs[0].VInteger;
     340  FType := 'Int' + IntToStr(FDataLength * 8);
    327341  FInt := 0;
    328342end;
     
    364378  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    365379  FCounterSize := ExtraArgs[0].VInteger;
     380  FType := '';
    366381  if Length(ExtraArgs) = 2 then
    367382    FBlockCount := ExtraArgs[1].VInteger
     
    521536begin
    522537  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
     538  FType := '';
    523539end;
    524540
     
    593609  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    594610  FDataLength := 4;
     611  FType := 'LevelID';
    595612  FLevelID := 0;
    596613end;
     
    628645  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    629646  FDataLength := 4;
     647  FType := 'FileID';
    630648  FFileID := -1;
    631649end;
     
    673691    vtAnsiString: FPosExts := String(ExtraArgs[0].VAnsiString);
    674692  end;
     693  FType := 'LinkByID(' + FPosExts + ')';
    675694  FFileID := -1;
    676695end;
     
    740759begin
    741760  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
     761  case ExtraArgs[0].VType of
     762    vtChar: FRawType := ExtraArgs[0].VChar;
     763    vtAnsiString: FRawType := String(ExtraArgs[0].VAnsiString);
     764  end;
     765  if Length(ExtraArgs) > 1 then
     766    FSep := ExtraArgs[1].VBoolean;
     767  FType := 'RawLink(' + FRawType + ')';
    742768  FDataLength := 4;
    743769end;
     
    774800  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    775801  FDataLength := ExtraArgs[0].VInteger;
     802  FType := 'Unused';
    776803end;
    777804
     
    813840    end;
    814841  FDataLength := 1;
     842  FType := 'BitSet';
    815843  FBits := 0;
    816844end;
     
    854882  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    855883  FDataLength := 4;
     884  FType := 'Float';
    856885  FFloat := 0;
    857886end;
Note: See TracChangeset for help on using the changeset viewer.