Unit CastleComponentSerialize

Description

Reading and writing a hierachy of CGE components to/from files. This is used by CGE editor to read/write components, and it can be used at runtime by games to instantiate components designed in the CGE editor.

Most code should use UserInterfaceLoad, UserInterfaceSave, TransformLoad, TransformSave which are defined in other units, that rely on this unit for base ComponentLoad, ComponentSave implementation.

Uses

  • SysUtils
  • Classes
  • FpJson
  • FpJsonRtti
  • Generics.Collections
  • TypInfo

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EInvalidComponentFile  
Class TRegisteredComponent Describes a component registered using RegisterSerializableComponent, enumerated using RegisteredComponents list.
Class EComponentNotFound  
Class TComponentHelper  
Class TSerializedComponent Load the serialized component once, instantiate it many times.

Functions and Procedures

procedure ComponentSave(const C: TComponent; const Url: String);
function ComponentLoad(const Url: String; const Owner: TComponent): TComponent;
function ComponentToString(const C: TComponent): String;
function StringToComponent(const Contents: String; const Owner: TComponent): TComponent;
procedure RegisterSerializableComponent(const ComponentClass: TComponentClass; const Caption: array of String); overload;
procedure RegisterSerializableComponent(const ComponentClass: TComponentClass; const CaptionOnePart: String); overload;
procedure RegisterSerializableComponent(const C: TRegisteredComponent); overload;
function RegisteredComponents: TRegisteredComponents;

Types

TRegisteredComponents = specialize TObjectList<TRegisteredComponent>;

Description

Functions and Procedures

procedure ComponentSave(const C: TComponent; const Url: String);

Save / load TComponent (or any descendant) to a .castle-component, .castle-user-interface or .castle-transform file.

If you have a TCastleUserInterface or TCastleTransform then it is advised to use instead stronger typed UserInterfaceSave, UserInterfaceLoad, TransformSave, TransformLoad.

function ComponentLoad(const Url: String; const Owner: TComponent): TComponent;

This item has no description.

function ComponentToString(const C: TComponent): String;

Save / load TComponent (or descendant) to a string. The string contents have the same format as a .castle-component, .castle-user-interface or .castle-transform file.

function StringToComponent(const Contents: String; const Owner: TComponent): TComponent;

This item has no description.

procedure RegisterSerializableComponent(const ComponentClass: TComponentClass; const Caption: array of String); overload;

Register a component that can be serialized and edited using CGE editor.

In case of the overloaded version that gets TRegisteredComponent instance, the TRegisteredComponent instance becomes internally owned in this unit (do not free it yourself).

procedure RegisterSerializableComponent(const ComponentClass: TComponentClass; const CaptionOnePart: String); overload;

This item has no description.

procedure RegisterSerializableComponent(const C: TRegisteredComponent); overload;

This item has no description.

function RegisteredComponents: TRegisteredComponents;

Read-only list of currently registered (using RegisterSerializableComponent) components.

Types

TRegisteredComponents = specialize TObjectList<TRegisteredComponent>;

This item has no description.


Generated by PasDoc 0.16.0-snapshot.