How to Use Descriptors
Explains how to use descriptors for various use cases.
- How to use the non-modifiable buffer descriptor — TBufC<TInt>
Non-modifiable buffer descriptors are useful for holding
constant strings or data and providing safe ways to access that data.
- How to use modifiable buffer descriptor — TBuf<TInt>
Modifiable buffer descriptors are useful for holding strings
or data and providing safe ways to access and modify that data.
- How to use the non-modifiable pointer descriptor - TPtrC
Non-modifiable pointer descriptors are useful for referencing
constant strings or data; for example, accessing strings built into ROM
resident code, or passing a reference to data in RAM which must not be modified
through that reference.
- How to use the modifiable pointer descriptor — TPtr
Modifiable pointer descriptors are useful for referencing
strings or data which can be accessed and changed.
- How to use the heap descriptor - HBufC
Heap descriptors provide a buffer of fixed length, allocated on the heap. Descriptors are useful for holding constant strings or data, when the length of the data may not be known until run time.
- How to
use the resizable buffer descriptor - RBuf
Use this descriptor to hold a string or binary data.
- Descriptors
for function interfaces
Descriptors to specify interfaces which use or manipulate text
strings or general binary data use
- How to
represent general binary data
Construct an 8 bit variant descriptor to represent general binary
data.
- Using TDes
Use TDes for interfaces which take narrow or wide (Unicode)
text, depending on the build variant.
- Using
TDes16 class
Use TDes16 for Interfaces which take wide (Unicode) text regardless
of the build variant.
- Using
TDes8 Class
Use TDes8 for Interfaces which take binary data or narrow text
regardless of the build variant.
- Using
TDes8Overflow
Use TDes8Overflow to handle overflow issues when calling theTDes8::AppendFormat()
function.
- Using
TDesC
Use TDesC for interfaces which take narrow or wide (Unicode) text,
depending on the build variant, but does not change the data.
- Using TDesC16 Class
Use TDesC16
for interfaces which access
Unicode text, regardless of the build variant, but which does not
change the data.
- Using TDesC8 Class
Use TDescC8 for interfaces which takes binary data or explicit
narrow text, regardless of the build variant, but which does not need
to change the data.
- Format
string syntax
TDes8::Format()
, TDes16::Format()
and
some other functions take a format string containing literal text embedded
with directives for converting a trailing list of arguments into text.