Given a Delphi record that contains procedure types as fields, for example:
TProcType1 = function (index : integer; value : double) : string;
TProcType2 = function (bValue : boolean; ptr : TPointer) : integer;
TMyRecord = record
proc1 : TProcType1;
proc2 : TProcType2;
end
Is it possible to get hold of the detailed information on the procedure type signatures? eg that proc1 is declared as a procedure type with two arguments, integer and double, and a return type of string?
I can convert the procedure types field into a string using ToString on a field and parse it for the information, for example, using code such as:
context := TRttiContext.Create;
rtype := context.GetType(TypeInfo(TMyRecord));
fields := rtype.GetFields;
for i := 0 to High(fields) do
begin
astr := fields[i].FieldType.ToString;
// parse astr to get info on procedure type
end
I was wondering if there is any way to deconstruct the procedure types using rtti instead of having to manually parse to ToString? For normal method fields, this is possible.
I can guarantee that the record will only contain procedure type fields. Using Delphi 10.4