EPOC   SDK Home Glossary Indexes Previous Next Up

TLitC class


Contents


TLitC<TInt S> class — Build independent constant literal

Section Contents


Overview

Derivation

Not applicable

Defined in

e32std.h

Link against

euser.lib

Description

A TLitC<TInt S> object contains literal text. Such an object is constructed by coding an _LIT macro.

This class is build independent; i.e. for a non-Unicode build, an 8 bit build variant is generated; for a non Unicode build, a 16 bit build variant is generated.


Construction

The class has no explicit constructors. See the _LIT macro definition.


Operators


operator const TDesC& — Conversion operator

operator const TDesC& () const;

When used

This conversion operator is invoked by the compiler when a TLitC<TInt S> type is passed to a function which is prototyped to take a const TDesC& type.


operator const TRefByValue<const TDesC> — Conversion operator

operator const TRefByValue<const TDesC>() const;

When used

This conversion operator is invoked by the compiler when a TLitC<TInt S> type is passed to a function which is prototyped to take a const TRefByValue<const TDesC> type.

Example
    ...
    TBuf<256> x;
    ...
    _LIT(KTxtFormat,"There are %d cm in a metre");
    x.Format(KTxtFormat,100);
    ...

operator& — Address of operator

const TDesC* operator&();

Description

Use this operator to return a const TDesC type pointer

Return value

const TDesC*

A descriptor type pointer to this literal.

Example

The following code fragment shows the operator in use:

    class CX...
          {
          void Foo(const TDesC* aDesC);
          };
    
    ...
    _LIT(KLiteral,"some text");
    ...
    CX* anx;
    ...
    anx->Foo(&KLiteral);
    ...

operator() — Reference operator

const TDesC& operator()();

Description

Use this operator to return a const TDesC type reference.

Return value

const TDesC&

A descriptor type reference to this literal

Example

The following code fragment shows the operator in use:

    ...
    _LIT(KKeywordSelect,"select");
    if (KKeywordSelect().CompareF(token)<0)
    ...
EPOC       SDK Home Glossary Indexes Previous Next Up