I found that I consider it a strange oversight (possibly intentional) from the extended RTTI function in Delphi.
I would like to reset all fields in a record type that contains about 1,500 different fields. Yes seriously.
Some of them are of type real48, and some are shortstring, for these two it seems that the FieldType for these types at runtime is zero:
function TRttiField.GetValue(Instance: Pointer): TValue; var ft: TRttiType; begin ft := FieldType; if ft = nil then raise InsufficientRtti;
If I were ready to assume that all nil-fieldtype fields are actually real48, I could just use the offset and (if field width 6) capture the value of real48.
However, the second complication is that all types of short strings (ie string[30]
) also suffer.
Has anyone got these two types of ancient pascals to work with modern advanced RTTI? Right now I am using the best-guessed approach, and where this fails, I hard code the rules by the field name, but if there was some technique that I could use, it could get me there without having to To write a lot of code to extract information from all of these old archive files that I will upgrade, I would appreciate a better idea.
source share