Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <tulstringresourcereader.h>
Link against: etul.lib
This item is not part of the S60 5th Edition SDK

Class CTulStringResourceReader

class CTulStringResourceReader : public CBase;

Description

CTulStringResourceReader reads strings from resource without CCoeEnv. If resource file given to the constructor is not found, the constructor leaves. This module is mainly for server usage, where there is the need to read resources, but no CCoeEnv instance is present.

Usage:

#include <stringresourcereader.h>
#include <errorres.rsg> // Resource to be read header 

TFileName myFileName( _L("z:\\resource\\errorres.rsc") );
CTulStringResourceReader* test = CTulStringResourceReader::NewL( myFileName );

TPtrC buf;
buf.Set(test-> ReadResourceString(R_ERROR_RES_GENERAL)); 
  
// Note that buf will only be valid as long as CTulStringResourceReader 
// instance is alive and no new string is read by the same instance.
// If you need to read multiple strings, make copies.

delete test;

Derivation

Members

Defined in CTulStringResourceReader:

Inherited from CBase:


Construction and destruction


NewL(TFileName &)

IMPORT_C static CTulStringResourceReader* NewL(TFileName &aResFile);

Description

Creates a new String Resource Reader object.

Parameters

TBuf &aResFile

The resource file from which the string(s) are to be read.

Return value

CTulStringResourceReader *

a pointer to an new instance of CTulStringResourceReader class.

Leave codes

KErrNone,

if successful; otherwise one of the other system-wide error codes.


NewLC(TFileName &)

IMPORT_C static CTulStringResourceReader* NewLC(TFileName &aResFile);

Description

Creates a new String Resource Reader object, and puts a pointer to it onto the cleanup stack.

Parameters

TBuf &aResFile

The resource file from which the string(s) are to be read.

Return value

CTulStringResourceReader *

a pointer to an new instance of CTulStringResourceReader class.

Leave codes

KErrNone,

if successful; otherwise one of the other system-wide error codes.


NewL(TFileName &,RFs &)

IMPORT_C static CTulStringResourceReader* NewL(TFileName &aResFile, RFs &aFs);

Description

Creates a new String Resource Reader object.

Parameters

TBuf &aResFile

The resource file from which the string(s) are to be read.

RFs &aFs

A handle to a shared file server session.

Return value

CTulStringResourceReader *

a pointer to an new instance of CTulStringResourceReader class.

Leave codes

KErrNone,

if successful; otherwise one of the other system-wide error codes.


NewLC(TFileName &,RFs &)

IMPORT_C static CTulStringResourceReader* NewLC(TFileName &aResFile, RFs &aFs);

Description

Creates a new String Resource Reader object, and puts a pointer to it onto the cleanup stack.

Parameters

TBuf &aResFile

The resource file from which the string(s) are to be read.

RFs &aFs

A handle to a shared file server session.

Return value

CTulStringResourceReader *

a pointer to an new instance of CTulStringResourceReader class.

Leave codes

KErrNone,

if successful; otherwise one of the other system-wide error codes.

[Top]


Member functions


ReadResourceString(TInt)

IMPORT_C const TDesC& ReadResourceString(TInt aResourceId);

Description

ReadResourceString: returns the string that match with the resource id. No lenght limitations are imposed on read string.

Parameters

TInt aResourceId

Return value

const TDesC16 &

String buffer if the string associated with the given resource Id is found, else returns empty descriptor.

Panic codes

aResourceId

If the alignment of Unicode strings within the resource is incorrect,