ErrorOnFail
—cleanup, TRAPD and leavingThe example attempts to construct an object, and on failure it returns an appropriate error code.
This example shows use of the TRAPD
macro, the
cleanup stack and its functions PushL()
,
PopAndDestroy()
and the process of leaving. It also uses the heap
debugging macro __UHEAP_SETFAIL
.
As with the ErrorOnFail example, this example also attempts to construct an object, however on failure it simply leaves.
This example shows use of the TRAPD
macro, the
cleanup stack and its functions PushL()
,
PopAndDestroy()
and the process of leaving. It also uses the heap
debugging macro __UHEAP_SETFAIL
.
This example attempts to construct an object using the overloaded
new
operator new (ELeave)
. Specifying
(ELeave)
will cause a leave to occur if it was unable to allocate
memory for the new object.
This example shows use of the TRAPD
macro, the
cleanup stack and its functions PushL()
,
PopAndDestroy()
and the process of leaving. It also uses the heap
debugging macro __UHEAP_SETFAIL
.
The example shows the use of the TRAPD
macro. It
shows how a newly created object can be protected by the TRAPD
macro.
The example shows the use of the cleanup stack and its functions
PushL()
and Pop()
.
The example also uses the heap debugging macro
__UHEAP_SETFAIL.
The example shows the use of the cleanup stack and its functions
PushL()
and PopAndDestroy()
.
The example also uses the heap debugging macro
__UHEAP_SETFAIL.
The example shows use of the NewL()
static function.
The example also uses the heap debugging macro
__UHEAP_SETFAIL
.
The example shows use of the NewLC()
static
function.
The example also uses the heap debugging macro
__UHEAP_SETFAIL
.
This example shows cleanup handling for compound classes. The robustness of a simple class on Out Of Memory (OOM) is tested.
This example shows cleanup handling for compound classes. The robustness of a compound class on Out Of Memory (OOM) is tested. It also shows how memory leaks can occur.
These examples show cleanup handling for compound classes. The robustness of a compound class on Out Of Memory (OOM) is tested. It also shows the use of the two phase construction technique.
The example shows how cleanup can be implemented for
TAny*
type objects and 'R' type (resource type) objects.
This example shows the use of TAny*
cleanup type,
for pushing a buffer to the cleanup stack. The buffer data is read from a file.
Class RFileWithCleanup
is derived from class
RFile
, to show how to add cleanup support to a general
R
class.
This example adds cleanup support to the
RFile
.
The example shows how cleanup can be implemented for
TAny
* type objects and 'R' type (resource type) objects.
This example is similar to the
TAnyRObjects1
example. However, it enhances the interface to include an OpenLC()
which opens the file, and pushes it on to the cleanup stack in one function
call.
This example shows how the cleanup utilities (the templated
functions CleanupDeletePushL()
, CleanupClosePushL()
and CleanupReleasePushL()
) can be used.
In addition to the templated functions:
CleanupDeletePushL()
CleanupClosePushL()
CleanupReleasePushL()
the examples implicitly use the templated classes:
CleanupDelete<class T>
CleanupClose<class T>
CleanupRelease<class T>