Модуль STRMPERS PAS
unit StrmPers; interface uses Classes; procedure WritePersistent( Stream: TStream; Persistent: TPersistent );
{ ЗАМЕЧАНИЕ: Объект TPersistent должен быть создан до его передачи этой процедуре... } procedure ReadPersistent( Stream: TStream; Persistent: TPersistent );
implementation type TCarrier = class( TComponent ) private FPersistent: TPersistent; published property Persistent: TPersistent read FPersistent write FPersistent; end; procedure WritePersistent( Stream: TStream; Persistent: TPersistent );
var Carrier: TCarrier; begin Carrier := TCarrier.Create( nil );
try Carrier.Persistent := Persistent; Stream.WriteComponent( Carrier );
finally Carrier.Free; end; end; procedure ReadPersistent( Stream: TStream; Persistent: TPersistent );
var Carrier: TCarrier; begin Carrier := TCarrier.Create( nil );
try Carrier.Persistent := Persistent; Stream.ReadComponent( Carrier );
finally Carrier.Free; end; end; end.