Hi.
Please consider the following code:
uses TypInfo;
type
TTestRecord = record
Member1: LongInt;
Member2: Double;
Member3: string;
Member4: Extended;
end;
var
F: PManagedField;
R: TTestRecord;
T, T2: PTypeData;
I: Integer;
begin
R := Default(TTestRecord);
T := GetTypeData(TypeInfo(R));
F := PManagedField(PByte(@T^.TotalFieldCount) + 4);
T2 := GetTypeData(F^.TypeRef);
for I := 0 to Pred(T^.TotalFieldCount) do
begin
if F^.TypeRef^.Kind = tkFloat then
WriteLn(F^.TypeRef^.Kind, ':', T2^.FloatType);
Inc(F);
end;
end.
it prints:
tkFloat:ftCurr
tkFloat:ftCurr
is there any chance to print it as below using FloatType?:
tkFloat:ftDouble
tkFloat:ftExtended
I solved it temporally using the following workaround (removing the last
four chars when the floating type is "Currency"):
WriteLn(F^.TypeRef^.Kind, ':tk', F^.TypeRef^.Name);
but I really would like to get the ordinal item instead of its name,
avoiding string handling.
Thank you!
--
Silvio Clécio
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal