Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Using TLitC operators

The TLitC class offers four operators, two of which are conversion operators.

The conversion operators are invoked by the compiler when a TLitC<TInt> type is passed to a function which takes the following argument types:

The other two operators return:

The following code fragments show the situations where the operators are called on a TLitC. The fragments are similar for both TLitC8 and TLitC16.

[Top]


Reference by value conversion operator operator const __TRefDesC()

The following code fragment shows the operator in use:

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

[Top]


Const descriptor reference conversion operator operator const TDesC&

The following code fragment shows the operator in use:

...
_LIT(KSomeData,"Some data");
...
TPtrC x(KSomeData);

[Top]


Address of operator operator&()

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);
...

[Top]


Reference operator operator()

The following code fragment shows the operator in use:

...
_LIT(KKeywordSelect,"select");
if (KKeywordSelect().CompareF(token)<0)
...