Location:
barsc.h
Link against: bafl.lib
RResourceFile
Supported from 5.0
Accesses a resource file and reads the resource data into a buffer.
Interpretation of the data is achieved using the
TResourceReader
class.
Defined in RResourceFile
:
AllocReadL()
, AllocReadLC()
, Close()
, ConfirmSignatureL()
, Offset()
, OpenL()
, OwnsResourceId()
, RResourceFile()
, ReadL()
, SignatureL()
void OpenL(RFs& aFs,const TDesC& aName);
Opens the resource file reader.
The resource file reader must be opened before reading resources or checking the signature of the resource file.
If the function is successful, a cleanup item is placed onto the cleanup stack for the resource file; if a leave occurs, the resource file is closed.
|
|
void Close();
Closes the resource file reader.
This function is called after finishing reading all resources.
HBufC8* AllocReadL(TInt aResourceId) const;
Reads a resource into a heap descriptor and returns a pointer to that descriptor.
A heap descriptor of appropriate length is allocated for the resource. Ownership of the heap descriptor passes to the caller who must destroy it when it is no longer needed.
The search for the resource uses the following algorithm:
A resource id in the range 1 to 4095 is looked up in this resource file. The function leaves if there is no matching resource.
If the resource id is greater than 4095, then the most significant 20 bits of the resource id is treated as an offset and the least significant 12 bits is treated as the real resource id. If the offset matches the offset value defined for this file, then the resource is looked up in this resource file using the real resource id (i.e. the least significant 12 bits). If the offset does not match, then the function leaves.
Note, do not call this function until a call to
ConfirmSignatureL()
has completed
successfully.
|
|
HBufC8* AllocReadLC(TInt aResourceId) const;
Reads a resource into a heap descriptor, returns a pointer to that descriptor and pushes the pointer onto the cleanup stack.
A heap descriptor of appropriate length is allocated for the resource. Ownership of the heap descriptor passes to the caller who must destroy it and pop its pointer off the cleanup stack when it is no longer needed.
The search for the resource uses the following algorithm:
A resource id in the range 1 to 4095 is looked up in this resource file. The function leaves if there is no matching resource.
If the resource id is greater than 4095, then the most significant 20 bits of the resource id is treated as an offset and the least significant 12 bits is treated as the real resource id. If the offset matches the offset value defined for this file, then the resource is looked up in this resource file using the real resource id (i.e. the least significant 12 bits). If the offset does not match, then the function leaves.
Note, do not call this function until a call to
ConfirmSignatureL()
has completed
successfully.
|
|
void ReadL(TDes8& aDes,TInt aResourceId) const;
Reads a resource specified by resource id into the specified descriptor.
The descriptor must be long enough to contain the entire resource
The search for the resource uses the following algorithm:
A resource id in the range 1 to 4095 is looked up in this resource file. The function leaves if there is no matching resource.
If the resource id is greater than 4095, then the most significant 20 bits of the resource id is treated as an offset and the least significant 12 bits is treated as the real resource id. If the offset matches the offset value defined for this file, then the resource is looked up in this resource file using the real resource id (i.e. the least significant 12 bits). If the offset does not match, then the function leaves.
Note, do not call this function until a call to
ConfirmSignatureL()
has completed
successfully.
|
TInt SignatureL() const;
Returns this resource file's version number.
The function assumes that the first resource in the file consists of two 32-bit integers. The first integer contains the version number.
|
void ConfirmSignatureL(TInt /*aSignature*/);
Initialises the offset value from the first resource.
The function assumes that the first resource in the file consists of two 32-bit integers. The first integer contains the version number and the second is a self-referencing link whose value is the offset for the resources in the file, plus 1.
This function must be called before calling Offset()
,
AllocReadL()
, AllocReadLC()
or
ReadL()
.
|
TInt Offset() const;
Returns the offset value defined for this resource file.
This function must not be called until a call to
ConfirmSignatureL()
has completed successfully, otherwise the
value returned by this function may be meaningless.
|
TBool OwnsResourceId(TInt aResourceId) const;
Tests whether the resource file owns the specified resource id.
The resource file owns the resource id if the most significant 20 bits of
the resource id are zero or match the offset value as returned from a call to
the Offset()
member function.
|
|