函数是不是会Leave 这个在symbian中是以函数名的形式提供 函数名后面是L的表示它会Leave 函数名后面是LC的表示它会Leave,并且已经把指针push到cleanupstack中了
leave的情况: 是不是任何情况都会Leave呢 当然不是 只有资源申请失败或是操作失败时时会Leave 在系统库提供的函数是这样的
一般它也会提供不Leave的相同功能的函数 如Defined in TDesC8: 看TDesc8的类说明 Alloc(), AllocL(), AllocLC(), Compare(), CompareC(), CompareF(), Find(), Find(), FindC(), FindC(), FindF(), FindF(), Left(), Length(), Locate(), LocateF(), LocateReverse(), LocateReverseF(), Match(), MatchC(), MatchF(), Mid(), Mid(), Ptr(), Right(), Size(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), operator[]()
这里提供了Alloc()和AllocL() 看它们的说明 Alloc() HBufC8* Alloc() const; Description Creates a new 8 bit heap descriptor and initialises it with a copy of this descriptor's data.
Return value HBufC8* A pointer to the new 8 bit heap descriptor, if creation is successful. NULL, if creation of the descriptor fails.
--------------------------------------------------------------------------------
AllocL() HBufC8* AllocL() const; Description Creates a new 8 bit heap descriptor and initialises it with a copy of this descriptor's data.
The function leaves, if creation of the descriptor fails.
Return value HBufC8* A pointer to the 8 bit heap descriptor, if creation is successful.
See also: Creating a heap descriptor
AllocLC() HBufC8* AllocLC() const; Description Creates a new 8 bit heap descriptor and initialises it with a copy of this descriptor's data
The function leaves, if creation of the descriptor fails.
Return value HBufC8* A pointer to the 8 bit heap descriptor, if creation is successful. The pointer is also put onto the cleanup stack.
对其它函数也一样
可以根据自己的需要来调用带L或是不带L的函数
必然会有不带L的函数 可能有带L的相同功能函数 其实上面还有一个特殊的符号 那就是_L 在symbian中是使用描述符的概念,与普通c/c++程序中字符串的概念不一样 后面会介绍它
|