BinaryData
—handling general binary data with
descriptorsThe example shows how descriptors can handle general binary data
by explicitly using the 8 bit descriptor class variants
TBufC8<TInt>
, TBuf8<TInt>
,
TPtr8
etc.
Contrast this with examples where descriptors contain text. These
examples almost always use the non-explicit forms
TBufC<TInt>
, TBuf<TInt>
,
TPtr
etc; these are typedef'd to the 16 bit variant.
TBuf<TInt>
: modifiable buffer descriptor,
derived from TDes
TBufC<TInt>
: constant buffer descriptor,
derived from TDesC
TPtr
: modifiable pointer descriptor, derived
from TDes
This example shows how descriptors can be used in function interfaces. Specifically, it shows the use of:
const TDesC& aString
TDes&
const TDesC8& aBuffer
TDes8& aBuffer
as function arguments.
TBuf<TInt>
: modifiable buffer descriptor,
derived from TDes
TBufC<TInt>
: constant buffer descriptor,
derived from TDesC
TPtr
: modifiable pointer descriptor, derived
from TDes
TPtrC
: constant pointer descriptor, derived from
TDesC
HBufC
: heap buffer descriptor
The example shows use of the HBufC
heap buffer
descriptor and:
how it can be created using the HBufC::NewL()
static function
how it can be reallocated using the ReAllocL()
function
how its data can be changed through a TPtr
constructed by calling the Des()
function
HBufC
: heap buffer descriptor
TPtr
: modifiable pointer descriptor, derived
from TDes
CleanupStack
: a cleanup stack
The example shows the use of descriptor functions which can
modify the descriptor. These are the functions defined and implemented by the
TDes
class: for example SetLength()
,
Copy()
and Insert()
.
TDes
: modifiable descriptor
TBuf<TInt>
: modifiable buffer descriptor,
derived from TDes
TPtr
: modifiable pointer descriptor, derived
from TDes
The example shows the use of descriptor functions which do not
modify the descriptor. These are the functions defined and implemented by the
TDesC
class; for example Length()
,
Size()
and Compare()
.
TDesC
: constant descriptor
TBufC<TInt>
: constant buffer descriptor,
derived from TDesC
TPtrC
: constant pointer descriptor, derived from
TDesC
TPtr
: modifiable pointer descriptor, derived
from TDes
TPtrC
: constant pointer descriptor, derived from
TDesC
TPtrC8
: 8 bit constant pointer descriptor,
derived from TDesC8
TPtrC16
: 16 bit constant pointer descriptor,
derived from TDesC16