[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'LazConfigStorage' (#lazutils)

TConfigStorage.WriteObject

Stores property names and values in the specified object to the configuration storage.

Declaration

Source position: lazconfigstorage.pas line 82

public procedure TConfigStorage.WriteObject(

  Path: string;

  Obj: TPersistent;

  DefObject: TPersistent = Nil;

  OnlyProperty: string = ''

);

Arguments

Path

  

Path where property names and values from Obj are stored.

Obj

  

Persistent object with properties stored in the method.

DefObject

  

Persistent object with default values for the properties in Obj.

OnlyProperty

  

Name for a single property that should be written in the method, instead of all properties.

Description

WriteObject is a method used to store names and values from the properties in the specified persistent object into the configuration storage.

Path contains the location in configuration storage where the property values are stored. It provides a unique location for the values stored in the method.

Obj is the TPersistent instance with the property values stored in the method.

WriteObject calls WriteProperty for each of the properties returned from the RTL GetPropList routine. Sub-paths representing each of the published properties in the object are created by calling the WriteProperty method.

WriteObject (and WriteProperty) rely on RTTI types and routines to get the values from the persistent object. As such, only published properties can be serialized; the FPC RTL does not provide RTTI type information for other protected or public visibility at this time. The properties must have getter and setter routines (read and write specifiers); otherwise, they are omitted from the serialized values.

Use the OnlyProperty argument to specify the name for a single property in Obj that should be written in the method. Otherwise, all properties are stored.

Use ReadObject to read values from a given path into a persistent object instance.

See also

TConfigStorage.WriteProperty

  

Stores one or more property values from an RTTI-enabled persistent object to the specified path in the configuration storage.

TConfigStorage.ReadObject

  

Reads names and values from the configuration storage into properties for the specified object instance.

TPersistent

GetPropList

GetPropInfo

TTypeData


Version 4.0 Generated 2025-05-03 Home