Skip to content

Commit c8b2759

Browse files
committed
JSONEnumerator Set_Value because why not
1 parent 03b494d commit c8b2759

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

jsonDoc.pas

+11-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ interface
4848
function Next: boolean; safecall;
4949
function Get_Key: WideString; safecall;
5050
function Get_Value: OleVariant; safecall;
51+
procedure Set_Value(Value: OleVariant); safecall;
5152
property Key: WideString read Get_Key;
52-
property Value: OleVariant read Get_Value;
53+
property Value: OleVariant read Get_Value write Set_Value;
5354
end;
5455

5556
IJSONEnumerable = interface(IUnknown)
@@ -94,6 +95,7 @@ TJSONEnumerator = class(TInterfacedObject, IJSONEnumerator)
9495
function Next: boolean; safecall;
9596
function Get_Key: WideString; safecall;
9697
function Get_Value: OleVariant; safecall;
98+
procedure Set_Value(Value: OleVariant); safecall;
9799
end;
98100

99101
EJSONException=class(Exception);
@@ -1076,4 +1078,12 @@ function TJSONEnumerator.Get_Value: OleVariant;
10761078
Result:=FData.FElements[FIndex].Value;
10771079
end;
10781080

1081+
procedure TJSONEnumerator.Set_Value(Value: OleVariant);
1082+
begin
1083+
if (FIndex<0) or (FIndex>=FData.FElementIndex) then
1084+
raise ERangeError.Create('Out of range')
1085+
else
1086+
FData.FElements[FIndex].Value:=Value;
1087+
end;
1088+
10791089
end.

0 commit comments

Comments
 (0)