Skip to content

TWriter

Object to write component data to an arbitrary format.

Declaration

Source position: classesh.inc line 2224

type

  TWriter = class(TFiler)
  public
    constructor Create(ADriver: TAbstractObjectWriter);
    constructor Create(Stream: TStream; BufSize: Integer);
    destructor Destroy;
    procedure FlushBuffer;
    procedure DefineProperty;
    procedure DefineBinaryProperty;
    procedure Write;
    procedure WriteBoolean;
    procedure WriteCollection;
    procedure WriteComponent;
    procedure WriteChar;
    procedure WriteWideChar;
    procedure WriteDescendent;
    procedure WriteFloat;
    procedure WriteSingle;
    procedure WriteDouble;
    procedure WriteDate;
    procedure WriteCurrency;
    procedure WriteIdent;
    procedure WriteInteger(Value: LongInt); overload;
    procedure WriteInteger(Value: Int64); overload;
    procedure WriteSet;
    procedure WriteListBegin;
    procedure WriteListEnd;
    procedure WriteSignature;
    procedure WriteRootComponent;
    procedure WriteString;
    procedure WriteWideString;
    procedure WriteUnicodeString;
    procedure WriteVariant;
    property RootAncestor: TComponent; {rw}
    property OnFindAncestor: TFindAncestorEvent; {rw}
    property OnWriteMethodProperty: TWriteMethodPropertyEvent; {rw}
    property OnWriteStringProperty: TReadWriteStringPropertyEvent; {rw}
    property Driver: TAbstractObjectWriter; {r}
    property PropertyPath: string; {r}
    property DelphiCompatible: Boolean; {rw}
  end;

Description

The TWriter class is a writer class that implements generic component streaming capabilities, independent of the format of the data in the stream. It uses a driver class TAbstractObjectWriter to do the actual reading of data. The interface of the TWriter class should be identical to the interface in Delphi.

Note that the TWriter design is such that it will write a single component to a stream. It will write all children of this component, but it is not designed to write multiple components in succession to one stream.

It should never be necessary to create an instance of this class directly. Instead, the TStream.WriteComponent call should be used.

Properties

Member Visibility Description
DelphiCompatible public
Driver read only public Driver used when writing to the stream.
PropertyPath read only public Path to the property that is currently being written.
RootAncestor public Ancestor of root component.
See all Properties

Methods

Member Visibility Description
Create public Creates a new Writer with a stream and bufsize.
DefineBinaryProperty public Callback used when defining and streaming custom properties.
DefineProperty public Callback used when defining and streaming custom properties.
Destroy public Destroys the writer instance.
FlushBuffer public Flush the buffer
Write public Write raw data to stream.
WriteBoolean public Write boolean value to the stream.
WriteChar public Write a character to the stream.
WriteCollection public Write a collection to the stream.
WriteComponent public Stream a component to the stream.
WriteCurrency public Write a currency value to the stream.
WriteDate public Write a date to the stream.
WriteDescendent public Write descendent to stream.
WriteDouble public
WriteFloat public Write a float to the stream.
WriteIdent public Write an identifier to the stream.
WriteInteger public Write an integer to the stream.
WriteListBegin public Write a start-of-list marker to the stream.
WriteListEnd public Write an end-of-list marker to the stream.
WriteRootComponent public Write a root component to the stream.
WriteSet public Write a set value to the stream.
WriteSignature public Write a signature to the stream.
WriteSingle public Write a single-type real to the stream.
WriteString public Write a string to the stream.
WriteUnicodeString public Write a Unicode string to the stream.
WriteVariant public Write a variant to the stream.
WriteWideChar public Write widechar to stream.
WriteWideString public Write a widestring value to the stream.
See all Methods

Events

Member Visibility Description
OnFindAncestor public Event occurring when an ancestor component must be found.
OnWriteMethodProperty public Handler from writing method properties.
OnWriteStringProperty public Event handler for translating strings written to stream.
See all Events

See also

Name Description
TFiler Class responsible for streaming of components.
TWriter Object to write component data to an arbitrary format.
TAbstractObjectReader Abstract driver class to read stored component data.