delphi - Undocumented Members of TPropInfo -


system.typinfo.tpropinfo has 2 function members (at least in d-xe3):

function namefld: ttypeinfofieldaccessor; inline; function tail: ppropinfo; inline; 

i cannot find documentation them or examples of use. , how can used? (hope qualifies 1 question.)

the namefld function returns name of property ttypeinfofieldaccessor.

this allows following:

mypropertyname:= mypropinfo.namefld.tostring; if (propinfoa.namefld = propinfob.namefld) begin    writeln('property names same'); end; 

the ttypeinfofieldaccessor stores name of property in shortstring internally.
because nextgen compiler not support shortstrings, pbyte type used.
(i guess author did not want litter source ifdefs , ripped out pshortstring references)

the input of tail pbyte pointing length field of internal shortstring.

here's source code tail.

function ttypeinfofieldaccessor.tail: pbyte; begin   result:=      fdata    //start of shortstring      + fdata^ + //length of stringdata     + 1; //add 1 length byte end; 

because shortstrings not null terminated, cannot simple "loop until null char found" kind of loop.
therefore loop start tail can employed transfer shortstring normal string.
strangely enough in actual rtl sourcecode length byte used everywhere instead of tail function; looks leftover.
have made more sense include size function , rip out tail.


Comments

Popular posts from this blog

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -