TDes8 Class Reference

#include <e32des8.h>

class TDes8 : public TDesC8

Inherits from

Protected Attributes
__DECLARE_TEST
TInt iMaxLength
Public Member Functions
IMPORT_C voidAppend(TChar)
IMPORT_C voidAppend(const TDesC8 &)
IMPORT_C voidAppend(const TDesC16 &)
IMPORT_C voidAppend(const TUint8 *, TInt)
IMPORT_C voidAppendFill(TChar, TInt)
IMPORT_C voidAppendFormat(TRefByValue< const TDesC8 >, TDes8Overflow *, ...)
IMPORT_C voidAppendFormat(TRefByValue< const TDesC8 >, ...)
IMPORT_C voidAppendFormatList(const TDesC8 &, VA_LIST, TDes8Overflow *)
IMPORT_C voidAppendJustify(const TDesC8 &, TInt, TAlign, TChar)
IMPORT_C voidAppendJustify(const TDesC8 &, TInt, TInt, TAlign, TChar)
IMPORT_C voidAppendJustify(const TUint8 *, TInt, TAlign, TChar)
IMPORT_C voidAppendJustify(const TUint8 *, TInt, TInt, TAlign, TChar)
IMPORT_C voidAppendNum(TInt64)
IMPORT_C voidAppendNum(TUint64, TRadix)
IMPORT_C TIntAppendNum(TReal, const TRealFormat &)
IMPORT_C voidAppendNumFixedWidth(TUint, TRadix, TInt)
IMPORT_C voidAppendNumFixedWidthUC(TUint, TRadix, TInt)
IMPORT_C voidAppendNumUC(TUint64, TRadix)
IMPORT_C voidCapitalize()
IMPORT_C voidCollapse()
IMPORT_C voidCollate()
IMPORT_C voidCopy(const TDesC8 &)
IMPORT_C voidCopy(const TUint8 *, TInt)
IMPORT_C voidCopy(const TUint8 *)
IMPORT_C voidCopy(const TDesC16 &)
IMPORT_C voidCopyC(const TDesC8 &)
IMPORT_C voidCopyCP(const TDesC8 &)
IMPORT_C voidCopyF(const TDesC8 &)
IMPORT_C voidCopyLC(const TDesC8 &)
IMPORT_C voidCopyUC(const TDesC8 &)
IMPORT_C voidDelete(TInt, TInt)
IMPORT_C TPtr16Expand()
IMPORT_C voidFill(TChar)
IMPORT_C voidFill(TChar, TInt)
IMPORT_C voidFillZ()
IMPORT_C voidFillZ(TInt)
IMPORT_C voidFold()
IMPORT_C voidFormat(TRefByValue< const TDesC8 >, ...)
IMPORT_C voidFormatList(const TDesC8 &, VA_LIST)
IMPORT_C voidInsert(TInt, const TDesC8 &)
IMPORT_C voidJustify(const TDesC8 &, TInt, TAlign, TChar)
IMPORT_C TPtr8LeftTPtr(TInt)
IMPORT_C voidLowerCase()
TInt MaxLength()
TInt MaxSize()
IMPORT_C TPtr8MidTPtr(TInt)
IMPORT_C TPtr8MidTPtr(TInt, TInt)
IMPORT_C voidNum(TInt64)
IMPORT_C voidNum(TUint64, TRadix)
IMPORT_C TIntNum(TReal, const TRealFormat &)
IMPORT_C voidNumFixedWidth(TUint, TRadix, TInt)
IMPORT_C voidNumFixedWidthUC(TUint, TRadix, TInt)
IMPORT_C voidNumUC(TUint64, TRadix)
IMPORT_C const TUint8 *PtrZ()
IMPORT_C voidRepeat(const TUint8 *, TInt)
IMPORT_C voidRepeat(const TDesC8 &)
IMPORT_C voidReplace(TInt, TInt, const TDesC8 &)
IMPORT_C TPtr8RightTPtr(TInt)
IMPORT_C voidSetLength(TInt)
IMPORT_C voidSetMax()
IMPORT_C voidSwap(TDes8 &)
IMPORT_C voidTrim()
IMPORT_C voidTrimAll()
IMPORT_C voidTrimLeft()
IMPORT_C voidTrimRight()
IMPORT_C voidUpperCase()
IMPORT_C voidZero()
IMPORT_C voidZeroTerminate()
TDes8 &operator+=(const TDesC8 &)
TDes8 &operator=(const TUint8 *)
TDes8 &operator=(const TDesC8 &)
TDes8 &operator=(const TDes8 &)
const TUint8 &operator[](TInt)
TUint8 &operator[](TInt)
Protected Member Functions
TDes8(TInt, TInt, TInt)
TDes8()
voidDoAppendNum(TUint64, TRadix, TUint, TInt)
voidDoPadAppendNum(TInt, TInt, const TUint8 *)
TUint8 *WPtr()
Inherited Functions
TDesC8::Alloc()const
TDesC8::AllocL()const
TDesC8::AllocLC()const
TDesC8::AtC(TInt)const
TDesC8::Compare(const TDesC8 &)const
TDesC8::CompareC(const TDesC8 &)const
TDesC8::CompareF(const TDesC8 &)const
TDesC8::DoSetLength(TInt)
TDesC8::Find(const TDesC8 &)const
TDesC8::Find(const TUint8 *,TInt)const
TDesC8::FindC(const TDesC8 &)const
TDesC8::FindC(const TUint8 *,TInt)const
TDesC8::FindF(const TDesC8 &)const
TDesC8::FindF(const TUint8 *,TInt)const
TDesC8::Left(TInt)const
TDesC8::Length()const
TDesC8::Locate(TChar)const
TDesC8::LocateF(TChar)const
TDesC8::LocateReverse(TChar)const
TDesC8::LocateReverseF(TChar)const
TDesC8::Match(const TDesC8 &)const
TDesC8::MatchC(const TDesC8 &)const
TDesC8::MatchF(const TDesC8 &)const
TDesC8::Mid(TInt)const
TDesC8::Mid(TInt,TInt)const
TDesC8::Ptr()const
TDesC8::Right(TInt)const
TDesC8::Size()const
TDesC8::TDesC8()
TDesC8::TDesC8(TInt,TInt)
TDesC8::Type()const
TDesC8::operator!=(const TDesC8 &)const
TDesC8::operator<(const TDesC8 &)const
TDesC8::operator<=(const TDesC8 &)const
TDesC8::operator==(const TDesC8 &)const
TDesC8::operator>(const TDesC8 &)const
TDesC8::operator>=(const TDesC8 &)const

Detailed Description

Abstract base class for 8-bit modifiable descriptors.

The class encapsulates the data member containing the maximum length of data represented by an 8-bit descriptor. It also provides member functions through which the data can be modified.

The class adds to the behaviour provided by TDesC8.

This class cannot be instantiated as it is intended to form part of a class hierarchy; it provides a well defined part of descriptor behaviour. It can, however, be passed as an argument type for functions which need to both modify and access descriptor data.

See also: TDes TDesC8 TDesC16

Member Attribute Documentation

__DECLARE_TEST

__DECLARE_TEST[protected]

iMaxLength

TInt iMaxLength[protected]

Constructor & Destructor Documentation

TDes8 ( TInt, TInt, TInt )

TDes8(TIntaType,
TIntaLength,
TIntaMaxLength
)[protected, inline]

TDes8 ( )

TDes8()[protected, inline]

Member Function Documentation

Append ( TChar )

IMPORT_C voidAppend(TCharaChar)

Appends a character onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

Parameters
aCharThe single character to be appended. The length of the descriptor is incremented by one. The function assumes that the character is non-Unicode and that it can be represented by a single byte.
Panic Codes
USER23 if the resulting new length of this descriptor is greater than its maximum length.

Append ( const TDesC8 & )

IMPORT_C voidAppend(const TDesC8 &aDes)

Appends data onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

Parameters
aDesAn 8-bit non-modifiable descriptor whose data is to be appended.
Panic Codes
USER23 if the resulting new length of this descriptor is greater than its maximum length.

Append ( const TDesC16 & )

IMPORT_C voidAppend(const TDesC16 &aDes)

Appends data onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

Parameters
aDesA 16-bit non-modifiable descriptor whose data is to be appended. Each double-byte value can only be appended as a single byte when the double-byte value is less than decimal 256. A double-byte value of 256 or greater cannot be appended and the corresponding single byte is set to a value of decimal 1.
Panic Codes
USER23 if the resulting new length of this descriptor is greater than its maximum length.

Append ( const TUint8 *, TInt )

IMPORT_C voidAppend(const TUint8 *aBuf,
TIntaLength
)

Appends data onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

Parameters
aBufA pointer to the data to be copied.
aLengthThe length of the data to be copied.
Panic Codes
USER23 if the resulting new length of this descriptor is greater than its maximum length.
USER29 if aLength is negative.

AppendFill ( TChar, TInt )

IMPORT_C voidAppendFill(TCharaChar,
TIntaLength
)

Appends and fills this descriptor with the specified character.

The descriptor is appended with the specified number of characters. and its length is changed to reflect this.

Parameters
aCharThe fill character. The function assumes that the character is non-Unicode and that it can be represented by a single byte.
aLengthThe number of fill characters to be appended.
Panic Codes
USER23 if aLength is negative, or the resulting length of this descriptor is greater than its maximum length.

AppendFormat ( TRefByValue< const TDesC8 >, TDes8Overflow *, ... )

IMPORT_C voidAppendFormat(TRefByValue< const TDesC8 >aFmt,
TDes8Overflow *aOverflowHandler,
...
)

Formats and appends text onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

The function takes a format string and a variable number of arguments. The format string contains literal text, embedded with directives, for converting the trailing list of arguments into text.

The embedded directives are character sequences prefixed with the '' character. The literal text is simply copied into this descriptor unaltered while the '' directives are used to convert successive arguments from the trailing list. See the description of the Format() function.

Literal text is appended on a character by character basis. If it results in the length of this descriptor exceeding its maximum length, then the function:

1. calls the Overflow() member function of the overflow handler, if an overflow handler is supplied 2 raises a USER 23 panic, if no overflow handler is supplied.

As much literal text as possible will have been copied into this descriptor and this descriptor will have reached its maximum length.

Text converted from a trailing argument is appended as a complete string. If an attempt to append this string fails because the resulting length of this descriptor would exceed its maximum length, then the function:

1. calls the Overflow() member function of the overflow handler, if an overflow handler is supplied

2 raises a USER 23 panic, if no overflow handler is supplied.

None of the generated text is appended and length of this descriptor may be less than the maximum.

See also: TDes8::Format() TDes8Overflow::Overflow()

Parameters
aFmtThe 8-bit non-modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.
aOverflowHandlerA pointer to the overflow handler.
Panic Codes
USER23 if the length of the descriptor exceeds its maximum length and no overflow handler has been supplied.
USER24 if the format string has incorrect syntax.

AppendFormat ( TRefByValue< const TDesC8 >, ... )

IMPORT_C voidAppendFormat(TRefByValue< const TDesC8 >aFmt,
...
)

Formats and appends text onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

The function takes a format string and a variable number of arguments. The format string contains literal text, embedded with directives, for converting the trailing list of arguments into text.

The embedded directives are character sequences prefixed with the '' character. The literal text is simply copied into this descriptor unaltered while the '' directives are used to convert successive arguments from the trailing list. See the description of the Format() function.

Literal text is appended on a character by character basis.

Text converted from a trailing argument is appended as a complete string.

See also: TDes8::Format()

Parameters
aFmtThe 8-bit non-modifiable descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.
Panic Codes
USER23 if the resulting length of text in this descriptor exceeds the descriptor's maximum length.
USER24 if the format string has incorrect syntax.

AppendFormatList ( const TDesC8 &, VA_LIST, TDes8Overflow * )

IMPORT_C voidAppendFormatList(const TDesC8 &aFmt,
VA_LISTaList,
TDes8Overflow *aOverflowHandler = NULL
)

Formats and appends text onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

The behaviour of this function is the same as AppendFormat(TRefByValue<const TDesC8> aFmt,TDes8Overflow *aOverflowHandler,...). In practice, it is better and easier to use AppendFormat(), passing a variable number of arguments as required by the format string.

See also: TDes8::AppendFormat VA_LIST

Parameters
aFmtThe descriptor containing the format string.
aListA pointer to an argument list.
aOverflowHandlerIf supplied, a pointer to the overflow handler.

AppendJustify ( const TDesC8 &, TInt, TAlign, TChar )

IMPORT_C voidAppendJustify(const TDesC8 &Des,
TIntaWidth,
TAlignanAlignment,
TCharaFill
)

Appends data onto the end of this descriptor's data and justifies it.

The source of the appended data is an existing descriptor.

The target area is considered to be an area of specified width, immediately following this descriptor's existing data. Source data is copied into, and aligned within this target area according to the specified alignment instruction.

If the length of the target area is larger than the length of the source, then spare space within the target area is padded with the fill character.

Parameters
DesAn 8-bit non-modifiable descriptor containing the source data. The length of the data to be copied is the smaller of: the length of the source descriptor, and the width of the target area (only if this is not the explicit negative value KDefaultJustifyWidth).
aWidthThe width of the target area. If this has the specific negative value KDefaultJustifyWidth, then the width is re-set to the length of the data source.
anAlignmentThe alignment of the data within the target area.
aFillThe fill character used to pad the target area.
Panic Codes
USER23 if the resulting length of this descriptor is greater than its maximum length or aWidth has a negative value other than KDefaultJustifyWidth.

AppendJustify ( const TDesC8 &, TInt, TInt, TAlign, TChar )

IMPORT_C voidAppendJustify(const TDesC8 &Des,
TIntaLength,
TIntaWidth,
TAlignanAlignment,
TCharaFill
)

Appends data onto the end of this descriptor's data and justifies it.

The source of the appended data is an existing descriptor.

The target area is considered to be an area of specified width, immediately following this descriptor's existing data. Source data is copied into, and aligned within this target area according to the specified alignment instruction.

If the length of the target area is larger than the length of the source, then spare space within the target area is padded with the fill character.

Parameters
DesAn 8-bit non-modifiable descriptor containing the source data.
aLengthThe length of data to be copied from the source descriptor. If this is greater than the width of the target area, then the length of data copied is limited to the width. The length of data to be copied must not be greater than the length of the source descriptor. Note that this condition is not automatically tested.
aWidthThe width of the target area. If this has the specific negative value KDefaultJustifyWidth, then the width is re-set to the length of the data source.
anAlignmentThe alignment of the data within the target area.
aFillThe fill character used to pad the target area.
Panic Codes
USER23 if the resulting length of this descriptor is greater than its maximum length or aWidth has a negative value other than KDefaultJustifyWidth.

AppendJustify ( const TUint8 *, TInt, TAlign, TChar )

IMPORT_C voidAppendJustify(const TUint8 *aString,
TIntaWidth,
TAlignanAlignment,
TCharaFill
)

Appends a zero terminated string onto the end of this descriptor's data and justifies it.

The zero terminator is not copied.

The target area is considered to be an area of specified width, immediately following this descriptor's existing data. Source data is copied into, and aligned within, this target area according to the specified alignment instruction.

If the length of the target area is larger than the length of the source, then spare space within the target area is padded with the fill character.

Parameters
aStringA pointer to a zero terminated string. The length of the data to be copied is the smaller of: the length of the string (excluding the zero terminator), and the width of the target area (only if this is not the explicit negative value KDefaultJustifyWidth).
aWidthThe width of the target area. If this has the specific negative value KDefaultJustifyWidth, then the width is re-set to the length of the zero terminated string (excluding the zero terminator).
anAlignmentThe alignment of the data within the target area.
aFillThe fill character used to pad the target area.
Panic Codes
USER23 if the resulting length of this descriptor is greater than its maximum length or aWidth has a negative value other than KDefaultJustifyWidth.

AppendJustify ( const TUint8 *, TInt, TInt, TAlign, TChar )

IMPORT_C voidAppendJustify(const TUint8 *aString,
TIntaLength,
TIntaWidth,
TAlignanAlignment,
TCharaFill
)

Appends data onto the end of this descriptor's data and justifies it.

The source of the appended data is a memory location.

The target area is considered to be an area of specified width, immediately following this descriptor's existing data. Source data is copied into, and aligned within, this target area according to the specified alignment instruction.

If the length of the target area is larger than the length of the source, then spare space within the target area is padded with the fill character.

Parameters
aStringA pointer to a source memory location.
aLengthThe length of data to be copied. If this is greater than the width of the target area, then the length of data copied is limited to the width.
aWidthThe width of the target area. If this has the specific negative value KDefaultJustifyWidth, then the width is re-set to the length of the data source.
anAlignmentThe alignment of the data within the target area.
aFillThe fill character used to pad the target area.
Panic Codes
USER23 if the resulting length of this descriptor is greater than its maximum length or aWidth has a negative value other than KDefaultJustifyWidth.
USER29 if aLength is negative.

AppendNum ( TInt64 )

IMPORT_C voidAppendNum(TInt64aVal)

Converts the 64-bit signed integer into a decimal character representation and appends the conversion onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

If the integer is negative, the character representation is prefixed by a minus sign.

Parameters
aValThe 64-bit signed integer value.

AppendNum ( TUint64, TRadix )

IMPORT_C voidAppendNum(TUint64aVal,
TRadixaRadix
)

Converts the specified 64-bit unsigned integer into a character representation based on the specified number system and appends the conversion onto the end of this descriptor's data. The length of this descriptor is incremented to reflect the new content

When a hexadecimal conversion is specified, hexadecimal characters are in lower case.

Parameters
aValThe 64-bit integer value. This is treated as an unsigned value.
aRadixThe number system representation for the 64-bit integer.

AppendNum ( TReal, const TRealFormat & )

IMPORT_C TIntAppendNum(TRealaVal,
const TRealFormat &aFormat
)

Converts the specified floating point number into a character representation and appends the conversion onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

The character representation of the real number is dictated by the specified format.

1.KErrArgument - the supplied floating point number is not a valid number. The three characters NaN are appended to this descriptor.

2.KErrOverflow - the number is too large to represent. 2.1 For positive overflow, the three characters Inf are appended to this descriptor. 2.2 For negative overflow, the four characters -Inf are appended to this descriptor.

3.KErrUnderflow - the number is too small to represent. 3.1 For positive underflow, the three characters Inf are appended to this descriptor. 3.2 For negative underflow, the four characters -Inf are appended to this descriptor.

4.KErrGeneral - the conversion cannot be completed. There are a number of possible reasons for this, but the two most common are: 4.1 the maximum number of characters necessary to represent the number, as defined in the TRealFormat object, is greater than the maximum length of this descriptor 4.2 the character representation format (i.e. the format type), as defined in the TRealFormat object is not recognised

Parameters
aValThe floating point number to be converted.
aFormatThe format of the conversion.
Return Value
If the conversion is successful, the length of this descriptor. If the conversion fails, a negative value indicating the cause of failure. In addition, extra information on the cause of the failure may be appended onto this descriptor. The possible values and their meaning are:

AppendNumFixedWidth ( TUint, TRadix, TInt )

IMPORT_C voidAppendNumFixedWidth(TUintaVal,
TRadixaRadix,
TIntaWidth
)

Converts the specified unsigned integer into a fixed width character representation based on the specified number system and appends the conversion onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

The function generates the exact number of specified characters, either padding to the left with character zeroes or discarding low order characters as necessary.

When a hexadecimal conversion is specified, hexadecimal characters are in lower case.

Parameters
aValThe unsigned integer value.
aRadixThe number system representation for the unsigned integer.
aWidthThe number of characters to be used to contain the conversion, and to be appended to this descriptor.

AppendNumFixedWidthUC ( TUint, TRadix, TInt )

IMPORT_C voidAppendNumFixedWidthUC(TUintaVal,
TRadixaRadix,
TIntaWidth
)

Converts the specified unsigned integer into a fixed width character representation based on the specified number system and appends the conversion onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

The function generates the exact number of specified characters, either padding to the left with character zeroes or discarding low order characters as necessary.

When a hexadecimal conversion is specified, hexadecimal characters are in upper case.

Parameters
aValThe unsigned integer value.
aRadixThe number system representation for the unsigned integer.
aWidthThe number of characters to be used to contain the conversion, and to be appended to this descriptor.

AppendNumUC ( TUint64, TRadix )

IMPORT_C voidAppendNumUC(TUint64aVal,
TRadixaRadix = EDecimal
)

Converts the specified 64-bit unsigned integer into a character representation based on the specified number system and appends the conversion onto the end of this descriptor's data.

The length of this descriptor is incremented to reflect the new content.

When a hexadecimal conversion is specified, hexadecimal characters are in upper case.

Parameters
aValThe 64-bit integer value. This is treated as an unsigned value.
aRadixThe number system representation for the 64-bit integer. If no explicit value is specified, then EDecimal is the default.

Capitalize ( )

IMPORT_C voidCapitalize()

Capitalises the content of this descriptor.

Capitalisation is implemented as appropriate to the current locale.

Collapse ( )

IMPORT_C voidCollapse()

Collapse all characters from 16 to 8 bits

The length of descriptor truncated by 2 (length /= 2).

Panic Codes
USER188 if either the descriptor length or the maximum length is odd or data pointer is not aligned by 2-bytes boundary.

Collate ( )

IMPORT_C voidCollate()

Performs collation on the content of this descriptor. Deprecated

Copy ( const TDesC8 & )

IMPORT_C voidCopy(const TDesC8 &aDes)

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aDesAn 8-bit non-modifiable descriptor. The length of the data cannot be greater than the maximum length of the target descriptor.
Panic Codes
USER23 if the length of aDes is greater than the maximum length of this (target) descriptor.

Copy ( const TUint8 *, TInt )

IMPORT_C voidCopy(const TUint8 *aBuf,
TIntaLength
)

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aBufThe start address of data to be copied.
aLengthThe length of data to be copied.
Panic Codes
USER23 if aLength is greater than the maximum length of this (target) descriptor.

Copy ( const TUint8 * )

IMPORT_C voidCopy(const TUint8 *aString)

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aStringA pointer to a zero-terminated string.
Panic Codes
USER23 if the length of aString, excluding the zero terminator, is greater than the maximum length of this (target) descriptor.

Copy ( const TDesC16 & )

IMPORT_C voidCopy(const TDesC16 &aDes)

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aDesA 16-bit non-modifiable descriptor. Each double-byte value can only be copied into the corresponding single byte when the double-byte value is less than decimal 256. A double-byte value of 256 or greater cannot be copied and the corresponding single byte is set to a value of decimal 1.
Panic Codes
USER23 if the length of the aDes is greater than the maximum length of this (target) descriptor.

CopyC ( const TDesC8 & )

IMPORT_C voidCopyC(const TDesC8 &aDes)

Copies and collates data from the specified descriptor into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Deprecated
Parameters
aDesAn 8 bit non-modifiable descriptor.
Panic Codes
USER23 if the length of aDes is greater than the maximum length of this target descriptor.

CopyCP ( const TDesC8 & )

IMPORT_C voidCopyCP(const TDesC8 &aDes)

Copies text from the specified descriptor and capitalises it before putting it into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

Capitalisation is implemented as appropriate to the current locale.

Parameters
aDesAn 8-bit non-modifiable descriptor.
Panic Codes
USER23 if the length of aDes is greater than the maximum length of this target descriptor.

CopyF ( const TDesC8 & )

IMPORT_C voidCopyF(const TDesC8 &aDes)

Copies and folds data from the specified descriptor into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Note that folding is locale-independent behaviour. It is also important to note that there can be no guarantee that folding is in any way culturally appropriate, and should not be used when dealing with strings in natural language.

Parameters
aDesAn 8-bit non-modifiable descriptor.
Panic Codes
USER23 if the length of aDes is greater than the maximum length of this target descriptor.

CopyLC ( const TDesC8 & )

IMPORT_C voidCopyLC(const TDesC8 &aDes)

Copies text from the specified descriptor and converts it to lower case before putting it into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

Conversion to lower case is implemented as appropriate to the current locale.

Parameters
aDesAn 8-bit non-modifiable descriptor.
Panic Codes
USER23 if the length of aDes is greater than the maximum length of this target descriptor.

CopyUC ( const TDesC8 & )

IMPORT_C voidCopyUC(const TDesC8 &aDes)

Copies text from the specified descriptor and converts it to upper case before putting it into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

Conversion to upper case is implemented as appropriate to the current locale.

Parameters
aDesAn 8-bit non-modifiable descriptor.
Panic Codes
USER23 if the length of aDes is greater than the maximum length of this target descriptor.

Delete ( TInt, TInt )

IMPORT_C voidDelete(TIntaPos,
TIntaLength
)

Deletes data from this descriptor.

The length of this descriptor is changed to reflect the loss of data.

Parameters
aPosThe position within the data where deletion is to start. This is an offset value; a zero value refers to the leftmost data position.
aLengthThe length of data to be deleted. If necessary, the function adjusts this value to ensure that no data beyond the end of the descriptor data area is deleted.
Panic Codes
USER22 if aPos is negative or is greater than the length of this descriptor.

DoAppendNum ( TUint64, TRadix, TUint, TInt )

voidDoAppendNum(TUint64aVal,
TRadixaRadix,
TUintaA,
TIntaW
)[protected]

DoPadAppendNum ( TInt, TInt, const TUint8 * )

voidDoPadAppendNum(TIntaLength,
TIntaW,
const TUint8 *aBuf
)[protected]

Expand ( )

IMPORT_C TPtr16Expand()

Expand all characters from 8 to 16 bits

The length of descriptor increased by 2 (length *= 2).

Return Value
16-bit pointer descriptor to transformed text
Panic Codes
USER187 if either the descriptor length or the maximum length is odd or data pointer is not aligned by 2-bytes boundary

Fill ( TChar )

IMPORT_C voidFill(TCharaChar)

Fills the descriptor's data area with the specified character, replacing any existing data.

The descriptor is filled from the beginning up to its current length. The descriptor's length does not change. It is not filled to its maximum length.

Parameters
aCharThe fill character. The function assumes that the character is non-Unicode, and that it can be represented by a single byte.

Fill ( TChar, TInt )

IMPORT_C voidFill(TCharaChar,
TIntaLength
)

Fills the descriptor's data area with the specified character, replacing any existing data.

The descriptor is filled with the specified number of characters. and its length is changed to reflect this.

Parameters
aCharThe fill character. The function assumes that the character is non-Unicode, and that it can be represented by a single byte.
aLengthThe new length of the descriptor and the number of fill characters to be copied into it.
Panic Codes
USER23 if aLength is negative or is greater than the maximum length of this descriptor.

FillZ ( )

IMPORT_C voidFillZ()

Fills the descriptor's data area with binary zeroes, i.e. 0x00, replacing any existing data.

The descriptor is filled from the beginning up to its current length. The descriptor's length does not change. It is not filled to its maximum length.

FillZ ( TInt )

IMPORT_C voidFillZ(TIntaLength)

Fills the descriptor's data area with binary zeroes, i.e. 0x00, replacing any existing data, and changes its length.

The descriptor is filled with the specified number of binary zeroes. The descriptor's length is changed to reflect this.

Parameters
aLengthThe new length of the descriptor and the number of binary zeroes to be copied into it.
Panic Codes
USER23 if aLength is negative, or is greater than the maximum length of this descriptor.

Fold ( )

IMPORT_C voidFold()

Performs folding on the content of this descriptor.

Note that folding is locale-independent behaviour. It is also important to note that there can be no guarantee that folding is in any way culturally appropriate, and should not be used when dealing with strings in natural language.

Format ( TRefByValue< const TDesC8 >, ... )

IMPORT_C voidFormat(TRefByValue< const TDesC8 >aFmt,
...
)

Formats and copies text into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

The function takes a format string and a variable number of arguments. The format string contains literal text embedded with directives for converting the trailing list of arguments into text.

The embedded directives are character sequences prefixed with the '' character. The literal text is simply copied into this descriptor unaltered while the '' directives are used to convert successive arguments from the trailing list.

The resulting stream of literal text and converted arguments is copied into this descriptor.

The syntax of the embedded directives follows one of four general patterns.

Note that formatting of single numerical values can be achieved more conveniently using the Num() and NumUC() member functions of this class.

The full description of the syntax of a format string cannot be included here. For full details, navigate to the Symbian OS guide, and follow the hierarchy of links:

Symbian OS Guide
	Base
		Using  User Library (E32)
			Buffers and Strings
				Using Descriptors
					How to Use Descriptors
						Format string syntax

See also: TDes8::Num() TDes8::NumUC()

Parameters
aFmtThe descriptor containing the format string. The TRefByValue class provides a constructor which takes a TDesC8 type.
Panic Codes
USER23 if the resulting length of text in this descriptor exceeds the descriptor's maximum length.
USER24 if the format string has incorrect syntax.

FormatList ( const TDesC8 &, VA_LIST )

IMPORT_C voidFormatList(const TDesC8 &aFmt,
VA_LISTaList
)

Formats and copies text into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

The behaviour of this function is the same as Format(). In practice, it is better and easier to use Format(), passing a variable number of arguments as required by the format string.

See also: TDes8::Format() VA_LIST

Parameters
aFmtThe descriptor containing the format string.
aListA pointer to an argument list.

Insert ( TInt, const TDesC8 & )

IMPORT_C voidInsert(TIntaPos,
const TDesC8 &aDes
)

Inserts data into this descriptor.

The length of this descriptor is changed to reflect the extra data.

Parameters
aPosThe position within the data where insertion is to start. This is an offset value; a zero value refers to the leftmost data position.
aDesAn 8 bit non modifiable descriptor whose data is to be inserted.
Panic Codes
USER22 if aPos is negative or is greater than the length of this descriptor.
USER23 if the resulting length of this descriptor is greater than its maximum length.

Justify ( const TDesC8 &, TInt, TAlign, TChar )

IMPORT_C voidJustify(const TDesC8 &aDes,
TIntaWidth,
TAlignanAlignment,
TCharaFill
)

Copies data into this descriptor and justifies it, replacing any existing data.

The length of this descriptor is set to reflect the new data.

The target area is considered to be an area of specified width positioned at the beginning of this descriptor's data area. Source data is copied into, and aligned within this target area according to the specified alignment instruction.

If the length of the target area is larger than the length of the source, then spare space within the target area is padded with the fill character.

Parameters
aDesAn 8-bit non-modifiable descriptor containing the source data. The length of the data to be copied is the smaller of: the length of the source descriptor, and the width of the target area (only if this is not the explicit negative value KDefaultJustifyWidth).
aWidthThe width of the target area. If this has the specific negative value KDefaultJustifyWidth, then the width is re-set to the length of the data source.
anAlignmentThe alignment of the data within the target area
aFillThe fill character used to pad the target area.
Panic Codes
USER23 if the resulting length of this descriptor is greater than its maximum length or aWidth has a negative value other than KDefaultJustifyWidth.

LeftTPtr ( TInt )

IMPORT_C TPtr8LeftTPtr(TIntaLength)const

Extracts the leftmost part of the data.

The function does not cut or remove any data but constructs a modifiable pointer descriptor to represent the leftmost part of the data.

Parameters
aLengthThe length of the data to be extracted. If this value is greater than the length of the descriptor, the function extracts the whole of the descriptor.
Return Value
The 8-bit modifiable pointer descriptor representing the leftmost part of the data.
Panic Codes
USER22 if aLength is negative.

LowerCase ( )

IMPORT_C voidLowerCase()

Converts the content of this descriptor to lower case.

Conversion is implemented as appropriate to the current locale.

MaxLength ( )

TInt MaxLength()const [inline]

Gets the maximum length of the descriptor.

This is the upper limit for the number of 8-bit values or data items that the descriptor can represent.

Return Value
The maximum length of data that the descriptor can represent.

MaxSize ( )

TInt MaxSize()const [inline]

Gets the maximum size of the descriptor.

This is the upper limit for the number of bytes which the data represented by the descriptor can occupy.

Return Value
The maximum size of the descriptor data.

MidTPtr ( TInt )

IMPORT_C TPtr8MidTPtr(TIntaPos)const

Extracts a portion of the data.

The function does not cut or remove any data but constructs a modifiable pointer descriptor to represent the defined portion.

The portion is identified by its starting position and by the length of the remainder of the data starting from the specified position.

Parameters
aPosThe starting position of the data to be extracted. This is an offset value; a zero value refers to the leftmost data position.
Return Value
The 8-bit modifiable pointer descriptor representing the specified portion of the data.
Panic Codes
USER22 if aPos is negative or aPos is greater than the length of the descriptor.

MidTPtr ( TInt, TInt )

IMPORT_C TPtr8MidTPtr(TIntaPos,
TIntaLength
)const

Extracts a portion of the data.

The function does not cut or remove any data but constructs a modifiable pointer descriptor to represent the defined portion.

The portion is identified by its starting position and by its length.

Parameters
aPosThe starting position of the data to be extracted. This is an offset value; a zero value refers to the leftmost data position.
aLengthThe length of data to be extracted.
Return Value
The 8 bit modifiable pointer descriptor representing the specified portion of the data.
Panic Codes
USER22 if aPos is negative or aPos plus aLength is greater than the length of the descriptor.

Num ( TInt64 )

IMPORT_C voidNum(TInt64aVal)

Converts the 64-bit signed integer into a decimal character representation and copies the conversion into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

If the integer is negative, the character representation is prefixed by a minus sign.

Parameters
aValThe 64-bit signed integer value.

Num ( TUint64, TRadix )

IMPORT_C voidNum(TUint64aVal,
TRadixaRadix
)

Converts the specified 64-bit unsigned integer into a character representation based on the specified number system and copies the conversion into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

When a hexadecimal conversion is specified, hexadecimal characters are in lower case.

Parameters
aValThe 64-bit integer value. This is treated as an unsigned value.
aRadixThe number system representation for the 64-bit integer.

Num ( TReal, const TRealFormat & )

IMPORT_C TIntNum(TRealaVal,
const TRealFormat &aFormat
)

Converts the specified floating point number into a character representation and copies the conversion into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

The character representation of the real number is dictated by the specified format.

Note that the function leaves if the iType data member of the specified TRealFormat object has both an invalid character representation format (i.e. the format type) and invalid format flags.

1.KErrArgument - the supplied floating point number is not a valid number. The three characters NaN are appended to this descriptor.

2.KErrOverflow - the number is too large to represent. 2.1 For positive overflow, the three characters Inf are appended to this descriptor. 2.2 For negative overflow, the four characters -Inf are appended to this descriptor.

3.KErrUnderflow - the number is too small to represent. 3.1 For positive underflow, the three characters Inf are appended to this descriptor. 3.2 For negative underflow, the four characters -Inf are appended to this descriptor.

4.KErrGeneral - the conversion cannot be completed. There are a number of possible reasons for this, but the two most common are: 4.1 the maximum number of characters necessary to represent the number, as defined in the TRealFormat object, is greater than the maximum length of this descriptor 4.2 the character representation format (i.e. the format type), as defined in the TRealFormat object is not recognised.

See also: TRealFormat::iType

Parameters
aValThe floating point number to be converted.
aFormatThe format of the conversion.
Return Value
If the conversion is successful, the length of this descriptor. If the conversion fails, a negative value indicating the cause of failure. In addition, extra information on the cause of the failure may be appended onto this descriptor. The possible values and their meaning are:

NumFixedWidth ( TUint, TRadix, TInt )

IMPORT_C voidNumFixedWidth(TUintaVal,
TRadixaRadix,
TIntaWidth
)

Converts the specified unsigned integer into a fixed width character representation based on the specified number system and copies the conversion into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

The function generates the exact number of specified characters, either padding to the left with character zeroes or discarding low order characters as necessary.

When a hexadecimal conversion is specified, hexadecimal characters are in lower case.

This function is equivalent to using Format() with parameters which specify:

1. a fixed length target field

2. padding with zero characters, for example "%08x".

When this is the case, always use NumFixedWidth() in preference to Format() as it is more efficient.

See also: TDes8::Format()

Parameters
aValThe unsigned integer value.
aRadixThe number system representation for the unsigned integer.
aWidthThe number of characters: to be used to contain the conversion, to be copied into this descriptor.

NumFixedWidthUC ( TUint, TRadix, TInt )

IMPORT_C voidNumFixedWidthUC(TUintaVal,
TRadixaRadix,
TIntaWidth
)

Converts the specified unsigned integer into a fixed width character representation based on the specified number system and copies the conversion into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

The function generates the exact number of specified characters, either padding to the left with character zeroes or discarding low order characters as necessary.

When a hexadecimal conversion is specified, hexadecimal characters are in upper case.

This function is equivalent to using Format() with parameters which specify:

1. a fixed length target field

2. padding with zero characters, for example "%08x".

When this is the case, always use NumFixedWidthUC() in preference to Format() as it is more efficient.

See also: TDes8::Format()

Parameters
aValThe unsigned integer value.
aRadixThe number system representation for the unsigned integer.
aWidthThe number of characters to be used to contain the conversion, and to be copied into this descriptor.

NumUC ( TUint64, TRadix )

IMPORT_C voidNumUC(TUint64aVal,
TRadixaRadix = EDecimal
)

Converts the specified 64-bit unsigned integer into a character representation based on the specified number system and copies the conversion into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

When a hexadecimal conversion is specified, hexadecimal characters are in upper case.

Parameters
aValThe 64-bit integer value. This is treated as an unsigned value.
aRadixThe number system representation for the 64-bit integer. If no explicit value is specified, then EDecimal is the default.

PtrZ ( )

IMPORT_C const TUint8 *PtrZ()

Appends a zero terminator onto the end of this descriptor's data and returns a pointer to the data.

The length of the descriptor is not changed. It must, however, be strictly less than the descriptor's maximum length. This condition guarantees that there is sufficient space for the zero terminator.

Return Value
A pointer to the descriptor's zero terminated data.
Panic Codes
USER23 if the descriptor's length is not strictly less than its maximum length.

Repeat ( const TUint8 *, TInt )

IMPORT_C voidRepeat(const TUint8 *aBuf,
TIntaLength
)

Copies data with repetition into this descriptor, from a memory location specified by pointer, replacing any existing data.

Copying proceeds until this descriptor is filled up to its current length. If it cannot contain a whole number of copies of the source data, then the last copy is truncated.

Parameters
aBufA pointer to data to be repeatedly copied.
aLengthThe length of data to be copied.
Panic Codes
USER29 if aLength is negative.

Repeat ( const TDesC8 & )

IMPORT_C voidRepeat(const TDesC8 &aDes)

Copies data with repetition into this descriptor, from another descriptor, replacing any existing data.

Copying proceeds until this descriptor is filled up to its current length. If it cannot contain a whole number of copies of the source data, then the last copy is truncated.

Parameters
aDesAn 8-bit non-modifiable descriptor whose data is to be repeatedly copied.

Replace ( TInt, TInt, const TDesC8 & )

IMPORT_C voidReplace(TIntaPos,
TIntaLength,
const TDesC8 &aDes
)

Replaces data in this descriptor.

The specified length can be different to the length of the replacement data. The length of this descriptor changes to reflect the change of data.

Parameters
aPosThe position within the data where replacement is to start. This is an offset value; a zero value refers to the leftmost data position.
aLengthThe length of data to be replaced.
aDesThe source 8-bit non-modifiable descriptor whose data is to replace the target descriptor's data at aPos.
Panic Codes
USER20 if aLength is negative or the sum of aLength and aPos is greater than the length of this descriptor.
USER22 if aPos is negative or is greater than the length of this descriptor.
USER23 if the resulting length of this descriptor is greater than its maximum length.
USER28 if the length of the source descriptor aDes is negative or is greater than the maximum length of this target descriptor,

RightTPtr ( TInt )

IMPORT_C TPtr8RightTPtr(TIntaLength)const

Extracts the rightmost part of the data.

The function does not cut or remove any data but constructs a modifiable pointer descriptor to represent the rightmost part of the data.

Parameters
aLengthThe length of data to be extracted. If this value is greater than the length of the descriptor, the function extracts the whole of the descriptor.
Return Value
The 8 bit modifiable pointer descriptor representing the rightmost part of the data.
Panic Codes
USER22 if aLength is negative.

SetLength ( TInt )

IMPORT_C voidSetLength(TIntaLength)

Sets the length of the data represented by the descriptor to the specified value.

Parameters
aLengthThe new length of the descriptor.
Panic Codes
USER23 if alength is negative or is greater than the maximum length of this (target) descriptor.

SetMax ( )

IMPORT_C voidSetMax()

Sets the length of the data to the maximum length of the descriptor.

Swap ( TDes8 & )

IMPORT_C voidSwap(TDes8 &aDes)

Swaps the data represented by this descriptor with the data represented by the specified descriptor.

The lengths of both descriptors are swapped to reflect the change.

Note that each descriptor must be capable of accommodating the contents of the other descriptor.

Parameters
aDesThe 8-bit modifiable descriptor whose data is to be swapped with the data of this descriptor.
Panic Codes
USER23 if the maximum length of either descriptor is smaller than the length of the other descriptor.

Trim ( )

IMPORT_C voidTrim()

Deletes leading and trailing whitespace characters from the descriptor's data.

The length of the descriptor is reduced to reflect the loss of the whitespace characters.

See also: TDes8::TrimLeft() TDes8::TrimRight()

TrimAll ( )

IMPORT_C voidTrimAll()

Deletes leading and trailing whitespace characters from the descriptor's data and replaces each contiguous set of whitespace characters within the data by one whitespace character.

The length of the descriptor is reduced to reflect the loss of the whitespace characters.

See also: TDes8::Trim()

TrimLeft ( )

IMPORT_C voidTrimLeft()

Deletes leading whitespace characters from the descriptor's data.

All whitespace characters up to, but not including the first non-whitespace character, are deleted.

The length of the descriptor is reduced to reflect the loss of the whitespace characters.

TrimRight ( )

IMPORT_C voidTrimRight()

Deletes trailing whitespace characters from the descriptor's data.

The process starts on the right hand side of the descriptor's data and proceeds to the left.

All whitespace characters up to, but not including the first non-whitespace character, are deleted.

The length of the descriptor is reduced to reflect the loss of the whitespace characters.

UpperCase ( )

IMPORT_C voidUpperCase()

Converts the content of this descriptor to upper case.

Conversion is implemented as appropriate to the current locale.

WPtr ( )

TUint8 *WPtr()const [protected, inline]

Zero ( )

IMPORT_C voidZero()

Sets the length of the data to zero.

ZeroTerminate ( )

IMPORT_C voidZeroTerminate()

Appends a zero terminator onto the end of this descriptor's data.

The length of the descriptor is not changed. It must, however, be strictly less than the descriptor's maximum length. This condition guarantees that there is sufficient space for the zero terminator.

Panic Codes
USER23 if the descriptor's length is not strictly less than its maximum length.

operator+= ( const TDesC8 & )

TDes8 &operator+=(const TDesC8 &aDes)[inline]

Appends data onto the end of this descriptor's data and returns a reference to this descriptor.

The length of this descriptor is incremented to reflect the new content.

Parameters
aDesAn-8 bit non-modifiable descriptor whose data is to be appended.
Return Value
A reference to this descriptor.
Panic Codes
USER23, if the resulting length of this descriptor is greater than its maximum length.

operator= ( const TUint8 * )

TDes8 &operator=(const TUint8 *aString)[inline]

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aStringA pointer to a zero-terminated string.
Return Value
A reference to this, the target descriptor.
Panic Codes
USER23, if the length of the string, excluding the zero terminator, is greater than the maximum length of this (target) descriptor.

operator= ( const TDesC8 & )

TDes8 &operator=(const TDesC8 &aDes)[inline]

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aDesAn 8-bit non-modifiable descriptor.
Return Value
A reference to this, the target descriptor.
Panic Codes
USER23, if the length of the descriptor aDes is greater than the maximum length of this (target) descriptor.

operator= ( const TDes8 & )

TDes8 &operator=(const TDes8 &aDes)[inline]

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters
aDesAn 8-bit modifiable descriptor.
Return Value
A reference to this, the target descriptor.
Panic Codes
USER23, if the length of the descriptor aDes is greater than the maximum length of this (target) descriptor.

operator[] ( TInt )

const TUint8 &operator[](TIntanIndex)const [inline]

Gets a const reference to a single data item within this descriptor's data.

Parameters
anIndexThe position of the data item within this descriptor's data. This is an offset value; a zero value refers to the leftmost data position.
Return Value
A const reference to the data item at the specified position.
Panic Codes
USER21, if anIndex is negative or is greater than or equal to the current length of this descriptor.

operator[] ( TInt )

TUint8 &operator[](TIntanIndex)[inline]

Gets a non-const reference to a single data item within this descriptor's data.

Parameters
anIndexThe position of the data item within this descriptor's data. This is an offset value; a zero value refers to the leftmost data position.
Return Value
A non-const reference to the data item at the specified position.
Panic Codes
USER21, if anIndex is negative or is greater than or equal to the current length of this descriptor.