MDesCArray
mixin
classThe code fragments below show how the MDesCArray
mixin is used to:
return the number of descriptor elements in a descriptor array.
return a TPtrC
representing a specific
indexed descriptor element.
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);
..
}