Unit 'resfactory' Package
[Overview][Resource strings][Classes][Index] [#fcl-res]

TResourceFactory

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Factory class for resources

Declaration

Source position: resfactory.pp line 43

type TResourceFactory = class

public

  class procedure RegisterResourceClass();

  

Registers a resource class

  class function CreateResource();

  

Creates a new resource

end;

Inheritance

TResourceFactory

  

Factory class for resources

|

TObject

Description

Resources are represented by descendants of TAbstractResource. Some applications don't need specialized resource classes, and a TGenericResource can be enough. On the other hand, sometimes it is required that a resource of a specific type is created with a more specialized class. This class provides a centralized point for the creation of resources.

TResourceFactory holds a list of registered classes with an associated resource type. When it is requested to create a resource for a given type, it creates a resource of the class associated with that type. If no class matching that type is found, TGenericResource is used.

Usually each resource class registers itself in the initialization section of the unit in which it is implemented.

See also

TResourceFactory.RegisterResourceClass

  

Registers a resource class

TResourceFactory.CreateResource

  

Creates a new resource

TAbstractResource

  

Base abstract resource class

TGenericResource

  

Generic resource class


Documentation generated on: Dec 22 2024