TRecall

[Properties (by Name)][Methods (by Name)][Events (by Name)]

Helper class for storing published properties

Declaration

Source position: classesh.inc line 469

Type
  TRecall = class (TObject)
  private
    FStorage : TPersistent;
    FReference : TPersistent;
  public
    constructor Create(AStorage: TPersistent; AReference: TPersistent);
    destructor Destroy;  Override;
    procedure Store;
    procedure Forget;
    Reference : TPersistent;
  end
  ;

Description

TRecall is a helper class used to copy published properties of a class (the reference object) in another class (the storage object). The reference object and storage object must be assignable to each other.

The TRecall can be used to store the state of a persistent class, and restore it at a later time.

When a TRecall object is created, it gets passed a reference instance and a storage instance. It immediately stores the properties of the reference object in the storage object.

The Store method can be called throughout the lifetime of the reference object to update the stored properties.

When the TRecall instance is destroyed then the properties are copied from the storage object to the reference object. The storage object is freed automatically.

If the properties should not be copied back from the storage to the reference object, the Forget can be called.

Members

Member Type Visibility Description
Create Method public Creates a new instance of TRecall.
Destroy Method public Copies the stored properties to the reference object and destroys the TRecall instance.
Forget Method public Clear the reference property.
FReference Field private
FStorage Field private
Reference Property public The reference object.
Store Method public Assigns the reference instance to the storage instance.

Inheritance

Class Description
TRecall Helper class for storing published properties

See also

Name Description
TPersistent Base class for streaming system and persistent properties.
TPersistent Base class for streaming system and persistent properties.
TPersistent Base class for streaming system and persistent properties.
TPersistent.Assign Assign the contents of one class to another.
TRecall.Create Creates a new instance of TRecall.
TRecall.Destroy Copies the stored properties to the reference object and destroys the TRecall instance.
TRecall.Forget Clear the reference property.
TRecall.Store Assigns the reference instance to the storage instance.