Skip to content

TPropsStorage

Property storage mechanism.

Declaration

Source position: rttiutils.pp line 75

type

  TPropsStorage = class(TObject)
  public
    procedure StoreAnyProperty;
    procedure LoadAnyProperty;
    procedure StoreProperties;
    procedure LoadProperties;
    procedure LoadObjectsProps;
    procedure StoreObjectsProps;
    property Options: TPropStorageOptions; {rw}
    property AObject: TObject; {rw}
    property Prefix: string; {rw}
    property Section: string; {rw}
    property OnReadString: TReadStrEvent; {rw}
    property OnWriteString: TWriteStrEvent; {rw}
    property OnEraseSection: TEraseSectEvent; {rw}
  end;

Description

TPropsStorage provides a mechanism to store properties from any class which has published properties (usually a TPersistent descendent) in a storage mechanism.

TPropsStorage does not handle the storage by itself, instead, the storage is handled through a series of callbacks to read and/or write strings. Conversion of property types to string is handled by TPropsStorage itself: all that needs to be done is set the 3 handlers. The storage mechanism is assumed to have the structure of an .ini file : sections with key/value pairs. The three callbacks should take this into account, but they do not need to create an actual .ini file.

Properties

Member Visibility Description
AObject public Object to load or store properties from.
Options public Options to take into account when saving or loading properties from the storage.
Prefix public Prefix to use in storage.
Section public Section name for storage.
See all Properties

Methods

Member Visibility Description
LoadAnyProperty public Load a property value.
LoadObjectsProps public Load a list of component properties.
LoadProperties public Load a list of properties.
StoreAnyProperty public Store a property value.
StoreObjectsProps public Store a list of component properties.
StoreProperties public Store a list of properties.
See all Methods

Events

Member Visibility Description
OnEraseSection public Erase a section in storage.
OnReadString public Read a string value from storage.
OnWriteString public Write a string value to storage.
See all Events

See also

Name Description
TPropInfoList Class for keeping property information.