CONE resource loader overview

Purpose

The CONE Resource Loader utility is part of the Symbian CONE component, and it offers methods for opening and closing resource files. The actual reading of resources from an opened resource file is done using various [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]CCoeEnv provided resource-reading methods.

Architectural Relationships

This utility is implemented as a single class, [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader. Access to the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]CCoeEnv instance is required in order to use this utility.

CONE Resource Loader can be accessed through the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader class that is defined in the header CoeUtils.h. The actual component is linked to the cone.dll library.

Description

Usage

CONE Resource Loader functionality can be accessed via public methods on an [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader instance.

To use, an instance of [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader is first created. Then calling either one of the open methods of [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader opens the resource file. After the resource file is no longer needed, it must be closed.

A single instance of [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader can only have a maximum of one resource file open at any time. If multiple simultaneously open files are required, instantiate a separate [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader for each required file.

Example

The following example shows how to use the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader class:

#include <CoeUtils.h>

// … Other code …

// Get CCoeEnv instance
CEikonEnv* eikEnv = CEikonEnv::Static();

// Initialize loader
RCoeResourceLoader 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

For more information on individual methods, please see the reference API for [[[ERROR: [NOKX000E] Unable to find definition for key reference 'RCoeResourceLoader']]]RCoeResourceLoader.