Symbian3/SDK/Source/GUID-651C2913-2AB9-5873-B296-5C4233967F21.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-651C2913-2AB9-5873-B296-5C4233967F21" xml:lang="en"><title>CONE
resource loader overview</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-57F77D80-D411-48CE-9C2F-2E274027D791"><title>Purpose</title> <p>The CONE Resource Loader utility is part
of the Symbian CONE component, and it offers methods for opening and closing
resource files. The actual reading of resources from an opened resource file
is done using various <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>CCoeEnv</apiname></xref> provided
resource-reading methods. </p> </section>
<section id="GUID-691C3034-6DBE-4C5A-8F6A-E18C805EA4EE"><title>Architectural Relationships</title> <p>This utility is implemented
as a single class, <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref>.
Access to the <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>CCoeEnv</apiname></xref> instance
is required in order to use this utility. </p> <p>CONE Resource Loader can
be accessed through the <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> class
that is defined in the header <codeph>CoeUtils.h</codeph>. The actual component
is linked to the <codeph>cone.dll</codeph> library. </p> </section>
<section id="GUID-5B6C86F8-C914-4329-891A-20088D589EC3"><title>Description</title> <p><b>Usage</b> </p> <p>CONE Resource
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
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
the resource file. After the resource file is no longer needed, it must be
closed. </p> <p>A single instance of <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> can
only have a maximum of one resource file open at any time. If multiple simultaneously
open files are required, instantiate a separate <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref> for
each required file. </p> <p><b>Example</b> </p> <p>The following example shows
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" xml:space="preserve">#include &lt;CoeUtils.h&gt;

// … Other code …

// Get CCoeEnv instance
CEikonEnv* eikEnv = CEikonEnv::Static();

// Initialize loader
RCoeResourceLoader rLoader(eikEnv);

// Open resource file
_LIT( KSampleResourceFileName, "Z:\\System\\Apps\\sample\\sample.rsc" );
TFileName fileName(KSampleResourceFileName);
rLoader.OpenL(fileName);

// Push resource loader to cleanup stack, so that it will always be properly 
// closed when popped.
CleanupClosePushL(rLoader);

// Read a resource   
iSomeArray = eikEnv-&gt;ReadDesC16ArrayResourceL(R_SOME_RESOURCE);

// Pop and destroy rLoader from stack. 
// This also calls close on rLoader since CleanupClosePushL was used.
CleanupStack::PopAndDestroy(); // rLoader
</codeblock> <p>For more information on individual methods, please see the
reference API for <xref href="GUID-D2A3BE13-6CD9-3418-AA81-4466B76CF844.dita"><apiname>RCoeResourceLoader</apiname></xref>. </p> </section>
</conbody></concept>