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.
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 consists of one class, CTulStringResourceReader . String Resource Reader uses BaflUtils and RResourceFile.
Usage
String Resource Reader is designed to load strings from normal resource files. The interface can be accessed through the tulstringresourcereader.h file
1. The user must first create an instance of the CTulStringResourceReader class using one of the factory methods NewL() or NewLC() .
2. The user can then call the exported ReadResourceString() method to read resources
3. After usage the created instance must be deleted.
If the resource file that is given to a constructor is not found, the constructor leaves. The standard Symbian platform 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, see the reference API for CTulStringResourceReader .
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.