Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
MDesCArray is a very simple but powerful M class. It simply defines an interface to an array of descriptors.
There are two versions of it; 16-bit MDesC16Array and 8-bit MDesC8Array. MDesCArray is a macro that points to the 16-bit version in unicode builds and to the 8-bit version in the older builds.
The interface defines three things:
- Virtual destructor so the array can be deleted through the interface pointer.
- Function to get the item count:
virtual TInt MdcaCount() const = 0;
- Function to get a particular item in the array:
virtual TPtrC MdcaPoint( TInt aIndex ) const = 0;
The beauty of it
What makes it so powerful is how it can be used to make a data source out of any class. The base class for all Symbian listboxes CEikListBox and more specifically its model uses MDesCArray to access the listbox lines. This means that any class that implements the interface can be given to any listbox as a data source as long as the descriptors it returns conform to the format of the listbox.