mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:06:08 +02:00
packages: add enumerator for TFields class
git-svn-id: trunk@14065 -
This commit is contained in:
parent
eee6658a46
commit
7db712c566
@ -992,6 +992,19 @@ type
|
|||||||
property Items[Index: Longint]: TCheckConstraint read GetItem write SetItem; default;
|
property Items[Index: Longint]: TCheckConstraint read GetItem write SetItem; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TFieldsEnumerator }
|
||||||
|
|
||||||
|
TFieldsEnumerator = class
|
||||||
|
private
|
||||||
|
FPosition: Integer;
|
||||||
|
FFields: TFields;
|
||||||
|
function GetCurrent: TField;
|
||||||
|
public
|
||||||
|
constructor Create(AFields: TFields);
|
||||||
|
function MoveNext: Boolean;
|
||||||
|
property Current: TField read GetCurrent;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFields }
|
{ TFields }
|
||||||
|
|
||||||
Tfields = Class(TObject)
|
Tfields = Class(TObject)
|
||||||
@ -1019,6 +1032,7 @@ type
|
|||||||
Function FindField (Const Value : String) : TField;
|
Function FindField (Const Value : String) : TField;
|
||||||
Function FieldByName (Const Value : String) : TField;
|
Function FieldByName (Const Value : String) : TField;
|
||||||
Function FieldByNumber(FieldNo : Integer) : TField;
|
Function FieldByNumber(FieldNo : Integer) : TField;
|
||||||
|
Function GetEnumerator: TFieldsEnumerator;
|
||||||
Procedure GetFieldNames (Values : TStrings);
|
Procedure GetFieldNames (Values : TStrings);
|
||||||
Function IndexOf(Field : TField) : Longint;
|
Function IndexOf(Field : TField) : Longint;
|
||||||
procedure Remove(Value : TField);
|
procedure Remove(Value : TField);
|
||||||
|
@ -2796,6 +2796,25 @@ begin
|
|||||||
SetData(@aValue);
|
SetData(@aValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TFieldsEnumerator }
|
||||||
|
|
||||||
|
function TFieldsEnumerator.GetCurrent: TField;
|
||||||
|
begin
|
||||||
|
Result := FFields[FPosition];
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TFieldsEnumerator.Create(AFields: TFields);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FFields := AFields;
|
||||||
|
FPosition := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFieldsEnumerator.MoveNext: Boolean;
|
||||||
|
begin
|
||||||
|
inc(FPosition);
|
||||||
|
Result := FPosition < FFields.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFields }
|
{ TFields }
|
||||||
|
|
||||||
@ -2955,6 +2974,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function TFields.GetEnumerator: TFieldsEnumerator;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=TFieldsEnumerator.Create(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TFields.GetFieldNames (Values : TStrings);
|
Procedure TFields.GetFieldNames (Values : TStrings);
|
||||||
|
|
||||||
Var i : longint;
|
Var i : longint;
|
||||||
|
Loading…
Reference in New Issue
Block a user