Changeset 232 for branches/xpascal/SourceNode.pas
- Timestamp:
- Jun 26, 2023, 12:51:06 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/SourceNode.pas
r231 r232 8 8 type 9 9 TDataType = (dtNone, dtString, dtBoolean, dtInteger, dtFloat, dtColor, 10 dtTime, dtDate, dtDateTime, dtEnumeration, dtObject );10 dtTime, dtDate, dtDateTime, dtEnumeration, dtObject, dtList); 11 11 12 12 { TField } … … 47 47 { TSourceNodeList } 48 48 49 TSourceNodeList<T > = class(TSourceNode)49 TSourceNodeList<T: TSourceNode> = class(TObjectList<T>) 50 50 private 51 51 Parent: TSourceNode; 52 function GetCount: Integer;53 function GetItem(Index: Integer): T;54 procedure SetItem(Index: Integer; AValue: T);55 public56 List: TObjectList<TSourceNode>;57 procedure Clear;58 function Add(AObject: T): Integer;59 constructor Create;60 destructor Destroy; override;61 property Items[Index: Integer]: T read GetItem write SetItem; default;62 property Count: Integer read GetCount;63 52 end; 64 53 … … 75 64 DataTypeStr: array[TDataType] of string = ('None', 'String', 'Boolean', 76 65 'Integer', 'Float', 'Color', 'Time', 'Date', 'DateTime', 'Enumeration', 77 'Reference' );66 'Reference', 'List'); 78 67 79 68 { TField } … … 83 72 DataType := ADataType; 84 73 Name := AName; 85 end;86 87 { TSourceNodeList }88 89 function TSourceNodeList<T>.GetCount: Integer;90 begin91 Result := List.Count;92 end;93 94 function TSourceNodeList<T>.GetItem(Index: Integer): T;95 begin96 Result := T(List[Index]);97 end;98 99 procedure TSourceNodeList<T>.SetItem(Index: Integer; AValue: T);100 begin101 List[Index] := AValue;102 end;103 104 procedure TSourceNodeList<T>.Clear;105 begin106 List.Clear;107 end;108 109 function TSourceNodeList<T>.Add(AObject: T): Integer;110 begin111 Result := List.Add(AObject);112 end;113 114 constructor TSourceNodeList<T>.Create;115 begin116 List := TObjectList<TSourceNode>.Create;117 end;118 119 destructor TSourceNodeList<T>.Destroy;120 begin121 FreeAndNil(List);122 inherited;123 74 end; 124 75
Note:
See TracChangeset
for help on using the changeset viewer.