TConfigStorage.WriteProperty procedure
Stores one or more property values from an RTTI-enabled persistent object to the specified path in the configuration storage.
Declaration
procedure WriteProperty(Path: string; Instance: TPersistent;
PropInfo: Pointer; DefInstance: TPersistent=Nil;
OnlyProperty: string='')Arguments
Path | Path where property value(s) from the specified object are stored. |
Instance | Persistent object with the property value(s) stored in the method. |
PropInfo | Pointer to the RTTI property information processed in the method. |
DefInstance | Persistent object with the default value(s) for properties processed in the method. |
OnlyProperty | Specifies a single property name to the stored in the method. All properties in PropInfo are stored when omitted (or set to ''). |
Description
WriteProperty is based on the actions performed by the
TWriter class in the FPC RTL. Is uses the RTTI property information
passed in the PropInfo argument to access each of the properties in Instance.
No actions are performed for a given property if it does not provide both a
getter and a setter routine for the property value.
APath contains the fully-qualified path where value(s) are stored in
the configuration storage.
Instance is the RTTI-enabled persistent object with the value(s)
retrieved and written in the method.
PropInfo in a pointer to type information for the persistent object
in Instance (and DefInstance). It is used to access each property, and to
convert and store each value in the storage mechanism by calling the SetValue
method.
OnlyProperty contains an optional name for a single property name
stored in the method. When omitted (or set to an empty string), all of the
properties in the type information are stored starting at the specified path
using the Name for the property type as an identifier.
DefInstance is a persistent object which contains values to be treated as the default values for the corresponding properties in Instance. When a property has the same value in both Instance and DefInstance, it is deleted from the configuration storage. DefInstance can be Nil - but default property values cannot be determined when omitted.
WriteProperty handles values for the following type kinds in property type information:
- tkInteger (including string identifiers for the value)
- tkChar
- tkEnumeration
- tkSet (as comma-delimited identifiers in the set)
- tkWChar
- tkFloat
- tkSString
- tkLString
- tkAString
- tkBool
The following type kinds are not explicitly handled in the current LCL version:
- tkWString
- tkInt64
- tkQWord
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
