RTTI question
RTTI question
How to use rtti to check if a class field is an interface of a specific type?
rFld : TRttiField;
result := (rFld.FieldType is TRttiInterfaceType) and (?? is IMyInterface);
How to use rtti to check if a class field is an interface of a specific type?
rFld : TRttiField;
result := (rFld.FieldType is TRttiInterfaceType) and (?? is IMyInterface);
You will need a GUID on your interface.
ReplyDeleteWorking from memory, it might be something on the lines of:
TRttiInterfaceType(rFld.FieldType).Guid.Equals(GetTypeData(TypeInfo(IMyInterface))^.Guid);
you can even do:
ReplyDeleteIf RTTIInterface.Guid = IMyInterface then
Interfaces allow implicit cast to TGuid :)
thx :-)
ReplyDelete