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 CCoeEnv
provided
resource-reading methods.
This utility is implemented
as a single class, RCoeResourceLoader
.
Access to the CCoeEnv
instance
is required in order to use this utility.
CONE Resource Loader can
be accessed through the RCoeResourceLoader
class
that is defined in the header CoeUtils.h
. The actual component
is linked to the cone.dll
library.
Usage
CONE Resource
Loader functionality can be accessed via public methods on an RCoeResourceLoader
instance.
To use, an instance of RCoeResourceLoader
is
first created. Then calling either one of the open methods of RCoeResourceLoader
opens
the resource file. After the resource file is no longer needed, it must be
closed.
A single instance of RCoeResourceLoader
can
only have a maximum of one resource file open at any time. If multiple simultaneously
open files are required, instantiate a separate RCoeResourceLoader
for
each required file.
Example
The following example shows
how to use the 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 RCoeResourceLoader
.