RResourceArchive Class Reference

#include <baspi.h>

class RResourceArchive
Public Member Functions
RResourceArchive()
IMPORT_C voidClose()
IMPORT_C TBoolEnd()
IMPORT_C CResourceFile *NextL(HBufC *&)
IMPORT_C voidOpenL(RFs &, const TDesC &)
IMPORT_C voidOpenL(RFs &, const TDesC &, const TDesC &)
IMPORT_C voidReset()
IMPORT_C TUidType()

Detailed Description

Class for accessing the resource archive SPI file

Constructor & Destructor Documentation

RResourceArchive ( )

IMPORT_CRResourceArchive()

Constructs a default resource archive reader object.

Member Function Documentation

Close ( )

IMPORT_C voidClose()

Closes the resource archive(SPI) reader. This function is called after finishing reading all resources.

End ( )

IMPORT_C TBoolEnd()
Look ahead in the resource archive to check whether there is still any resource in the archive to be read
Pre-condition
RResourceArchive::OpenL must be called beforehand

Returns: boolean indicating whether the next resource exists

NextL ( HBufC *& )

IMPORT_C CResourceFile *NextL(HBufC *&aRscFileName)
Creates an instance of CResourceFile which corresponds to the next rsc file in the resource archive file(SPI)
leave
KErrNoMemory if there is not enough memory for the object
panic
If the file is corrupted - the method will panic in debug mode
ParameterDescription
aRscFileNamethe rsc file name buffer passed in by client

Returns: CResourceFile pointer of the next resource file in the SPI NULL if there is no more resource file to read from the SPI

OpenL ( RFs &, const TDesC & )

IMPORT_C voidOpenL(RFs &aFs,
const TDesC &aName
)
Open the resource archive reader
leave
The function leaves if the named file cannot be found or the header record at the beggining of the file cannot be read
panic
If the file is corrupted - the method will panic in debug mode.
ParameterDescription
aFsHandle to a file server session
aNameFile to open as a resource archive file

OpenL ( RFs &, const TDesC &, const TDesC & )

IMPORT_C voidOpenL(RFs &aFs,
const TDesC &aSpiPath,
const TDesC &aSpiName
)

Open the resource archive reader, this is usually used in composite rom drive situation where multiple independent rom images are mapped to a single rom drive and each rom image may consist 0..n spi files. Spi files in each rom image are labelled with the rom image id(example ecom-<id>-0.spi) with the id itself indicating the order of mounting/reading of the spi files. RResourceArchive will always mount/read the spi files in ascending order of the rom image id i.e. ecom-2-0.spi is mounted after ecom-1-0.spi and etc.

As a result of this mounting order,it is possible to replace a resource inside an spi with the resource with same name from a later mounted spi. It is also possible to specify in an spi file the hiding of resource in another spi file.(See example below)

In the presence of localised spi files(ecom-<id>-0.sNN where NN is language code) the spi files will be resolved internally based on existing language downgrade path.(See example below)

Example of use case:
z:\private\10009d8f\ecom-0-0.spi	(ROM IMAGE 0)
z:\private\10009d8f\ecom-0-1.s02	(ROM IMAGE 0)
z:\private\10009d8f\ecom-1-0.spi	(ROM IMAGE 1)
In this situation the function call to RResourceArchive should be:
RResourceArchive::OpenL(RFs,_L("z:\\private\\10009d8f\\"),_L("ecom"));

Example of multiple spi files and the visibility of the resource files
under two different language downgrade path(DGP):
-------------------------------------------------------------------------------
            |              |              |              |Resource  Visibility  
Ecom-1-0.spi| Ecom-1-0.s02 | Ecom-2-0.spi | Ecom-2-0.s02 |DGP(1)   | DGP(2-1)
-------------------------------------------------------------------------------
A.RSC		|	A.R02	   |   B.RSC	  |  Hide D.R02  |A.RSC(1) | A.R02(1)
B.RSC	    |	D.R02	   |			  |  C.R02       |B.RSC(2) | B.RSC(2)
C.RSC       |              |              |              |C.RSC(1) | C.R02(2)
-------------------------------------------------------------------------------
leave
KErrNotFound if there is no single file matching aSpiName in the path KErrCorrupt if the spi file is corrupted
panic
EBafPanicBadResourceFileFormat if the spi files that match the pattern do not share a common spi type.
ParameterDescription
aFsHandle to a file server session
aSpiPathfull path of the folder that contains the spi file
aSpiNamethe default spi name without any image id and extension

Reset ( )

IMPORT_C voidReset()

Reset the CResourceArchiveIter to start reading the first rsc file from the resourc archive(SPI) file

Type ( )

IMPORT_C TUidType()

Return the type of the resource archive(SPI) file being opened

Returns: the TUid type of the resource archive(SPI) file