Skip to content

EF.Types

Generally useful types.

EEFError class

Base class for all EF exceptions.

pascal
constructor CreateWithAdditionalInfo(const AMessage, AAdditionalInfo: string);

Creates the exception with an additional message.

pascal
property AdditionalInfo: string read FAdditionalInfo;

An EF exception may optionally have additional information over what's displayed in the Message. The value of this property is set upon creation through the CreateWithAdditionalInfo constructor.

TEFTriple record

A triple of string values, useful where a key/value pair is not enough.

pascal
constructor Create(const AValue1, AVAlue2, AVAlue3: string);

Creates a triple from three string values.

pascal
procedure AssignPair({$IFDEF D15+}const {$ENDIF}APair: TEFPair);

Fills the triple from a pair: Value1 and Value2 take the pair's key and value; Value3 is set to ''.

TEFRegistry class

Holds a list of registered classes and provides class references by string Ids.

pascal
constructor Create;

Creates the registry with a case-insensitive Id lookup.

pascal
destructor Destroy;

Destroys the registry and its internal list of classes.

pascal
procedure RegisterClass(const AId: string;

Adds a class to the registry.

pascal
procedure UnregisterClass(const AId: string);

Deletes a previously registered class from the registry.

pascal
function HasClass(const AId: string): Boolean;

Returns True if a given class Id is registered.

pascal
function GetClass(const AId: string): TClass;

Returns a class reference to the class identified by AClassId, if registered. Otherwise an exception is raised.

pascal
function FindClassId(const AClass: TClass): string;

Returns the Id under which a class was registered, or ''.

pascal
function FindClass(const AId: string): TClass;

Returns a class reference to the class identified by AClassId, if registered. Otherwise returns nil.

pascal
function GetClassIds: TArray<string>;

Returns a sorted array with all registered class Ids.

TEFFactory class

Uses the registry to create objects by class id. It is friend to a descendant of TEFRegistry.

pascal
constructor Create(const ARegistry: TEFRegistry);

Pass a reference to the registry to use when constructing a factory.

pascal
function CreateObject(const AId: string): TObject;

Creates and returns an instance of the class identified by AClassId. Raises an exception if said class is not registered.

pascal
function HasClass(const AId: string): Boolean;

Returns True if a given class Id is registered.

TEFArray class

Extends the RTL TArray with helpers to search open arrays for an item.

pascal
class function Contains<T>(const Values: array of T;

Returns True if Item is found in Values using the given equality comparer, setting ItemIndex to its position (or -1 if not found).

pascal
class function Contains<T>(const Values: array of T;

Returns True if Item is found in Values using the default comparer, setting ItemIndex to its position (or -1 if not found).

pascal
class function Contains<T>(const Values: array of T;

Returns True if Item is found in Values using the default comparer.

pascal
class function IndexOf<T>(const Values: array of T;

Returns the index of Item in Values using the given equality comparer, or -1 if not found.

pascal
class function IndexOf<T>(const Values: array of T;

Returns the index of Item in Values using the default comparer, or -1 if not found.

Released under Apache License, Version 2.0.