[fpc-pascal] Assign() vs AssignTo()
Dennis
dec12 at avidsoft.com.hk
Fri Feb 12 03:17:57 CET 2016
Martin Schreiber wrote:
> On Thursday 11 February 2016 17:17:32 Graeme Geldenhuys wrote:
>> Now the other thing that surprised be, I thought TPersistent.Assign()
>> automatically handles protected properties (via RTTI) - thinking that
>> descendants automatically get such functionality for free. But reviewing
>> the RTL code, I see Assign() and AssignTo() really has no functionality
>> implemented by default.
>>
> Correct, it depends much on the actual classes what should happen by
> calling "assign()". So "tpersistent" does nothing by default.
>
> Martin
>
Is there any sample codes to copy published properties (via RTTI) ?
e.g. psuedo code below
for i := 0 to properties.count -1 do begin
case properties[i].type of
vtInteger : properties[i].AsInteger :=
Source.PropertiesByName(Properties[i].Name).AsInteger;
vtdouble : ....
vtString : ...
end;
end;
More information about the fpc-pascal
mailing list