Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using _LIT macros

To create a build independent literal use the macro as shown below:

_LIT(KSomeBuildIndependentLitText,"qwerty"); //create literal
iEikonEnv->InfoMsg(KSomeBuildIndependentLitText);
 //use the literal in an info message

This generates the code

const static TLitC<7> KSomeBuildIndependentLitText;
iEikonEnv->InfoMsg(KSomeBuildIndependentLitText);

The constants can be used wherever _L("qwerty") was used prior to EPOC release 5. E.g. the code fragment above would have been written as:

iEikonEnv->InfoMsg(_L("qwerty"));

The behaviour is the same when using 8 and 16 bit descriptors

16 bit literal:

_LIT16(KSomeLIT16Text,"qwerty");

generates

const static TLitC16<7> KSomeLIT16Text;

8 bit literal:

_LIT8(KSomeLIT8Text,"qwerty");

generates

const static TLitC8<7> KSomeLIT8Text;