Symbian3/SDK/Source/GUID-EC49B54F-7724-433B-BD7F-201DE3B7DAA6.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-EC49B54F-7724-433B-BD7F-201DE3B7DAA6" xml:lang="en"><title>Resource file structure</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p><xref href="GUID-5F749184-C804-41FC-BA81-038783BDC967.dita">Resource</xref> files may consist of comments, C++ pre-processor statements, and
structure statements indicated by predefined keywords.</p>
<p>For more information on the format of resource files, see <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/index.html#DevTools%2dref%2erss" format="application/java-archive">Resource file source format</xref>.</p>
<p>For a commented example of a resource file, see <xref href="GUID-411ACFE6-0324-4330-ABCD-97A925759A3C.dita">Resource
management example: HelloWorldBasic</xref>.</p>
<p>A resource file has the following structure:</p>
<section id="GUID-727A33A2-4324-4834-88B2-0D461C2A1732"><title>Comments</title>
<p>You can use either C (<parmname>/* */</parmname>) or C++ (<parmname>//</parmname>) style comments.</p>
<p>For more information on the lexical conventions of resource
files, see  <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format.conventions.html#DevTools%2dref%2erss%2e2" format="application/java-archive">Lexical conventions</xref>.</p>
</section>
<section id="GUID-D8ED42A3-6BB7-4A7E-A0AB-3932D4366AAE"><title>NAME
statements</title>
<p>The first non-comment statement in a resource must be the <parmname>NAME</parmname> statement. The syntax is as follows:</p>
<codeblock id="GUID-C90E900E-4539-47BB-B51B-0F600B0DE86E" xml:space="preserve">NAME name</codeblock>
<p>where <parmname>name</parmname> is a 4 letter ID that is unique
in the application. This ID is used to differentiate and access resource
files when an application uses multiple resource files.</p>
<p>For more information on the <parmname>NAME</parmname> statement,
see <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format-NAME.html#DevTools%2dref%2erss%2dname" format="application/java-archive">NAME statement</xref>. </p>
</section>
<section id="GUID-F27B120A-3B53-4B8A-828C-302B95E6E520"><title>C++ pre-processor
statements</title>
<p>The resource compiler supports a set of pre-processor statements,
including:</p>
<ul>
<li><p><parmname>#define</parmname></p></li>
<li><p><parmname>#include</parmname></p></li>
<li><p><parmname>#ifdef</parmname></p></li>
<li><p><parmname>#ifndef</parmname></p></li>
<li><p><parmname>#if</parmname></p></li>
<li><p><parmname>#else</parmname></p></li>
<li><p><parmname>#endif</parmname></p></li>
</ul>
<p>For more information on the supported pre-processor statements,
see  <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format.preprocess.html#DevTools%2dref%2erss%2e3" format="application/java-archive">C++ pre-processor statements</xref>.</p>
<p>Typically, resource files contain <parmname>#includes</parmname> statements for the following files:</p>
<ul>
<li><p><parmname>appinfo.rh</parmname></p></li>
<li><p><parmname>avkon.rh</parmname></p></li>
<li><p><parmname>avkon.rsg</parmname></p></li>
<li><p><parmname>eikon.rh</parmname></p></li>
</ul>
<p>These files are located under the <parmname>/Epoc32/include</parmname> folder. They contain the structure declarations for commonly used
data structures in the Symbian platform.</p>

</section>
<section id="GUID-9D5B35E3-21F3-4E22-B03B-8C9E6E1027C9"><title>RESOURCE
statements syntax</title>
<p>The RESOURCE keyword is used to declare a resource in a resource
file. The syntax is as follows:</p>
<codeblock id="GUID-88C7579F-4917-488F-8834-0579A3150D85" xml:space="preserve">RESOURCE &lt;STRUCT_NAME&gt; | &lt;resource_name&gt; |
{
&lt;resource-initialiser-list&gt;
}</codeblock>
<p>where:</p>
<ul>
<li><p><parmname>&lt;STRUCT_NAME&gt;</parmname> is the name
of a declared data structure in an included resource header file.</p>
<p><parmname>&lt;STRUCT_NAME&gt;</parmname> must be in upper case.</p>
</li>
<li><p><parmname>resource_name</parmname> identifies the
resource .</p><p><parmname>resource_name</parmname> must be
in lower case.</p></li>
<li><p><parmname>resource-initialiser-list</parmname> contains
the values the members of the structure should be initialized with
when the default values should not be used.</p></li>
</ul>
<p><parmname>RESOURCE</parmname> statements may include resources
defined within other resource statements in the resource file. For
example:</p>
<codeblock id="GUID-7F4CC81B-A596-4341-ACF2-61FEF518A9FF" xml:space="preserve">RESOURCE EIK_APP_INFO
    {
    menubar = r_name;
    }</codeblock>
<p>uses a resource declared in a later statement to define its
menu bar. For more information, see<xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-resource/uikon/EIK_APP_INFO.html#EIK_APP_INFO" format="application/java-archive"><parmname>EIK_APP_INFO</parmname></xref>.</p>
<p>Resource statements may also included nested resource structures.
For example:</p>
<codeblock id="GUID-4A787831-2658-4BC0-939A-1346C3C05FE4" xml:space="preserve">RESOURCE MENU_PANE r_name2
    {
    items =
        {
         MENU_TITLE 
             {
	             menu_pane = r_name3;
	             }
         };
    }</codeblock>
<p>For more information on the <parmname>MENU_PANE</parmname> resource
see ,  <xref href="GUID-E849C798-07A0-47B3-BDBF-203325062FBD.dita">Menu
bar resource statements</xref>.</p>
<p>For more information on structures, see:</p>
<ul>
<li><p><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format.struct.html#DevTools%2dref%2erss%2dstruct" format="application/java-archive">STRUCT statement</xref></p></li>
<li><p><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format.struct-member.html#DevTools%2dref%2erss%2ddefine%2dmember" format="application/java-archive">STRUCT member types</xref></p></li>
<li><p><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format.arrays.html#DevTools%2dref%2erss%2darray" format="application/java-archive">Arrays within structs</xref></p></li>
</ul>
<p>For more on resource statements, see:</p>
<ul>
<li><p><xref href="GUID-23A60DE7-B72D-41BD-9F1E-882D31A7E3C7.dita">Required resource file statements</xref></p></li>
<li><p><xref href="GUID-2C74E932-B1CA-434B-AF96-66D52D689620.dita">Optional resource file statements</xref></p></li>
<li><p><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/DevTools-ref/ResourceFileFormat/Tool_Ref_RSS-file-format.resource.html#DevTools%2dref%2erss%2dresource" format="application/java-archive">RESOURCE statement</xref>.</p></li>
</ul>
</section>
</conbody></concept>