lowlevellibsandfws/apputils/inc/BaAssert.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __BAASSERT_H__
       
    17 #define __BAASSERT_H__
       
    18 
       
    19 #include <baflpan.h>
       
    20 
       
    21 /** TBaAssert class has two methods: AssertDebL and AssertRelL, which
       
    22 can do a panic or leave depending on the iErrorAction value.
       
    23 If the TBaAssert object is created with TBaAssert::ELeave
       
    24 constant, then AssertDebL/AssertRelL methods will leave when called
       
    25 (if aAssertExprVal argument is EFalse).
       
    26 If the TBaAssert object is created with TBaAssert::EPanic
       
    27 constant, then AssertDebL/AssertRelL methods will panic when called
       
    28 (if aAssertExprVal argument is EFalse).
       
    29 If the TBaAssert object is created using the default constructor - by default
       
    30 the methods will panic.
       
    31 The class size has to be exactly sizeof(enum), because objects of that class are
       
    32 used in some legacy code - replacing an existing enum data member.
       
    33 @internalComponent */
       
    34 class TBaAssert
       
    35 	{
       
    36 public:
       
    37 	enum TErrorAction
       
    38 		{
       
    39 		EPanic,
       
    40 		ELeave
       
    41 		};
       
    42 public:
       
    43 	TBaAssert();
       
    44 	TBaAssert(TErrorAction aErrorAction);
       
    45 	void AssertDebL(TBool aAssertExprVal, TBafPanic aPanic) const;
       
    46 	void AssertRelL(TBool aAssertExprVal, TBafPanic aPanic) const;
       
    47 private:
       
    48 	void DoAssertL(TBool aAssertExprVal, TBool aDebug, TBafPanic aPanic) const;
       
    49 	void DoLeaveL(TBafPanic aPanic) const;
       
    50 	void DoAssert(TBool aDebug, TBafPanic aPanic) const;
       
    51 private:
       
    52 	TErrorAction iErrorAction;
       
    53 	};
       
    54 
       
    55 #endif//__BAASSERT_H__