RCoeResourceLoader Class Reference

class RCoeResourceLoader

Class encapsulates methods for opening and closing localised resource files in the CONE environment. The actual reading of resources from an opened resource file is done using various CCoeEnv provided resource-reading methods. The Cone Resource Loader API consists of the RCoeResourceLoader class.

Only one resource at a time may be opened by one RCoeResourceLoader instance. You can use several RCoeResourceLoader 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 <coeutils.h>  

// Get CCoeEnv instance
CEikonEnv* eikEnv = CEikonEnv::Static();
// Initialize loader
RCoeResourceLoader rLoader(eikEnv);

// Push resource loader to cleanup stack, so that it will always be properly 
// closed when popped.
CleanupClosePushL(rLoader);

// Open resource file
_LIT( KSampleResourceFileName, "Z:\\System\\Apps\\sample\\sample.rsc" );
TFileName fileName(KSampleResourceFileName);
rLoader.OpenL(fileName);

// Read a resource   
iSomeArray = eikEnv->ReadDesC16ArrayResourceL(R_SOME_RESOURCE);

// Pop and destroy rLoader from stack. 
// This also calls the rLoader close function after CleanupClosePushL is used.
CleanupStack::PopAndDestroy(); // rLoader
       

Constructor & Destructor Documentation

RCoeResourceLoader(CCoeEnv &)

IMPORT_C RCoeResourceLoader ( CCoeEnv & aEnv )

Parameters

CCoeEnv & aEnv

RCoeResourceLoader()

RCoeResourceLoader ( ) [private]

RCoeResourceLoader(const RCoeResourceLoader &)

RCoeResourceLoader ( const RCoeResourceLoader & ) [private]

Parameters

const RCoeResourceLoader &

Member Functions Documentation

Close()

IMPORT_C void Close ( )

Open(TFileName &)

IMPORT_C TInt Open ( TFileName & aFileName )

Parameters

TFileName & aFileName

OpenL(TFileName &)

IMPORT_C void OpenL ( TFileName & aFileName )

Parameters

TFileName & aFileName

operator=(const RCoeResourceLoader &)

RCoeResourceLoader & operator= ( const RCoeResourceLoader & ) [private]

Parameters

const RCoeResourceLoader &

Member Data Documentation

CCoeEnv & iEnv

CCoeEnv & iEnv [private]

TInt iResourceFileOffset

TInt iResourceFileOffset [private]