epoc32/include/emisc.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     2
// All rights reserved.
williamr@4
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@4
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     7
//
williamr@4
     8
// Initial Contributors:
williamr@4
     9
// Nokia Corporation - initial contribution.
williamr@4
    10
//
williamr@4
    11
// Contributors:
williamr@4
    12
//
williamr@4
    13
// Description:
williamr@4
    14
//
williamr@4
    15
williamr@4
    16
#ifndef EMISC_H
williamr@4
    17
#define EMISC_H
williamr@4
    18
williamr@4
    19
#include <e32base.h>
williamr@4
    20
williamr@4
    21
/**
williamr@4
    22
	@file
williamr@4
    23
williamr@4
    24
	Miscellaneous utilities that can help make code more readable.
williamr@4
    25
*/
williamr@4
    26
williamr@4
    27
/**
williamr@4
    28
   A convenience postfix macro that is equivalent to wrapping the
williamr@4
    29
   preceding expression with User::LeaveIfError().
williamr@4
    30
williamr@4
    31
   The code:
williamr@4
    32
   @code
williamr@4
    33
   fs.Connect() OR_LEAVE;
williamr@4
    34
   @endcode
williamr@4
    35
williamr@4
    36
   is equivalent to:
williamr@4
    37
williamr@4
    38
   @code
williamr@4
    39
   User::LeaveIfError(fs.Connect());
williamr@4
    40
   @endcode
williamr@4
    41
williamr@4
    42
   The implementation happens to rely on overloading operator|| for
williamr@4
    43
   TLeave. However, this macro is not intended for use within general
williamr@4
    44
   expressions, just to guard individual calls to methods that may
williamr@4
    45
   return an error code.
williamr@4
    46
 */
williamr@4
    47
#define OR_LEAVE || ELeave
williamr@4
    48
williamr@4
    49
/**
williamr@4
    50
   Enabling overload for OR_LEAVE. Should only be invoked via
williamr@4
    51
   OR_LEAVE, never directly.
williamr@4
    52
 */
williamr@4
    53
inline void operator||(TInt aStatus, TLeave /*aTag*/)
williamr@4
    54
	{
williamr@4
    55
	User::LeaveIfError(aStatus);
williamr@4
    56
	}
williamr@4
    57
williamr@4
    58
#endif // !EMISC_H
williamr@4
    59