diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-0C8389B8-91DF-58A1-A2A1-945A18CCBB10.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-0C8389B8-91DF-58A1-A2A1-945A18CCBB10.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,64 @@ + + + + + +Using +TLitC operatorsExplains how to use TLitC operations. +

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.

+
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); +... +
+
Const descriptor reference conversion operator operator const +TDesC&

The following code fragment shows the operator in use:

... +_LIT(KSomeData,"Some data"); +... +TPtrC x(KSomeData);
+
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); +...
+
Reference operator operator()

The following code +fragment shows the operator in use:

... +_LIT(KKeywordSelect,"select"); +if (KKeywordSelect().CompareF(token)<0) +...
+
\ No newline at end of file