Guten Tag,
ich habe gerade das Problem, dass ich in TypInfo/
RTTI den Wert von einer TTimeSpan so holen muesste
Delphi-Quellcode:
function RetrieveValue(AConcreteItem: TPersistent; APropIndex: Integer): Variant;
var
LPropCount: Integer;
LPropList: PPropList;
LType: TClass;
begin
LType := AConcreteItem.ClassType;
LPropCount := GetTypeData(LType.ClassInfo)^.PropCount;
GetMem(LPropList, LPropCount * SizeOf(Pointer));
GetPropInfos(LType.ClassInfo, LPropList);
if LPropList[APropIndex].PropType^.Name = 'TTimeSpan' then
Result := GetStrProp(AConcreteItem, LPropList[APropIndex]) // <<-- Result = ''
else
Result := GetPropValue(AConcreteItem, LPropList[APropIndex], False);
end;
So geht das natuerlich nicht. TTimeSpan ist ein Record, darauf ist
GetPropValue nicht vorbereitet.
Ich muesste eigentlich eine Ebene tiefer in
GetPropValue einen cast
String(TTimeSpan)
durchfuehren, dann waere alles OK.
Wie kann ich das elegant beheben?