Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to use the MDesCArray mixin class

The code fragments below show how the MDesCArray mixin is used to:

The code uses the build independent forms but the code is equally valid when using the explicit 8 bit or16 bit variants.

In this case a CDesCArrayFlat, a CDesCArraySeg and a CPtrCArray, can all be handled by the single function foo().

 ...
 CDesCArrayFlat* descflat = new (ELeave) CDesCArrayFlat(4);
 CDesCArraySeg*  descseg  = new (ELeave) CDesCArraySeg(4);
 CPtrCArray*     ptrc     = new (ELeave) CPtrCArray(4);
 ...
 ... // add descriptor elements to all three arrays
 ...
 foo(descflat);
 foo(descseg);
 foo(ptrc);
 ...
void foo(MDesCArray* anArray)
 {
 ..
 TInt  somenumber = anArray->MdcaCount();
 TPtrC someptrc   = anArray->MdcaPoint(someindexvalue);
 ..
 }