@@ -77,6 +77,18 @@ TRALParam = class
7777
7878 // / Collection of TRALParam objects
7979 TRALParams = class
80+ public type
81+ // / Support enumeration of values in TRALParams.
82+ TEnumerator = class
83+ private
84+ FIndex: Integer;
85+ FArray: TRALParams;
86+ public
87+ constructor Create(const AArray: TRALParams);
88+ function GetCurrent : TRALParam; inline;
89+ function MoveNext : Boolean; inline;
90+ property Current: TRALParam read GetCurrent;
91+ end ;
8092 private
8193 FCompressType: TRALCompressType;
8294 FContentDispositionInline: Boolean;
@@ -189,6 +201,8 @@ TRALParams = class
189201 procedure DelParam (const AName: StringRAL; AKind: TRALParamKind); overload;
190202 // / Returns a TStream with all RALParams that matches 'Body' Kind.
191203 function EncodeBody (var AContentType, AContentDisposition: StringRAL): TStream;
204+ // / Retuns the internal Enumerator type to allow for..in loops
205+ function GetEnumerator : TEnumerator; inline;
192206 // / creates and returns an empty param for a more flexible way of coding.
193207 function NewParam : TRALParam;
194208 // / converts a HTML encoded URL into a TStringList.
@@ -1473,4 +1487,30 @@ procedure TRALParams.DelParam(const AName: StringRAL);
14731487 end ;
14741488end ;
14751489
1490+ { TRALParams.TEnumerator }
1491+
1492+ constructor TRALParams.TEnumerator.Create(const AArray: TRALParams);
1493+ begin
1494+ inherited Create;
1495+ FIndex := -1 ;
1496+ FArray := AArray;
1497+ end ;
1498+
1499+ function TRALParams.TEnumerator .GetCurrent: TRALParam;
1500+ begin
1501+ Result := TRALParam(FArray.FParams[FIndex]);
1502+ end ;
1503+
1504+ function TRALParams.TEnumerator .MoveNext: Boolean;
1505+ begin
1506+ Result := FIndex < FArray.FParams.Count - 1 ;
1507+ if Result then
1508+ Inc(FIndex);
1509+ end ;
1510+
1511+ function TRALParams.GetEnumerator : TEnumerator;
1512+ begin
1513+ Result := TEnumerator.Create(Self);
1514+ end ;
1515+
14761516end .
0 commit comments