Skip to content

TAbstractResourceReader

Base abstract resource reader class

Declaration

Source position: resource.pp line 291

type

  TAbstractResourceReader = class
  protected
    procedure SetDataSize;
    procedure SetHeaderSize;
    procedure SetDataOffset;
    procedure SetRawData;
    procedure CallSubReaderLoad;
    procedure AddNoTree;
    function GetTree : TObject;
    function GetExtensions : string;
    function GetDescription : string;
    procedure Load;
    function CheckMagic : Boolean;
  public
    constructor Create;
    property Extensions: string; {r}
    property Description: string; {r}
  end;

Description

This is the base class that represents a resource reader.

A resource reader is an object whose job is to populate a TResources object with resources read from a stream in a specific format.

Typically, a TResources object invokes CheckMagic method of the resource reader when it's searching for a reader able to read a certain stream, and Load method when it wants the reader to read data from the stream.

Usually each resource reader registers itself with TResources class in the initialization section of the unit in which it is implemented: this way a TResources object can find it when probing a stream that is to be read.

Remark:

An object of this class should never be directly instantiated: use a descendant class instead.

Properties

Member Visibility Description
Description read only public The reader description
Extensions read only public The extensions of file types the reader is able to read

Methods

Member Visibility Description
AddNoTree protected Adds a resource without updating the internal tree
CallSubReaderLoad protected Calls another reader's Load method
CheckMagic protected Checks whether a stream is in a format the reader recognizes
Create public Creates a new reader object
GetDescription protected Returns the description of the reader
GetExtensions protected Returns the extensions the reader is registered for
GetTree protected Gets the internal resource tree of a TResources object
Load protected Loads resources from a stream
SetDataOffset protected Protected method to let a reader set a resource DataOffset property
SetDataSize protected Protected method to let a reader set a resource DataSize property
SetHeaderSize protected Protected method to let a reader set a resource HeaderSize property
SetRawData protected Protected method to let a reader set a resource RawData property

See also

Name Description
TResources A collection of resources
TAbstractResource Base abstract resource class
TAbstractResourceWriter Base abstract resource writer class
TResResourceReader .res resource reader
TCoffResourceReader COFF resource reader
TWinPEResourceReader PE image file resource reader
TElfResourceReader ELF resource reader
TExternalResourceReader External file resource reader
TDfmResourceReader DFM resource reader