How to choose a descriptor
Taken from Netqin
Do you need to modify the content of the description |
Yes |
no |
Whether the memory of the descriptor has been allocated |
Whether the memory of the descriptor has been allocated |
Yes |
no |
Yes |
no |
TPtr |
Can the line size be less than 256 bytes |
TPtrC |
Can the line size be less than 256 bytes |
|
Yes |
no |
|
Yes |
no |
|
TBuf |
HBufC:
Use TPtr when you need to change the content |
HBufC* buf=HBufC::New(1024); |
TPtr temp(buf->Des()); |
temp.Format(_L("test")); |
|
|
TBufC |
HBufC |
If the descriptor contains binary content, an 8-bit descriptor should be used.
If the descriptor contains wide characters, a 16-bit descriptor should be used.
Otherwise, a descriptor without a specified bit should be used.