API published in: S60 2nd Ed
Link against: commonengine.lib
Required Capabilities
None
#include <coneresloader.h>
The actual reading of resources from an opened resource file is done using various CCoeEnv provided resource-reading methods. Cone Resource Loader API consist of the RConeResourceLoader class.
Only one resource at a time may be open by one RConeResourceLoader instance. You can use several RConeResourceLoader instances for accessing several resources simultaneously or use one instance and close the previous resource before opening a new one.
The implementation uses BaflUtils::NearestLanguageFile to search for a localised resource in proper search order.
Usage example:
#include <ConeResLoader.h> // 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
Public Member Functions |
|
IMPORT_C | RConeResourceLoader (CCoeEnv &aEnv) |
Constructor. |
|
IMPORT_C TInt | Open (TFileName &aFileName) |
Opens the resource file for reading. |
|
IMPORT_C void | OpenL (TFileName &aFileName) |
Opens the resource file for reading. |
|
IMPORT_C void | Close () |
Closes the opened resource file, if one is open. |
|
Constructor.
|
|
Closes the opened resource file, if one is open. Does nothing if no file has been opened. New resource file may be opened after the previous has been closed. Always remember to close the resource when finished using it. |
|
Opens the resource file for reading. Only one resource may be open at a time. 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.
|
|
Opens the resource file for reading. Only one resource may be open at a time. Leaves if this instance already has a file open. The implementation uses BaflUtils::NearestLanguageFile to search for a localized resource file in proper search order.
|