Contains types, classes, and routines used to serialize components into Pascal code.

The following features and functionality are currently implemented:

  • signature begin, end, version
  • boolean, set of boolean
  • char, widechar, custom char, set of custom char
  • integers, custom int, set of custom int
  • strings, codepage system and UTF8
  • float, currency
  • enum, custom enum range
  • set of enum, set of custom enum range
  • variant: integers, boolean, string, floats, currency
  • method
  • persistent
  • component children, use SetParentComponent or optional Parent
  • collection
  • IInterfaceComponentReference
  • with ancestor
  • ancestor: change ComponentIndex -> call SetChildPos
  • reference foreign root, reference foreign component
  • create components before setting properties to avoid having to set references later
  • inline component, csInline, call SetInline, inherited inline, inline on inherited
  • TComponent.Left/Right via DesignInfo
  • DefineProperties
  • RegisterDefinePropertiesPas

TCompWriterPas is used in the implementation of the TCustomFormEditor class in the Lazarus IDE.

Author: Mattias Gaertner

compwriterpas.pas is part of the lazutils package.

Component Serialization to Pascal version. Default signature written before serialized component data. Default begin signature written before a serialized component. Default end signature written after a serialized component. Default class name used to access protected TComponent members. Default value for the ExecCustomProc property in TCompWriterPas. Default value for the ExecCustomProcUnit property in TCompWriterPas. Default value for the MaxColumn property in TCompWriterPas. Default value for the AssignOp property in TCompWriterPas. Parent property name to skip when writing component data. Specifies an event handler used to find ancestor class in TCompWriterPas. Specifies an event handler used to get property information and an identifier name for a property. Specifies an event handler used to get a parent property name for a component instance. Enumeration which defines options available in TCompWriterPas. Do not write Begin, End signatures. Enclose in "with LookupRootname do begin" Add "SetParentComponent" before setting properties, default: after. Target unit uses $codepage utf-8, aka do not convert UTF-8 string literals. Do not use with ... do. Do not include a final line break at the end of the serialized component data. Set type used to stores values from the TCWPOption enumeration. Serializes a component to Pascal code.