Resource files may consist of comments, C++ pre-processor statements, and structure statements indicated by predefined keywords.
For more information on the format of resource files, see Resource file source format in the Symbian OS Library.
For a commented example of a resource file, see Resource management example: HelloWorldBasic.
A resource file has the following structure:
You can use either C (/* */
) or C++ (//
)
style comments.
For more information on the lexical conventions of resource files, see Lexical conventions in the Symbian OS Library.
The first non-comment statement in a resource must be the NAME
statement.
The syntax is as follows:
NAME name
where name
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.
For more information on the NAME
statement, see NAME statement in the Symbian OS Library.
The resource compiler supports a set of pre-processor statements, including:
#define
#include
#ifdef
#ifndef
#if
#else
#endif
For more information on the supported pre-processor statements, see C++ pre-processor statements in the Symbian OS Library.
Typically, resource files contain #includes
statements
for the following files:
appinfo.rh
avkon.rh
avkon.rsg
eikon.rh
These files are delivered with the S60 C++ SDK, and are located under
the /Epoc32/include
folder. They contain the structure
declarations for commonly used data structures in the S60 platform.
For more information, see the commented example file, Resource management example: HelloWorldBasic.
The RESOURCE keyword is used to declare a resource in a resource file. The syntax is as follows:
RESOURCE <STRUCT_NAME> | <resource_name> | { <resource-initialiser-list> }
where:
<STRUCT_NAME>
is the name of a declared
data structure in an included resource header file.
<STRUCT_NAME>
must
be in upper case.
resource_name
identifies the resource.
resource_name
must be in lower case.
resource-initialiser-list
contains the
values the members of the structure should be initialised with when the default
values should not be used
RESOURCE
statements may include resources defined
within other resource statements in the resource file. For example:
RESOURCE EIK_APP_INFO { menubar = r_name; }
uses a resource declared in a later statement to define its menu bar.
For more information on EIK_APP_INFO
, see EIK_APP_INFO in the Symbian OS Library.
Resource statements may also included nested resource structures. For example:
RESOURCE MENU_PANE r_name2 { items = { MENU_TITLE { menu_pane = r_name3; } }; }
For more on the MENU_PANE
resource see , Menu bar resource statements.
For more on structures, see the following items in the Symbian OS Library:
For more on resource statements, see:
RESOURCE statement in the Symbian OS Library.