Hi what I want to do is similar to this question here: https://en.delphipraxis.net/topic/423-rtti-determine-record-helper-type-for-a-base-type/

I am going to create multiple type helpers for enums and I would like to look up the helper and use common methods AsString AsOrdinal to get/set the values. I am recieving them as json that I dont have control over. I am using typeinfo to fill in all the properties but I would like to convert the strings I am receiving to the enum values semi-automatically.

LString := 'STATUS';

LHelper := GetHelper(LPropInfo^.PropType); // enum proptype

LToStringInterface := LHelper as IToStringInterface;

SetOrdProp(LObject, 'propname', LToStringInterface.OrdValue(LString);


Something like that. I'm not sure if it's even possible to find the helper type with typeinfo.

Thanks for your suggestions :)

Regards,

Andrew

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to