Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Descriptor Arrays Overview


Purpose

Provides specialised dynamic arrays for descriptors. Elements can be added to the array regardless of the particular type of descriptor.

[Top]


Architectural relationships

Descriptor arrays build on the behaviour supplied by the Dynamic Arrays API and provides normal array operations for inserting, appending, deleting, and accessing elements.

[Top]


Description

The API has three key concepts: descriptor array protocol (MDesC16Array), general descriptor array (CDesC16Array), and pointer descriptor array (CPtrC16Array).

Note that all array classes are provided in variants for narrow and wide characters (e.g. CDesC8Array and CDesC16Array). These concrete types can be used directly, but it is usual to use typedefs (e.g. CDesCArray) that are conditionally defined to map to the wide or narrow depending on the build. Only the conditional types are used below.


Descriptor array protocol

This defines an interface implemented by all the descriptor array classes, and so provides a degree of polymorphism. It provides a count function, and can return a TPtrC for an indexed element.

The interface is defined by MDesCArray.


General descriptor array

A general descriptor array can accept elements of any descriptor type. For each descriptor added, it creates a new heap descriptor (HBufC) and copies the contents into it.

The base class is CDesCArray. Derived classes provide storage in flat arrays (CDesCArrayFlat) and segmented arrays (CDesCArraySeg).


Pointer descriptor array

This array holds only TPtrC descriptor elements: i.e. the descriptor type that points to data stored elsewhere. The data pointed to by the TPtrC descriptors is not copied or moved.

The pointer descriptor array is CPtrCArray. It implements MDesCArray, so can be used polymorphically with general descriptor arrays.

[Top]


See also

Descriptors Overview

Dynamic Arrays Overview