|
Symbian sdk帮助-类TDes8
译文作者:LeeFJ |
| 译文版本:1.0 译文时间:2005-11-14 |
|
|
Location: e32des8.h
Link against: euser.lib
定义于:e32des8.h
连接文件:euser.lib
Class TDes8
TDes8
Support
Supported from 5.0
类 TDes8
支 持
支持5.0和5.0以上版本
Description
Modifiable 8-bit descriptor; abstract class. 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.
描 述
可修改的8位描述符;抽象类。这个类封了8位描述符类型所包含的相关数据成员,例如描述符号的最大长度。它同时也包括也一些方法成员,这些方法成员可以用语修改描述符中存储的数据。
The class adds to the behaviour provided by the base class.
这个类在其基类的基础上添加了它自己的一些行为特性。
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.
这个类是抽象类,它将作为类的继承层次的一部分,所以它是不可被实例化的。它提供了一组定义良好的描述符行为。如果在函数中需要对描述符进行访问和修改,那么就可以使用这个类型作为函数的参数类型。
Derivation
TDesC8 - Abstract base class for 8 bit non-modifiable descriptors
TDes8 - Modifiable 8-bit descriptor; abstract class
派生关系
TDesC8 - 抽象基类,8位不可修改描述符。
TDes8 - 8位可修改描述符,抽象类。
Members
Defined in TDes8:
类成员
定义于TDes8的类成员:
Append(), Append(), Append(), Append(), AppendFill(), AppendFormat(), AppendFormatList(), AppendJustify(), AppendJustify(), AppendJustify(), AppendJustify(), AppendNum(), AppendNum(), AppendNum(), AppendNum(), AppendNum(), AppendNumFixedWidth(), AppendNumFixedWidthUC(), AppendNumUC(), AppendNumUC(), Capitalize(), Collate(), Copy(), Copy(), Copy(), Copy(), CopyC(), CopyCP(), CopyF(), CopyLC(), CopyUC(), Delete(), Fill(), Fill(), FillZ(), Fillz(), Fold(), Format(), FormatList(), Insert(), Justify(), LowerCase(), MaxLength(), MaxSize(), Num(), Num(), Num(), Num(), Num(), NumFixedWidth(), NumFixedWidthUC(), NumUC(), NumUC(), PtrZ(), Repeat(), Repeat(), Replace(), SetLength(), SetMax(), Swap(), Trim(), TrimAll(), TrimLeft(), TrimRight(), UpperCase(), Zero(), ZeroTerminate(), operator+=(), operator=(), operator=(), operator=(), operator[](), operator[]()
Inherited from TDesC8:
继承于TDes8的类成员:
Alloc(), AllocL(), AllocLC(), Compare(), CompareC(), CompareF(), Find(), FindC(), FindF(), Left(), Length(), Locate(), LocateF(), LocateReverse(), LocateReverseF(), Match(), MatchC(), MatchF(), Mid(), Ptr(), Right(), Size(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=()
See also:
TDesC8
TDesC16
另见:
TDesC8
TDesC16
--------------------------------------------------------------------------------
Data characteristics
数据特性
--------------------------------------------------------------------------------
MaxLength()
TInt MaxLength() const;
Description
Returns 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.
描 述
返回描述符的最大长度。它是描述符可以表现的8位值或数据项的数量上限。
Return value
TInt The maximum length of data that the descriptor can represent.
返回值
TInt型常量 描述符可表现数据的最大长度。
--------------------------------------------------------------------------------
MaxSize()
TInt MaxSize() const;
Description
Returns 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
TInt The maximum size of the descriptor data
返回值
TInt型常量 描述符数据的最大尺寸。
--------------------------------------------------------------------------------
Changing data characteristics
更改数据特性
--------------------------------------------------------------------------------
SetLength()
void SetLength(TInt aLength)
Description
Sets the data length. Sets the length of the data represented by the descriptor to the specified value.
描 述
设置数据长度。以一个指定值设置描述符的数据长度。
Parameters
TInt aLength The new length of the descriptor data. This value must be non-negative and must not be greater than the maximum length otherwise the function raises a USER 23 panic.
参 数
TInt aLength 一个新的描述符数据长度值。这个值必须是非负的并且不可以超过描述符的最大长度,否则函数将抛出 USER 23 异常。
--------------------------------------------------------------------------------
SetMax()
void SetMax()
Description
Sets the length of the data to the maximum length of the descriptor.
描 述
设置数据长度为描述符的最大长度。
--------------------------------------------------------------------------------
Zero()
void Zero()
Description
Sets the length of the data to zero.
描 述
设置数据长度为零。
--------------------------------------------------------------------------------
Accessing individual data items
独立数据项访问
--------------------------------------------------------------------------------
operator[]()
const TUint8& operator[](TInt anIndex) const;
Description
Returns a const reference to a single data item within this descriptor's data.
描 述
返回描述符中单个数据项的常量引用。
Parameters
TInt anIndex The position the data item within this descriptor's data. This is an offset; a zero value refers to the leftmost data position. This value must be non-negative and must be less than the current length of this descriptor otherwise the operation raises a USER 21 panic.
参 数
TInt anIndex 数据项在描述符号中的位置。这是一个偏移量;如果这个值是零,那么返回描述符最左侧的数据项。这个值不可以为负值并且必须小于当前描述符的长度否则将抛出 USER 21 异常。
Return value
const TUint8& A const reference to the data item at the specified position.
返回值
const TUint8& 指定位置的数据项常量引用。
TUint8& A non-const reference to the data item at the specified position.
TUint8& 指定位置的数据项非常量引用。
示例代码
TBuf<10> a=_L("gooooo");
TUint b=a[0];
CS->Printf(_L("%c"),b);
--------------------------------------------------------------------------------
operator[]()
TUint8& operator[](TInt anIndex);
Description
Returns a non-const reference to a single data item within this descriptor's data.
描 述
返回描述符中单个数据项的非常量引用。
Parameters
TInt anIndex The position the data item within this descriptor's data. This is an offset; a zero value refers to the leftmost data position. This value must be non-negative and must be less than the current length of this descriptor otherwise the operation raises a USER 21 panic.
参 数
TInt anIndex 数据项在描述符号中的位置。这是一个偏移量;如果这个值是零,那么返回描述符最左侧的数据项。这个值不可以为负值并且必须小于当前描述符的长度否则将抛出 USER 21 异常。
Return value
TUint8& A non-const reference to the data item at the specified position.
返回值
const TUint8& 指定位置的数据非项常量引用。
--------------------------------------------------------------------------------
Copying data, replacing existing data
数据拷贝,原有数据替换
--------------------------------------------------------------------------------
Copy()
void Copy(const TDesC8& aDes);
Description
Copies data into this descriptor replacing any existing data.
描 述
拷贝数据到当前描述符,并覆盖所有原有数据.
The length of this descriptor is set to reflect the new data.
描述符的长度也被设置为新数据的长度.
Parameters
const TDesC8& aDes An 8 bit non modifiable descriptor. The length of the data cannot be greater than the maximum length of the target descriptor otherwise the function raises a USER 23 panic.
参 数
const TDesC8& aDes 8位不可修改描述符号.参数的数据长度不可以超过目标描述符的最大长度,否则将出发 USER 23 异常.
实例代码
TBuf<10> a=_L("gooooo");
TUint b=a[0];
CS->Printf(_L("\n1::%c\n"),b);
a.Copy(_L("1233333333"));
CS->Printf(a);
CS->Printf(_L(",%d\n"),a.Length());
--------------------------------------------------------------------------------
Copy()
void Copy(const TDesC16& aDes);
Description
Copies data into this descriptor replacing any existing data.
描 述
拷贝数据到当前描述符并覆盖原有数据.
The length of this descriptor is set to reflect the new data.
描述符的长度将被设置为新数据长度.
Parameters
const TDesC16& aDes A 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. The length of the data cannot be greater than the maximum length of the target descriptor otherwise the function raises a USER 23 panic
参 数
const TDesC16& aDes 16位不可修改描述符.如果双字节值小于十进制256,那么这个双字节的值就可以被拷贝到单字节中.如果这个双字节值刚好等于或大于256,那么对应单字节将被设置成十进制1.新数据的长度不可以大于原有描述符的最大长度,否则将抛出 USER 23 异常.
--------------------------------------------------------------------------------
Copy()
void Copy(const TUint8* aBuf,TInt aLength);
Description
Copies data into this descriptor replacing any existing data.
描 述
拷贝数据到当前描述符并覆盖原有数据.
The length of this descriptor is set to reflect the new data.
描述符的长度将被设置为新数据长度.
Parameters
const TUint8* aBUf A pointer to data to be copied.
参 数
TUint8* aBuf 指向将要被拷贝数据的指针。
TInt aLength The length of data to be copied. This value must be non-negative and must not be greater than maximum length of the target descriptor, otherwise the function raises a USER 23 panic.
TInt aLength 将要拷贝数据的长度。这个值不可以是负值或超过描述符的最大长度,否则将抛出 USER 23 异常。
--------------------------------------------------------------------------------
Copy()
void Copy(const TUint8* aString);
Description
Copies data into this descriptor replacing any existing data.
描 述
拷贝数据到当前描述符并覆盖原有数据.
The length of this descriptor is set to reflect the new data.
描述符的长度将被设置为新数据长度.
Parameters
const TUint8* aString A pointer to a zero-terminated string. The length of the string, excluding the zero terminator, must not be greater than the maximum length of the target descriptor, otherwise the function raises a USER 23 panic.
const TUint8* aString
参 数
一个指向有\0终结符的字符串。字符串的长度,包括\0终结符,不可以超过目标描述符的最大长度,否则将抛出 USER 23 异常。
--------------------------------------------------------------------------------
operator=()
TDes8& operator=(const TDesC8& aDes);
Description
Copies data into this descriptor replacing any existing data. The length of this descriptor is set to reflect the new data.
描 述
拷贝数据到描述符,并覆盖原来数据,描述符的长度被设置为新数据的长度。
Parameters
const TDesC8& aDes An 8 bit non-modifiable descriptor. The length of the data cannot be greater than the maximum length of the target descriptor, otherwise the function raises a USER 23 panic.
参 数
const TDesC8& aDes 一个8位不可修改描述符。参数长度不可长过目标描述符的最大长度,否则将抛出 USER 23 异常。
Return value
TDes8& A reference to this, the target descriptor
返回值
TDes8& 一个对当前描述符的引用。
--------------------------------------------------------------------------------
operator=()
TDes8& operator=(const TDes8& aDes);
Description
Copies data into this descriptor replacing any existing data.
The length of this descriptor is set to reflect the new data.
描 述
拷贝数据到描述符,并覆盖原来数据,描述符的长度被设置为新数据的长度。
Parameters
const TDes8& aDes An 8 bit modifiable descriptor. The length of the data cannot be greater than the maximum length of the target descriptor, otherwise the function raises a USER 23 panic.
参 数
const TDesC8& aDes 一个8位可修改描述符。参数长度不可长过目标描述符的最大长度,否则将抛出 USER 23 异常。
Return value
TDes8& A reference to this, the target descriptor
返回值
TDes8& 一个对当前描述符的引用。
--------------------------------------------------------------------------------
operator=()
TDes8& operator=(const TUint8* aString);
Description
|