diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-5872329F-2B52-5F52-83C1-205F2F933877.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-5872329F-2B52-5F52-83C1-205F2F933877.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,48 @@ + + + + + +OR_LEAVE +macro TutorialMacro is a rule or pattern that specifies how a certain input sequence +should be mapped to an output sequence according to a defined procedure. This +tutorial describes the OR_LEAVE macro and provides details on how the OR_LEAVE +macro should be used. +
Required background

Before beginning you must know +the following:

    +
  • UserLeaveIfError() : Error +handling code. This function is called when a client is passing a file for +a server to handle.

  • +
+
Introduction

The OR_LEAVE macro is a convenience +macro that allows the developer to deemphasize auxiliary error checking code +in most cases. It is a postfix macro which implements User::LeaveIfError() on +an integer return type. This means that there is less focus on the error handling +code and makes the code easier to read.

Defining a OR_LEAVE macro

The +OR_LEAVE macro is defined as a postfix operator. An example code snippet is +shown below:

+#define OR_LEAVE || Eleave +inline void operator||(Tint aStatus, Tleave /*aTag*/) + { + User::LeaveIfError(aStatus); + } +

It is a postfix macro which implements User::LeaveIfError() function +on an integer return type. This means that there is less focus on the error +handling code and makes the code easier to read.

+
Using OR_LEAVE macro

The OR_LEAVE +is used to replace a call to User::LeaveIfError() function. +An example code snippet is shown below:

User::LeaveIfError(iTimer->CreateLocal());

The +call to iTimer->CreateLocal() is included within the error +handling code User::LeaveIfError() function and is difficult +to read. The following fragment uses the OR_LEAVE macro.

iTimer->CreateLocal() OR_LEAVE; +
+
+EUser High +Level Library Overview +
\ No newline at end of file