sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef __BAASSERT_H__
sl@0: #define __BAASSERT_H__
sl@0: 
sl@0: #include <baflpan.h>
sl@0: 
sl@0: /** TBaAssert class has two methods: AssertDebL and AssertRelL, which
sl@0: can do a panic or leave depending on the iErrorAction value.
sl@0: If the TBaAssert object is created with TBaAssert::ELeave
sl@0: constant, then AssertDebL/AssertRelL methods will leave when called
sl@0: (if aAssertExprVal argument is EFalse).
sl@0: If the TBaAssert object is created with TBaAssert::EPanic
sl@0: constant, then AssertDebL/AssertRelL methods will panic when called
sl@0: (if aAssertExprVal argument is EFalse).
sl@0: If the TBaAssert object is created using the default constructor - by default
sl@0: the methods will panic.
sl@0: The class size has to be exactly sizeof(enum), because objects of that class are
sl@0: used in some legacy code - replacing an existing enum data member.
sl@0: @internalComponent */
sl@0: class TBaAssert
sl@0: 	{
sl@0: public:
sl@0: 	enum TErrorAction
sl@0: 		{
sl@0: 		EPanic,
sl@0: 		ELeave
sl@0: 		};
sl@0: public:
sl@0: 	TBaAssert();
sl@0: 	TBaAssert(TErrorAction aErrorAction);
sl@0: 	void AssertDebL(TBool aAssertExprVal, TBafPanic aPanic) const;
sl@0: 	void AssertRelL(TBool aAssertExprVal, TBafPanic aPanic) const;
sl@0: private:
sl@0: 	void DoAssertL(TBool aAssertExprVal, TBool aDebug, TBafPanic aPanic) const;
sl@0: 	void DoLeaveL(TBafPanic aPanic) const;
sl@0: 	void DoAssert(TBool aDebug, TBafPanic aPanic) const;
sl@0: private:
sl@0: 	TErrorAction iErrorAction;
sl@0: 	};
sl@0: 
sl@0: #endif//__BAASSERT_H__