You've already forked lazarus-ccr
JSON Formatter: serialize enum's string representation, SaveTo(Stream/File) using UTF8, fix ContentType.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4384 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -21,6 +21,7 @@ uses
|
|||||||
|
|
||||||
const
|
const
|
||||||
sFORMAT = 'format';
|
sFORMAT = 'format';
|
||||||
|
sCONTENT_TYPE = 'contenttype';
|
||||||
s_json_ContentType = 'application/json';
|
s_json_ContentType = 'application/json';
|
||||||
s_json = 'json';
|
s_json = 'json';
|
||||||
s_inner_value = '__';
|
s_inner_value = '__';
|
||||||
@@ -513,7 +514,7 @@ procedure TJsonRpcBaseFormatter.PutEnum(
|
|||||||
const AData : TEnumIntType
|
const AData : TEnumIntType
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
StackTop().CreateIntBuffer(AName,AData);
|
StackTop().CreateStringBuffer(AName,GetEnumName(ATypeInfo,AData));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJsonRpcBaseFormatter.PutBool(
|
procedure TJsonRpcBaseFormatter.PutBool(
|
||||||
@@ -638,7 +639,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := GetDataBuffer(AName,locBuffer);
|
Result := GetDataBuffer(AName,locBuffer);
|
||||||
if Result then
|
if Result then
|
||||||
AData := locBuffer.AsInteger;
|
AData := GetEnumValue(ATypeInfo,locBuffer.AsString);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJsonRpcBaseFormatter.GetBool(
|
function TJsonRpcBaseFormatter.GetBool(
|
||||||
@@ -1565,7 +1566,7 @@ end;
|
|||||||
|
|
||||||
procedure TJsonRpcBaseFormatter.SaveToStream(AStream : TStream);
|
procedure TJsonRpcBaseFormatter.SaveToStream(AStream : TStream);
|
||||||
var
|
var
|
||||||
locBuffer : string;
|
locBuffer : UTF8String;
|
||||||
begin
|
begin
|
||||||
if Assigned(FRootData) then begin
|
if Assigned(FRootData) then begin
|
||||||
locBuffer := FRootData.AsJSON;
|
locBuffer := FRootData.AsJSON;
|
||||||
|
Reference in New Issue
Block a user