Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


String Resource Reader Overview

[Top]


Purpose

String Resource Reader is part of the Symbian Text Utilities component. It reads strings from resource files without using the CCoeEnv instance. This module is mainly for server usage, where there is a need for reading resources, but there is no CCoeEnv instance present.

[Top]


Architectural Relationships

The key relationships between String Resource Reader and the components in its environment are shown below. It uses the RResourceFile class to access the actual resource files.

String Resource Reader environment


String Resource Reader environment

String Resource Reader consists of one class, CTulStringResourceReader. String Resource Reader uses BaflUtils and RResourceFile.

Class diagram


Class diagram

[Top]


Description


Usage

String Resource Reader is designed to load strings from normal resource files. The interface can be accessed through the tulstringresourcereader.h file

If the resource file that is given to a constructor is not found, the constructor leaves. The standard Symbian OS error codes are used.


Example

An example of using the interface is given below:

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

//...
TFileName myFileName( _L("z:\\system\\data\\errorres.rsc") );
TulTextResourceUtils* test = TulTextResourceUtils::NewL( myFileName );

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

delete test;

For more information on individual methods, please see the reference API for CTulStringResourceReader.