Location:
e32des16.h
Link against: euser.lib
class RBuf16 : public TDes16;
16 bit resizable buffer descriptor.
The class provides a buffer that contains, accesses and manipulates TUint16 data. The buffer itself is on the heap, and is managed by the class.
Internally, RBuf16 behaves in one of two ways:
as a TPtr16
descriptor type, where the buffer just contains data
as a pointer to a heap descriptor, an HBufC16* type, where the buffer contains both descriptor information and the data.
Note that the handling of the distinction is hidden from view.
An RBuf16 object can allocate its own buffer. Alternatively, it can take ownership of a pre-existing section of allocated memory, or it can take ownership of a pre-existing heap descriptor. It can also reallocate the buffer to resize it. Regardless of the way in which the buffer has been allocated, the RBuf16 object is responsible for freeing memory when the object itself is closed.
The class is intended for instantiation.
The class is derived from TDes16
, which means that data can be both accessed and modified. The base classes provide the functions through which the data is
accessed. In addition, an RBuf16 object can be passed to any function that is prototyped to take a TDes16
or a TDesC16
type.
TDesC16
- Abstract base class for 16-bit descriptors
TDes16
- Abstract base class for 16-bit modifiable descriptors
RBuf16
- 16 bit resizable buffer descriptor
Defined in RBuf16
:
Assign()
, Assign()
, Assign()
, Assign()
, CleanupClosePushL()
, Close()
, Create()
, Create()
, Create()
, CreateL()
, CreateL()
, CreateL()
, CreateL()
, CreateMax()
, CreateMaxL()
, RBuf16()
, RBuf16()
, RBuf16()
, ReAlloc()
, ReAllocL()
, Swap()
, __DECLARE_TEST
, iEBufCPtrType
, iEPtrType
, operator=()
, operator=()
, operator=()
Inherited from TDes16
:
Append()
,
AppendFill()
,
AppendFormat()
,
AppendFormatList()
,
AppendJustify()
,
AppendNum()
,
AppendNumFixedWidth()
,
AppendNumFixedWidthUC()
,
AppendNumUC()
,
Capitalize()
,
Collapse()
,
Collate()
,
Copy()
,
CopyC()
,
CopyCP()
,
CopyF()
,
CopyLC()
,
CopyUC()
,
Delete()
,
Fill()
,
FillZ()
,
Fold()
,
Format()
,
FormatList()
,
Insert()
,
Justify()
,
LeftTPtr()
,
LowerCase()
,
MaxLength()
,
MaxSize()
,
MidTPtr()
,
Num()
,
NumFixedWidth()
,
NumFixedWidthUC()
,
NumUC()
,
PtrZ()
,
Repeat()
,
Replace()
,
RightTPtr()
,
SetLength()
,
SetMax()
,
Trim()
,
TrimAll()
,
TrimLeft()
,
TrimRight()
,
UpperCase()
,
WPtr()
,
Zero()
,
ZeroTerminate()
,
iMaxLength
,
operator+=()
,
operator[]()
Inherited from TDesC16
:
Alloc()
,
AllocL()
,
AllocLC()
,
AtC()
,
Compare()
,
CompareC()
,
CompareF()
,
DoSetLength()
,
EIsNotPrefix
,
EIsPrefix
,
EMightBePrefix
,
Find()
,
FindC()
,
FindF()
,
HasPrefixC()
,
Left()
,
Length()
,
Locate()
,
LocateF()
,
LocateReverse()
,
LocateReverseF()
,
Match()
,
MatchC()
,
MatchF()
,
Mid()
,
Ptr()
,
Right()
,
Size()
,
TPrefix
,
Type()
,
operator!=()
,
operator>()
,
operator>=()
,
operator<()
,
operator<=()
,
operator==()
IMPORT_C RBuf16();
Default constructor.
Constructs a zero-length 16-bit resizable buffer descriptor.
Note that the object owns no allocated memory.
IMPORT_C RBuf16(HBufC16 *aHBuf);
Constructor.
Constructs a 16-bit resizable buffer descriptor, transferring ownership of the specified heap descriptor to this object.
|
protected: IMPORT_C RBuf16(TInt aType, TInt aLength, TInt aMaxLength);
Protected constructor.
|
inline RBuf16 &operator=(const TUint16 *aString);
Copies data into this descriptor replacing any existing data.
The length of this descriptor is set to reflect the new data.
|
|
|
inline RBuf16 &operator=(const TDesC16 &aDes);
Copies data into this descriptor replacing any existing data.
The length of this descriptor is set to reflect the new data.
|
|
|
inline RBuf16 &operator=(const RBuf16 &aDes);
Copies data into this descriptor replacing any existing data.
The length of this descriptor is set to reflect the new data.
|
|
|
IMPORT_C void Assign(const RBuf16 &aRBuf);
Transfers ownership of the specified 16-bit resizable buffer descriptor's buffer to this object.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
IMPORT_C void Assign(TUint16 *aHeapCell, TInt aMaxLength);
Assigns ownership of the specified allocated memory to this object.
The allocated memory forms the buffer for this descriptor. The current length of the descriptor is set to zero.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C void Assign(TUint16 *aHeapCell, TInt aLength, TInt aMaxLength);
Assigns ownership of the specified allocated memory to this object.
The allocated memory forms the buffer for this descriptor. The current length of the descriptor is set to the value of the second parameter.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C void Assign(HBufC16 *aHBuf);
Transfers ownership of the specified heap descriptor to this object.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
IMPORT_C void Swap(RBuf16 &aRBuf);
Swaps the content of two 16-bit resizable buffer descriptors.
|
IMPORT_C TInt Create(TInt aMaxLength);
Creates a 16-bit resizable buffer descriptor.
The function allocates sufficient memory to contain descriptor data up to the specified maximum length.
The current length of the descriptor is set to zero. The maximum length of the descriptor is set to the specified value.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C void CreateL(TInt aMaxLength);
Creates 16-bit resizable buffer descriptor, and leaves on failure.
The function allocates sufficient memory to contain descriptor data up to the specified maximum length.
The current length of the descriptor is set to zero. The maximum length of the descriptor is set to the specified value.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C TInt CreateMax(TInt aMaxLength);
Creates a 16-bit resizable buffer descriptor.
The function allocates sufficient memory to contain descriptor data up to the specified maximum length.
Both the current length and the maximum length of the descriptor are set to the specified value.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C void CreateMaxL(TInt aMaxLength);
Creates a 16-bit resizable buffer descriptor, and leaves on failure.
The function allocates sufficient memory to contain descriptor data up to the specified maximum length.
Both the current length and the maximum length of the descriptor are set to the specified value.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
inline void CreateL(RReadStream &aStream, TInt aMaxLength);
Creates a 16-bit resizable buffer descriptor that has been initialised with data from the specified read stream; leaves on failure.
Data is assigned to the new descriptor from the specified stream. This variant assumes that the stream contains the length of the data followed by the data itself.
The function is implemented by calling the HBufC16::NewL
(RReadStream&,TInt) variant and then assigning the resulting heap descriptor using the RBuf16::Assign(HBufC16*)
variant. The comments that describe the HBufC16::NewL()
variant also apply to this RBuf16::CreateL()
function.
The function may leave with one of the system-wide error codes, specifically KErrOverflow, if the length of the data as read from the stream is greater than the upper limit as specified by the aMaxLength parameter.
|
IMPORT_C TInt Create(const TDesC16 &aDes);
Creates a 16-bit resizable buffer descriptor to contain a copy of the specified (source) descriptor.
The function allocates sufficient memory so that this descriptor's maximum length is the same as the length of the source descriptor. Both the current length and the maximum length of this descriptor are set to the length of the source descriptor.
The data contained in the source descriptor is copied into this descriptor.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C void CreateL(const TDesC16 &aDes);
Creates a 16-bit resizable buffer descriptor to contain a copy of the specified (source) descriptor, and leaves on failure.
The function allocates sufficient memory so that this descriptor's maximum length is the same as the length of the source descriptor.Both the current length and the maximum length of this descriptor are set to the length of the source descriptor.
The data contained in the source descriptor is copied into this descriptor.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C TInt Create(const TDesC16 &aDes, TInt aMaxLength);
Creates a 16-bit resizable buffer descriptor to contain a copy of the specified (source) descriptor.
The function allocates sufficient memory so that this descriptor's maximum length is the same as the value of the aMaxLength parameter.
The data contained in the source descriptor is copied into this descriptor. The length of data copied is either
the length of the source descriptor aDes
or
the value of the aMaxLength parameter
whichever is the smaller value. The current length of this descriptor is also set to the smaller value.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C void CreateL(const TDesC16 &aDes, TInt aMaxLength);
Creates a 16-bit resizable buffer descriptor to contain a copy of the specified (source) descriptor, and leaves on failure.
The function allocates sufficient memory so that this descriptor's maximum length is the same as the value of the aMaxLength parameter.
The data contained in the source descriptor is copied into this descriptor. The length of data copied is either
the length of the source descriptor aDes
or
the value of the aMaxLength parameter
whichever is the smaller value. The current length of this descriptor is also set to the smaller value.
Note that the function assumes that this descriptor does not already own any allocated memory. It does not check, nor does
it free any pre-existing owned allocated memory. If this descriptor does already own allocated memory, RBuf16::Close()
should be invoked on this descriptor before this function is invoked.
|
|
IMPORT_C TInt ReAlloc(TInt aMaxLength);
Resizes this 16-bit resizable buffer descriptor.
The length and contents of the descriptor are unchanged.
|
|
|
IMPORT_C void ReAllocL(TInt aMaxLength);
Resizes this 16-bit resizable buffer descriptor, leaving on failure.
The length and contents of the descriptor are unchanged.
|
|
IMPORT_C void Close();
Deallocates memory assigned to this object, and re-initializes the object as a zero-length descriptor.
IMPORT_C void CleanupClosePushL();
Pushes a cleanup item for this object onto the cleanup stack.
The effect of this is to cause Close()
to be called on this 16-bit resizable buffer descriptor, when CleanupStack::PopAndDestroy()
is called at some later time.
...
RBuf16 x;
....
x.CleanupClosePushL();
...
CleanupStack::PopAndDestroy();
...
protected: __DECLARE_TEST;