Symbian3/SDK/Source/GUID-651C2913-2AB9-5873-B296-5C4233967F21-GENID-1-8-1-6-1-1-4-1-6-1-5-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-651C2913-2AB9-5873-B296-5C4233967F21-GENID-1-8-1-6-1-1-4-1-6-1-5-1" xml:lang="en"><title>CONE
       
    13 resource loader overview</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <section id="GUID-57F77D80-D411-48CE-9C2F-2E274027D791-GENID-1-8-1-6-1-1-4-1-6-1-5-1-2-1"><title>Purpose</title> <p>The CONE Resource Loader utility is part
       
    15 of the Symbian CONE component, and it offers methods for opening and closing
       
    16 resource files. The actual reading of resources from an opened resource file
       
    17 is done using various <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>CCoeEnv</apiname></xref> provided
       
    18 resource-reading methods. </p> </section>
       
    19 <section id="GUID-691C3034-6DBE-4C5A-8F6A-E18C805EA4EE-GENID-1-8-1-6-1-1-4-1-6-1-5-1-2-2"><title>Architectural Relationships</title> <p>This utility is implemented
       
    20 as a single class, <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref>.
       
    21 Access to the <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>CCoeEnv</apiname></xref> instance
       
    22 is required in order to use this utility. </p> <p>CONE Resource Loader can
       
    23 be accessed through the <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> class
       
    24 that is defined in the header <codeph>CoeUtils.h</codeph>. The actual component
       
    25 is linked to the <codeph>cone.dll</codeph> library. </p> </section>
       
    26 <section id="GUID-5B6C86F8-C914-4329-891A-20088D589EC3-GENID-1-8-1-6-1-1-4-1-6-1-5-1-2-3"><title>Description</title> <p><b>Usage</b> </p> <p>CONE Resource
       
    27 Loader functionality can be accessed via public methods on an <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> instance. </p> <p>To use, an instance of <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> is
       
    28 first created. Then calling either one of the open methods of <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> opens
       
    29 the resource file. After the resource file is no longer needed, it must be
       
    30 closed. </p> <p>A single instance of <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> can
       
    31 only have a maximum of one resource file open at any time. If multiple simultaneously
       
    32 open files are required, instantiate a separate <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> for
       
    33 each required file. </p> <p><b>Example</b> </p> <p>The following example shows
       
    34 how to use the <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> class: </p> <codeblock id="GUID-8F442DC2-E73B-537A-9A32-9C61280B8FF6-GENID-1-8-1-6-1-1-4-1-6-1-5-1-2-3-8" xml:space="preserve">#include &lt;CoeUtils.h&gt;
       
    35 
       
    36 // … Other code …
       
    37 
       
    38 // Get CCoeEnv instance
       
    39 CEikonEnv* eikEnv = CEikonEnv::Static();
       
    40 
       
    41 // Initialize loader
       
    42 RCoeResourceLoader rLoader(eikEnv);
       
    43 
       
    44 // Open resource file
       
    45 _LIT( KSampleResourceFileName, "Z:\\System\\Apps\\sample\\sample.rsc" );
       
    46 TFileName fileName(KSampleResourceFileName);
       
    47 rLoader.OpenL(fileName);
       
    48 
       
    49 // Push resource loader to cleanup stack, so that it will always be properly 
       
    50 // closed when popped.
       
    51 CleanupClosePushL(rLoader);
       
    52 
       
    53 // Read a resource   
       
    54 iSomeArray = eikEnv-&gt;ReadDesC16ArrayResourceL(R_SOME_RESOURCE);
       
    55 
       
    56 // Pop and destroy rLoader from stack. 
       
    57 // This also calls close on rLoader since CleanupClosePushL was used.
       
    58 CleanupStack::PopAndDestroy(); // rLoader
       
    59 </codeblock> <p>For more information on individual methods, please see the
       
    60 reference API for <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref>. </p> </section>
       
    61 </conbody></concept>