mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 06:20:57 +02:00
* Allow ToString for object value
This commit is contained in:
parent
4e4fcaa8a2
commit
9f5a420504
@ -4028,6 +4028,10 @@ begin
|
||||
end;
|
||||
|
||||
function TValue.ToString: String;
|
||||
|
||||
var
|
||||
Obj : TObject;
|
||||
|
||||
begin
|
||||
if IsEmpty then
|
||||
Exit('(empty)');
|
||||
@ -4046,6 +4050,14 @@ begin
|
||||
tkEnumeration: Result := GetEnumName(TypeInfo, Integer(AsOrdinal));
|
||||
tkChar: Result := AnsiChar(FData.FAsUByte);
|
||||
tkWChar: Result := UTF8Encode(WideChar(FData.FAsUWord));
|
||||
tkClass :
|
||||
begin
|
||||
Obj:=AsObject;
|
||||
if Assigned(Obj) then
|
||||
Result:=Obj.ToString
|
||||
else
|
||||
Result:='<Nil>';
|
||||
end
|
||||
else
|
||||
result := '<unknown kind>';
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user