Symbian3/SDK/Source/GUID-9620407B-0560-5D95-A862-5AE406C48983-GENID-1-8-1-6-1-1-4-1-7-1-7-1.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 9 59758314f811
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-9620407B-0560-5D95-A862-5AE406C48983-GENID-1-8-1-6-1-1-4-1-7-1-7-1" xml:lang="en"><title>String
       
    13 resource reader overview</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <section id="GUID-AF5A789B-6F00-42A9-86AE-CB972F97BE00-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-1"><title>Purpose</title> <p>String
       
    15 Resource Reader is part of the Symbian Text Utilities component. It reads
       
    16 strings from resource files without using the <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>CCoeEnv</apiname></xref> instance.
       
    17 This module is mainly for server usage, where there is a need for reading
       
    18 resources, but there is no <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>CCoeEnv</apiname></xref> instance
       
    19 present. </p> </section>
       
    20 <section id="GUID-F336660C-3F54-4B65-85AA-F6D557FE1DC2-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-2"><title>Architectural
       
    21 Relationships</title> <p>The key relationships between String Resource Reader
       
    22 and the components in its environment are shown below. It uses the <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>RResourceFile</apiname></xref> class to access
       
    23 the actual resource files. </p> <fig id="GUID-EF915116-AF30-58ED-A3AC-ED104AF22687-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-2-3">
       
    24 <title>              String Resource Reader environment            </title>
       
    25 <image href="GUID-B409C23A-F89E-5D30-B172-1F39C3F6A57F_d0e54890_href.png" placement="inline"/>
       
    26 </fig> <p>String Resource Reader consists of one class, <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>CTulStringResourceReader</apiname></xref>.
       
    27 String Resource Reader uses <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>BaflUtils</apiname></xref> and <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>RResourceFile.</apiname></xref>  </p> <fig id="GUID-497C1945-CD4F-5396-8B45-E809380A129C-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-2-5">
       
    28 <title>              Class diagram            </title>
       
    29 <image href="GUID-5DB0F7C7-6132-552B-BA42-B47D267D1143_d0e54913_href.png" placement="inline"/>
       
    30 </fig> </section>
       
    31 <section id="GUID-9595A884-0840-41D5-9448-E0297941DBA9-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-3"><title>Description</title> <p><b>Usage</b> </p> <p>String
       
    32 Resource Reader is designed to load strings from normal resource files. The
       
    33 interface can be accessed through the <codeph>tulstringresourcereader.h</codeph> file </p> <ul>
       
    34 <li id="GUID-9EEA6DC6-06BC-50B3-BB0B-9CCFCE21F852-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-3-4-1"><p>1. The user must first
       
    35 create an instance of the <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>CTulStringResourceReader</apiname></xref> class
       
    36 using one of the factory methods <codeph>NewL()</codeph> or <codeph>NewLC()</codeph>. </p> </li>
       
    37 <li id="GUID-B35D9F76-F4F8-5B43-8FEA-F044F2D63468-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-3-4-2"><p>2. The user can then
       
    38 call the exported <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>ReadResourceString()</apiname></xref> method
       
    39 to read resources </p> </li>
       
    40 <li id="GUID-51C7AB86-F420-584A-81A4-F652C7338714-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-3-4-3"><p>3. After usage the created
       
    41 instance must be deleted. </p> </li>
       
    42 </ul> <p>If the resource file that is given to a constructor is not found,
       
    43 the constructor leaves. The standard Symbian platform error codes are used. </p> <p><b>Example</b> </p> <p>An
       
    44 example of using the interface is given below: </p> <codeblock id="GUID-D484CAC5-5BA0-5666-B1DF-082E0A2A27BA-GENID-1-8-1-6-1-1-4-1-7-1-7-1-2-3-8" xml:space="preserve">#include &lt;tulstringresourcereader.h&gt;
       
    45 #include &lt;errorres.rsg&gt; // Resource to be read header 
       
    46 
       
    47 //...
       
    48 TFileName myFileName( _L("z:\\system\\data\\errorres.rsc") );
       
    49 TulTextResourceUtils* test = TulTextResourceUtils::NewL( myFileName );
       
    50 
       
    51 TPtrC buf;
       
    52 buf.Set(test-&gt; ReadResourceString(R_ERROR_RES_GENERAL)); 
       
    53    
       
    54 // Note that buf will only be valid as long as TulTextResourceUtils 
       
    55 // instance is alive and no new string is read by the same instance.
       
    56 // If you need to read multiple strings, make copies.
       
    57 
       
    58 delete test;
       
    59 </codeblock> <p>For more information on individual methods, see the reference
       
    60 API for <xref href="GUID-0AAAEFCF-ACFC-302C-81FA-388AACEE979C.dita"><apiname>CTulStringResourceReader</apiname></xref>. </p> </section>
       
    61 </conbody></concept>