Symbian3/SDK/Source/GUID-7A9FBE3A-D75E-59FC-9ACD-196670F0F9C8.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
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-7A9FBE3A-D75E-59FC-9ACD-196670F0F9C8" xml:lang="en"><title>Constant
literal text</title><shortdesc>Constant literals are objects containing constant literal text
which can be placed by the compiler into read-only memory. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>They are also referred to as <i>literal descriptors</i>. They are not true
descriptors, they are <i>not</i> derived from the descriptor classes, but
they do have conversion operators so that they can be passed to any function
which takes a <codeph>const TDesC16&amp;</codeph> type, a <codeph>const TDesC8&amp;</codeph> type
or a <codeph>const TDesC&amp;</codeph> type. </p>
<p>Constant literal descriptors are constructed using the macros: </p>
<ul>
<li id="GUID-9C594461-1222-525B-B335-354CD88B10E8"><p> <codeph>_LIT16</codeph>  </p> </li>
<li id="GUID-6B39451F-9F57-5B07-9092-6F4AFD0584F6"><p> <codeph>_LIT8</codeph>  </p> </li>
<li id="GUID-32945A96-0230-5BCF-8504-738DD5608D57"><p> <codeph>_LIT</codeph>  </p> </li>
</ul>
<p>The <codeph>_L16</codeph>, <codeph>_L8</codeph> and <codeph>_L</codeph> macros,
which perform a similar function, are retained for compatibility purposes,
but all production code that requires literal text should use literal descriptors. </p>
<section id="GUID-7CDEA4A3-7C16-4833-B048-2C08BDA04DA0"><title>_LIT16</title> <p>This macro constructs the 16 bit variant
constant literal descriptor for Unicode strings. The literal descriptor object
is an instance of a <codeph>TLitC16</codeph> class and the macro generates <codeph>const
static           TLitC16</codeph> in the C++ code. </p> </section>
<section id="GUID-A1FAD942-4009-43A2-B95B-FDB221656645"><title>_LIT8</title> <p>This macro constructs the 8 bit variant constant
literal descriptor for non-Unicode strings. The literal descriptor object
is an instance of a <codeph>TLitC8</codeph> class and the macro generates <codeph>const
static           TLitC8</codeph> in the C++ code. </p> </section>
<section id="GUID-285C1C21-C840-4A97-992B-F3F95D30F94B"><title>_LIT</title> <p>This macro constructs the build independent
type constant literal descriptor. The literal descriptor object is an instance
of a <codeph>TLitC</codeph> class and the macro generates <codeph>const static
          TLitC</codeph> in the C++ code. By using this type, the appropriate
variant, either 16 bit or 8 bit is selected at build time depending on whether
the <codeph>_UNICODE</codeph> macro has been defined or not. </p> </section>
</conbody></concept>