diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-16DD2138-617F-57EA-9A35-70155AA7F7D1.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-16DD2138-617F-57EA-9A35-70155AA7F7D1.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,187 @@ + + + + + +Cleanup +Support Example CodeExample codes that explain how to use various cleanup functions. + +
ErrorOnFail: +cleanup, TRAPD and leaving

Download

Click on the +following link to download the example: ErrorOnFail.zip

Click: browse to view the example code.

Description

The +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.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
LeaveOnFail: +cleanup, TRAPD and leaving

Download

Click on the +following link to download the example: LeaveOnFail.zip

Click: browse to view the example code.

Description

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.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
ELeaveOnFail: +cleanup, TRAPD and leaving

Download

Click on the +following link to download the example: ELeaveOnFail.zip

Click: browse to view the example code.

Description

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.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
TrapD: cleanup, +TRAPD and leaving

Download

Click on the following +link to download the example: TrapD.zip

click: browse to view the example code.

Description

The +example shows the use of the TRAPD macro. It shows how a +newly created object can be protected by the TRAPD macro.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
PushLAndPop: +cleanup, TRAPD and leaving

Download

Click on the +following link to download the example: PushLAndPop.zip

Click: browse to view the example code.

Description

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.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
PushLPopDest: +cleanup, TRAPD and leaving

Download

Click on the +following link to download the example: PushLPopDest.zip

Click: browse to view the example code.

Description

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.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
NewL: cleanup, +TRAPD and leaving

Download

Click on the following +link to download the example: NewL.zip

Click: browse to view the example code.

Description

The +example shows use of the NewL() static function.

The +example also uses the heap debugging macro __UHEAP_SETFAIL.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
NewLC: cleanup, +TRAPD and leaving

Download

Click on the following +link to download the example: NewLC.zip

Click: browse to view the example code.

Description

The +example shows use of the NewLC() static function.

The +example also uses the heap debugging macro __UHEAP_SETFAIL.

Class +summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
SimpleOOM—cleaning +up compound classes

Download

Click on the following +link to download the example: SimpleOOM.zip

Click: browse to view the example code.

Description

This +example shows cleanup handling for compound classes. The robustness of a simple +class on Out Of Memory (OOM) is tested.

Class summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
MemLeakOOM: +cleaning up compound classes

Download

Click on the +following link to download the example: MemLeakOOM.zip

Click: browse to view the example code.

Description

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.

Class summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
TwoPhaseOOM: +cleaning up compound classes

Download

Click on the +following link to download the example: TwoPhaseOOM.zip

click: browse to view the example code.

Description

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.

Class summary

    +
  • CleanupStack

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
TAnyRObjects1: +cleaning up TAny* and ‘R’ type objects

Download

Download +the example: TAnyRObjects1.zip

Download some additional +files required by the example: CommonFramework.zip , HeaderFile.zip

View the source code: browse . View the additional files:CommonFramework , HeaderFile

Description

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.

Class summary

    +
  • CleanupStack

  • +
  • RFile

  • +

Security issues

The example writes files to the executable's +process private directory on the writable drive: \private\0FFFFF01\.

The +second UID in the .mmp file is defined as 0x0FFFFF01 and +this is used as the secure ID on which the name of the private directory is +based.

+
TAnyRObjects2: +cleaning up TAny* and ‘R’ type objects

Download

Download +the example:TAnyRObjects2.zip

Download some additional +files required by the example: CommonFramework.zip , HeaderFile.zip

View the source code: browse . View the additional files: CommonFramework , HeaderFile.

Description

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.

Class +summary

    +
  • CleanupStack

  • +
  • RFile

  • +

Security issues

The example writes files to the executable's +process private directory: C:\private\0FFFFF02\.

The +second UID in the .mmp file is defined as 0x0FFFFF02 and +this is used as the secure ID on which the name of the private directory is +based.

+
Utilities: +cleanup utilities

Download

Download the example: Utilities.zip

CommonFramework.zip.

View the source code: browse. View the additional file: browse

Description

This example +shows how the cleanup utilities (the templated functions CleanupDeletePushL(), CleanupClosePushL() and CleanupReleasePushL(), and CleanupArrayDeletePushL()) can be used.

Class +summary

In addition to the templated functions:

    +
  • CleanupDeletePushL()

  • +
  • CleanupClosePushL()

  • +
  • CleanupReleasePushL()

  • +
  • CleanupArrayDeletePushL()

  • +

the examples implicitly use the templated classes:

Examples +of APIs

    +
  • CleanupDelete<class T>

  • +
  • CleanupClose<class T>

  • +
  • CleanupRelease<class T>

  • +
  • CleanupArrayDelete<class T>

  • +

Security issues

The example requires no specific capabilities +in order to run - and does not demonstrate any security issues.

+
\ No newline at end of file