Undocumented TPropInfo Members

System.TypInfo.TPropInfo has two function members (at least in D-XE3):

function NameFld: TTypeInfoFieldAccessor; inline;
function Tail: PPropInfo; inline;

I can not find documentation for them or examples of their use. What are they intended for and how can they be used? (Hope that qualifies as one question.)

+5
source share
1 answer

The NameFld function returns the property name as TTypeInfoFieldAccessor.

This allows you to do the following:

MyPropertyName:= MyPropInfo.NameFld.ToString;
if (PropInfoA.NameFld = PropInfoB.NameFld) then begin 
  writeln('property names are the same');
end;

TTypeInfoFieldAccessor stores the property name in a shortstring inside.
Since the NextGen compiler does not support short strings, the type is used PByte.
(I think the author did not want to clutter the source of ifdefs and pulled out links to PShortstring)

Tail - PByte, .

.

function TTypeInfoFieldAccessor.Tail: PByte;
begin
  Result:= 
    FData    //Start of the shortstring 
    + FData^ + //Length of the stringData
    + 1; //Add one for the length byte itself
end;

, , char. .
, RTL , Tail; .
size Tail.

+2

All Articles