CONE Resource Loader API: Technical Specification

Type of the Interface

CONE Resource Loader functionality is accessed via public methods on an RConeResourceLoader instance.

Interface Class Structure

The RConeResourceLoader class implements the methods that make up the interface.

Usage

An instance of RConeResourceLoader is first created. Then calling either of the open methods opens the resource file. After the resource file is no longer needed, it must be closed.

A single instance of RConeResourceLoader can only have a maximum of one resource file open at any time. If multiple simultaneously open files are required, instantiate a separate RConeResourceLoader for each required file.

Example

The following example shows how to use the RConeResourceLoader class.

#include <coneresloader.h>
// … Snip …
// Get CCoeEnv instance
CEikonEnv* eikEnv = CEikonEnv::Static();
// Initialize loader
RConeResourceLoader rLoader(eikEnv);
// Open resource file
_LIT( KSampleResourceFileName, "Z:\\System\\Apps\\sample\\sample.rsc" );
TFileName fileName(KSampleResourceFileName);
rLoader.OpenL(fileName);
// Push resource loader to cleanup stack, so that it will always be properly 
// closed when popped.
CleanupClosePushL(rLoader);
// Read a resource   
iSomeArray = eikEnv->ReadDesC16ArrayResourceL(R_SOME_RESOURCE);
// Pop and destroy rLoader from stack. 
// This also calls close on rLoader since CleanupClosePushL was used.
CleanupStack::PopAndDestroy(); // rLoader

Detailed Description

All public interfaces of the subsystem are described here in more detail.

ConeResourceLoader

This class implements the whole subsystem.

RConeResourceLoader(CCoeEnv& aEnv)

A class constructor. Initializes an instance to the Closed state.

Parameters:

Type Name Description
CCoeEnv& aEnv A reference to CONE.
TInt Open(TFileName& aFileName)

Opens the resource file for reading. Panics if this instance already has a file open.

The implementation uses BaflUtils::NearestLanguageFile to search for a localized resource file in proper search order.

Parameters:

Type Name Description
TFileName& aFileName

The resource file name to open. This parameter value is changed to the best matching language file found.

The drive letter is required in eth filename.

Return value:

A standard Symbian OS error code is returned:

void OpenL(TFileName& aFileName)

Opens the resource file for reading. Leaves if this instance already has a file open.

Parameters:

Type Name Description
TFileName& aFileName

The resource file name to open. This parameter value is changed to the best matching language file found.

The drive letter is required in the filename.

void Close()

Closes the opened resource file, if one is open. Does nothing if no file has been opened.

Code Architecture

CONE Resource Loader can be accessed through the RConeResourceLoader class that is defined in the header coneresloader.H. The actual component is linked to the COMMONENGINE.DLL library.


Copyright © Nokia Corporation 2001-2008
Back to top