[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Factory class for resources
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; |
|
Factory class for resources |
|
| | ||
TObject |
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.
|
Registers a resource class |
|
|
Creates a new resource |
|
|
Base abstract resource class |
|
|
Generic resource class |