Symbian3/SDK/Source/GUID-5872329F-2B52-5F52-83C1-205F2F933877.dita
changeset 0 89d6a7a84779
--- /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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-5872329F-2B52-5F52-83C1-205F2F933877" xml:lang="en"><title>OR_LEAVE
+macro Tutorial</title><shortdesc>Macro 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. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<section><title>Required background</title> <p>Before beginning you must know
+the following: </p> <ul>
+<li id="GUID-13B9C89C-BFF4-553F-B647-034322ADFAE2"><p> <xref href="GUID-611F17E3-DC06-33B7-AE5E-E69B5AEC5969.dita"><apiname>UserLeaveIfError()</apiname></xref> <b> :</b> Error
+handling code. This function is called when a client is passing a file for
+a server to handle. </p> </li>
+</ul> </section>
+<section><title>Introduction</title> <p>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 <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-96AFAC46-F3AD-392B-8A97-AFCBF2978CFB"><apiname>User::LeaveIfError()</apiname></xref> on
+an integer return type. This means that there is less focus on the error handling
+code and makes the code easier to read. </p> <title>Defining a OR_LEAVE macro </title> <p>The
+OR_LEAVE macro is defined as a postfix operator. An example code snippet is
+shown below: </p> <codeblock id="GUID-031AA312-AB5E-5B0F-940C-33DD71A82BCC" xml:space="preserve">
+#define OR_LEAVE || Eleave
+inline void operator||(Tint aStatus, Tleave /*aTag*/)
+    {
+    User::LeaveIfError(aStatus);
+    }
+</codeblock> <p>It is a postfix macro which implements <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-96AFAC46-F3AD-392B-8A97-AFCBF2978CFB"><apiname>User::LeaveIfError()</apiname></xref> 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. </p> </section>
+<section><title>Using OR_LEAVE macro</title><p>The <codeph>OR_LEAVE</codeph> 
+is used to replace a call to <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-96AFAC46-F3AD-392B-8A97-AFCBF2978CFB"><apiname>User::LeaveIfError()</apiname></xref> function.
+An example code snippet is shown below:  </p><codeblock xml:space="preserve">User::LeaveIfError(iTimer-&gt;CreateLocal());</codeblock><p>The
+call to <codeph>iTimer-&gt;CreateLocal()</codeph> is included within the error
+handling code <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-96AFAC46-F3AD-392B-8A97-AFCBF2978CFB"><apiname>User::LeaveIfError()</apiname></xref> function and is difficult
+to read. The following fragment uses the <codeph>OR_LEAVE</codeph> macro. </p><codeblock xml:space="preserve">iTimer-&gt;CreateLocal() OR_LEAVE;
+</codeblock></section>
+</conbody><related-links>
+<link href="GUID-B007634D-4D55-528A-8B85-6120C633AC8B.dita"><linktext>EUser High
+Level Library  Overview</linktext></link>
+</related-links></concept>
\ No newline at end of file