CONE Resource Loader functionality is accessed via public methods on an RConeResourceLoader instance.
The RConeResourceLoader class implements the methods that make up the interface.
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.
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
All public interfaces of the subsystem are described here in more detail.
This class implements the whole subsystem.
A class constructor. Initializes an instance to the Closed state.
Parameters:
Type | Name | Description |
CCoeEnv& | aEnv | A reference to CONE. |
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:
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. |
Closes the opened resource file, if one is open. Does nothing if no file has been opened.
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.