diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-2762FDF6-F76D-5268-AE2D-4ABA807CFFEE.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-2762FDF6-F76D-5268-AE2D-4ABA807CFFEE.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,53 @@ + + + + + +Heap +descriptorsDescribes heap descriptors. +

A heap descriptor provides a fixed length buffer, allocated on the heap, +to contain and access data. The data is part of the descriptor object.

+

The data contained in a heap descriptor can be accessed, but not changed, +through this descriptor. The data can, however, be completely replaced using +the assignment operators.

+

A heap descriptor also has the important property that it can be made larger +or smaller, changing the size of the descriptor's buffer. This is achieved +by reallocating the descriptor. Unlike the behaviour of dynamic buffers, reallocation +is not done automatically.

+

Data is accessed through functions provided by the base class.

+

A heap descriptor is supplied in two variants:

+ +

There is also a build independent type, HBufC. This is +the type which is most commonly used in program code; the appropriate variant +is selected at build time.

+

An explicit 8 bit variant is chosen for binary data. An explicit 16 bit +variant is rarely used.

+

The base class, TDesC, contains a data member which holds +the length of the data. The following drawing shows the layout of a HBufC object +initialised with the string of five characters representing the English word +"Hello". The descriptor object is allocated on the heap.

+

Although it is not possible to change the data in the descriptor directly +through the descriptor member functions, it is possible to do this +indirectly by using the Des() member function of HBufC to +first create a modifiable pointer +descriptor, a TPtr type, and then to use this descriptor's +member functions. For this reason, heap descriptors are best suited for data +that rarely changes. For data that changes frequently, it is much better to +use the resizable buffer +descriptor.

+ + +

Example of a Heap descriptor

+
+
\ No newline at end of file