|
||
class RBuf8 : public TDes8;
8 bit resizable buffer descriptor.
The class provides a buffer that contains, accesses and manipulates TUint8 data. The buffer itself is on the heap, and is managed by the class.
Internally, RBuf8 behaves in one of two ways:
as a TPtr8
descriptor type, where the buffer just contains data
as a pointer to a heap descriptor, an HBufC8* type, where the buffer contains both descriptor information and the data.
Note that the handling of the distinction is hidden from view.
An RBuf8 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 RBuf8 object is responsible for freeing memory when the object itself is closed.
The class is intended for instantiation.
The class is derived from TDes8
, 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 RBuf8 object can be passed to any function that is prototyped to take a TDes8
or a TDesC8
type.
TDesC8
-
Abstract base class for 8-bit non-modifiable descriptors.
TDes8
-
Abstract base class for 8-bit modifiable descriptors.
RBuf8
-
8 bit resizable buffer descriptor.
Defined in RBuf8
:
Assign(HBufC8 *)
Transfers ownership of the specified heap descriptor to this object.Assign(TUint8 *,TInt)
Assigns ownership of the specified allocated memory to this object.Assign(TUint8 *,TInt,TInt)
Assigns ownership of the specified allocated memory to this object.Assign(const RBuf8 &)
Transfers ownership of the specified 8-bit resizable buffer descriptor's buffer ...CleanupClosePushL()
Pushes a cleanup item for this object onto the cleanup stack.Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...Create(TInt)
Creates an 8-bit resizable buffer descriptor.Create(const TDesC8 &)
Creates a 8-bit resizable buffer descriptor to contain a copy of the specified (...Create(const TDesC8 &,TInt)
Creates an 8-bit resizable buffer descriptor to contain a copy of the specified ...CreateL(RReadStream &,TInt)
Creates an 8-bit resizable buffer descriptor that has been initialised with data...CreateL(TInt)
Creates an 8-bit resizable buffer descriptor, and leaves on failure.CreateL(const TDesC8 &)
Creates an 8-bit resizable buffer descriptor to contain a copy of the specified ...CreateL(const TDesC8 &,TInt)
Creates an 8-bit resizable buffer descriptor to contain a copy of the specified ...CreateMax(TInt)
Creates an 8-bit resizable buffer descriptor.CreateMaxL(TInt)
Creates an 8-bit resizable buffer descriptor, and leaves on failure.RBuf8()
Default constructor.RBuf8(HBufC8 *)
Constructor.RBuf8(TInt,TInt,TInt)
Protected constructor. ReAlloc(TInt)
Resizes this 8-bit resizable buffer descriptor.ReAllocL(TInt)
Resizes this 8-bit resizable buffer descriptor, leaving on failure.Swap(RBuf8 &)
Swaps the content of two 8-bit resizable buffer descriptors.__DECLARE_TEST
iEBufCPtrType
iEPtrType
operator=(const RBuf8 &)
Copies data into this descriptor replacing any existing data.operator=(const TDesC8 &)
Copies data into this descriptor replacing any existing data.operator=(const TUint8 *)
Copies data into this descriptor replacing any existing data.Inherited from TDes8
:
Append(TChar)
Appends a character onto the end of this descriptor's data.Append(const TDesC16 &)
Appends data onto the end of this descriptor's data.Append(const TDesC8 &)
Appends data onto the end of this descriptor's data.Append(const TUint8 *,TInt)
Appends data onto the end of this descriptor's data.AppendFill(TChar,TInt)
Appends and fills this descriptor with the specified character.AppendFormat(TRefByValue< const TDesC8 >,...)
Formats and appends text onto the end of this descriptor's data.AppendFormat(TRefByValue< const TDesC8 >,TDes8Overflow *,...)
Formats and appends text onto the end of this descriptor's data.AppendFormatList(const TDesC8 &,VA_LIST,TDes8Overflow *)
Formats and appends text onto the end of this descriptor's data.AppendJustify(const TDesC8 &,TInt,TAlign,TChar)
Appends data onto the end of this descriptor's data and justifies it.AppendJustify(const TDesC8 &,TInt,TInt,TAlign,TChar)
Appends data onto the end of this descriptor's data and justifies it.AppendJustify(const TUint8 *,TInt,TAlign,TChar)
Appends a zero terminated string onto the end of this descriptor's data and just...AppendJustify(const TUint8 *,TInt,TInt,TAlign,TChar)
Appends data onto the end of this descriptor's data and justifies it.AppendNum(TInt64)
Converts the 64-bit signed integer into a decimal character representation and a...AppendNum(TReal,const TRealFormat &)
Converts the specified floating point number into a character representation and...AppendNum(TUint64,TRadix)
Converts the specified 64-bit unsigned integer into a character representation b...AppendNumFixedWidth(TUint,TRadix,TInt)
Converts the specified unsigned integer into a fixed width character representat...AppendNumFixedWidthUC(TUint,TRadix,TInt)
Converts the specified unsigned integer into a fixed width character representat...AppendNumUC(TUint64,TRadix)
Converts the specified 64-bit unsigned integer into a character representation b...Capitalize()
Capitalises the content of this descriptor.Collapse()
Collapse all characters from 16 to 8 bitsCollate()
Performs collation on the content of this descriptor. Copy(const TDesC16 &)
Copies data into this descriptor replacing any existing data.Copy(const TDesC8 &)
Copies data into this descriptor replacing any existing data.Copy(const TUint8 *)
Copies data into this descriptor replacing any existing data.Copy(const TUint8 *,TInt)
Copies data into this descriptor replacing any existing data.CopyC(const TDesC8 &)
Copies and collates data from the specified descriptor into this descriptor repl...CopyCP(const TDesC8 &)
Copies text from the specified descriptor and capitalises it before putting it i...CopyF(const TDesC8 &)
Copies and folds data from the specified descriptor into this descriptor replaci...CopyLC(const TDesC8 &)
Copies text from the specified descriptor and converts it to lower case before p...CopyUC(const TDesC8 &)
Copies text from the specified descriptor and converts it to upper case before p...Delete(TInt,TInt)
Deletes data from this descriptor.Expand()
Expand all characters from 8 to 16 bitsFill(TChar)
Fills the descriptor's data area with the specified character, replacing any exi...Fill(TChar,TInt)
Fills the descriptor's data area with the specified character, replacing any exi...FillZ()
Fills the descriptor's data area with binary zeroes, i.e. 0x00, replacing any ex...FillZ(TInt)
Fills the descriptor's data area with binary zeroes, i.e. 0x00, replacing any ex...Fold()
Performs folding on the content of this descriptor.Format(TRefByValue< const TDesC8 >,...)
Formats and copies text into this descriptor, replacing any existing data.FormatList(const TDesC8 &,VA_LIST)
Formats and copies text into this descriptor, replacing any existing data.Insert(TInt,const TDesC8 &)
Inserts data into this descriptor.Justify(const TDesC8 &,TInt,TAlign,TChar)
Copies data into this descriptor and justifies it, replacing any existing data.LeftTPtr(TInt)const
Extracts the leftmost part of the data.LowerCase()
Converts the content of this descriptor to lower case.MaxLength()const
Gets the maximum length of the descriptor.MaxSize()const
Gets the maximum size of the descriptor.MidTPtr(TInt)const
Extracts a portion of the data.MidTPtr(TInt,TInt)const
Extracts a portion of the data.Num(TInt64)
Converts the 64-bit signed integer into a decimal character representation and c...Num(TReal,const TRealFormat &)
Converts the specified floating point number into a character representation and...Num(TUint64,TRadix)
Converts the specified 64-bit unsigned integer into a character representation b...NumFixedWidth(TUint,TRadix,TInt)
Converts the specified unsigned integer into a fixed width character representat...NumFixedWidthUC(TUint,TRadix,TInt)
Converts the specified unsigned integer into a fixed width character representat...NumUC(TUint64,TRadix)
Converts the specified 64-bit unsigned integer into a character representation b...PtrZ()
Appends a zero terminator onto the end of this descriptor's data and returns a p...Repeat(const TDesC8 &)
Copies data with repetition into this descriptor, from another descriptor, repla...Repeat(const TUint8 *,TInt)
Copies data with repetition into this descriptor, from a memory location specifi...Replace(TInt,TInt,const TDesC8 &)
Replaces data in this descriptor.RightTPtr(TInt)const
Extracts the rightmost part of the data.SetLength(TInt)
Sets the length of the data represented by the descriptor to the specified value...SetMax()
Sets the length of the data to the maximum length of the descriptor. Swap(TDes8 &)
Swaps the data represented by this descriptor with the data represented by the s...TDes8(TInt,TInt,TInt)
Trim()
Deletes leading and trailing whitespace characters from the descriptor's data.TrimAll()
Deletes leading and trailing whitespace characters from the descriptor's data an...TrimLeft()
Deletes leading whitespace characters from the descriptor's data.TrimRight()
Deletes trailing whitespace characters from the descriptor's data.UpperCase()
Converts the content of this descriptor to upper case.WPtr()const
Zero()
Sets the length of the data to zero. ZeroTerminate()
Appends a zero terminator onto the end of this descriptor's data.iMaxLength
operator+=(const TDesC8 &)
Appends data onto the end of this descriptor's data and returns a reference to t...operator=(const TDes8 &)
Copies data into this descriptor replacing any existing data.operator[](TInt)
Gets a non-const reference to a single data item within this descriptor's data.operator[](TInt)const
Gets a const reference to a single data item within this descriptor's data.Inherited from TDesC8
:
Alloc()const
Creates a new 8-bit heap descriptor and initialises it with a copy of this descr...AllocL()const
Creates a new 8-bit heap descriptor and initialises it with a copy of this descr...AllocLC()const
Creates a new 8-bit heap descriptor, initialises it with a copy of this descript...AtC(TInt)const
Compare(const TDesC8 &)const
Compares this descriptor's data with the specified descriptor's data.CompareC(const TDesC8 &)const
Compares this descriptor's data with the specified descriptor's data using the s...CompareF(const TDesC8 &)const
Compares this descriptor's folded data with the specified descriptor's folded da...DoSetLength(TInt)
Find(const TDesC8 &)const
Searches for the first occurrence of the specified data sequence within this des...Find(const TUint8 *,TInt)const
Searches for the first occurrence of the specified data sequence within this des...FindC(const TDesC8 &)const
Searches for the first occurrence of the specified collated data sequence within...FindC(const TUint8 *,TInt)const
Searches for the first occurrence of the specified collated data sequence within...FindF(const TDesC8 &)const
Searches for the first occurrence of the specified folded data sequence within t...FindF(const TUint8 *,TInt)const
Searches for the first occurrence of the specified folded data sequence within t...Left(TInt)const
Extracts the leftmost part of the data.Length()const
Gets the length of the data.Locate(TChar)const
Searches for the first occurrence of a character within this descriptor's data.LocateF(TChar)const
Searches for the first occurrence of a folded character within this descriptor's...LocateReverse(TChar)const
Searches for the first occurrence of a character within this descriptor's data, ...LocateReverseF(TChar)const
Searches for the first occurrence of a folded character within this descriptor's...Match(const TDesC8 &)const
Searches this descriptor's data for a match with the match pattern supplied in t...MatchC(const TDesC8 &)const
Searches this descriptor's collated data for a match with the collated match pat...MatchF(const TDesC8 &)const
Searches this descriptor's folded data for a match with the folded match pattern...Mid(TInt)const
Extracts a portion of the data.Mid(TInt,TInt)const
Extracts a portion of the data.Ptr()const
Gets a pointer to the data represented by the descriptor.Right(TInt)const
Extracts the rightmost part of the data.Size()const
Gets the size of the data.TDesC8(TInt,TInt)
Type()const
operator!=(const TDesC8 &)const
Determines whether this descriptor's data is not equal to the specified descript...operator>(const TDesC8 &)const
Determines whether this descriptor's data is greater than the specified descript...operator>=(const TDesC8 &)const
Determines whether this descriptor's data is greater than or equal to the specif...operator<(const TDesC8 &)const
Determines whether this descriptor's data is less than the specified descriptor'...operator<=(const TDesC8 &)const
Determines whether this descriptor's data is less than or equal to the specified...operator==(const TDesC8 &)const
Determines whether this descriptor's data is equal to the specified descriptor's...TBuf8
A descriptor class which provides a buffer of fixed length for containing, acces...IMPORT_C RBuf8();
Default constructor.
Constructs a zero-length 8-bit resizable buffer descriptor.
Note that the object owns no allocated memory.
IMPORT_C RBuf8(HBufC8 *aHBuf);
Constructor.
Constructs an 8-bit resizable buffer descriptor, transferring ownership of the specified heap descriptor to this object.
|
protected: IMPORT_C RBuf8(TInt aType, TInt aLength, TInt aMaxLength);
Protected constructor.
|
inline RBuf8& operator=(const TUint8 *aString);
Copies data into this descriptor replacing any existing data.
The length of this descriptor is set to reflect the new data.
|
|
|
inline RBuf8& operator=(const TDesC8 &aDes);
Copies data into this descriptor replacing any existing data.
The length of this descriptor is set to reflect the new data.
|
|
|
inline RBuf8& operator=(const RBuf8 &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 RBuf8 &aRBuf);
Transfers ownership of the specified 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void Assign(TUint8 *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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void Assign(TUint8 *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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void Assign(HBufC8 *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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void Swap(RBuf8 &aRBuf);
Swaps the content of two 8-bit resizable buffer descriptors.
|
IMPORT_C TInt Create(TInt aMaxLength);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void CreateL(TInt aMaxLength);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C TInt CreateMax(TInt aMaxLength);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void CreateMaxL(TInt aMaxLength);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...inline void CreateL(RReadStream &aStream, TInt aMaxLength);
Creates an 8-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 HBufC8::NewL(TInt)
(RReadStream&,TInt) variant and then assigning the resulting heap descriptor using the RBuf8::Assign(HBufC8 *)
variant. The comments that describe the HBufC8::NewL(TInt)
variant also apply to this RBuf8::CreateL(TInt)
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 TDesC8 &aDes);
Creates a 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.TDes8::Copy(const TDesC8 &)
Copies data into this descriptor replacing any existing data.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void CreateL(const TDesC8 &aDes);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.TDes8::Copy(const TDesC8 &)
Copies data into this descriptor replacing any existing data.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C TInt Create(const TDesC8 &aDes, TInt aMaxLength);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.TDes8::Copy(const TDesC8 &)
Copies data into this descriptor replacing any existing data.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C void CreateL(const TDesC8 &aDes, TInt aMaxLength);
Creates an 8-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, RBuf8::Close()
should be invoked on this descriptor before this function is invoked.
|
|
TDesC8::Length()const
Gets the length of the data.TDes8::MaxLength()const
Gets the maximum length of the descriptor.TDes8::Copy(const TDesC8 &)
Copies data into this descriptor replacing any existing data.RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...IMPORT_C TInt ReAlloc(TInt aMaxLength);
Resizes this 8-bit resizable buffer descriptor.
The length and contents of the descriptor are unchanged.
|
|
|
IMPORT_C void ReAllocL(TInt aMaxLength);
Resizes this 8-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 RBuf8::Close()
to be called on this 8-bit resizable buffer descriptor, when CleanupStack::PopAndDestroy()
is called at some later time.
...
RBuf8 x;
....
x.CleanupClosePushL();
...
CleanupStack::PopAndDestroy();
...
RBuf8::Close()
Deallocates memory assigned to this object, and re-initializes the object as a z...protected: __DECLARE_TEST;