Update contrib.
1 // Copyright (c) 2007-2010 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 #ifndef __TEXTBASEPANIC_H__
21 #define __TEXTBASEPANIC_H__
24 void TextBasePanic(TTextBasePanic aPanicCode);
25 void TextBasePanicWithCondAndInfo(TTextBasePanic aPanic, const TDesC& aCondition, const TDesC& aFileName, const TDesC& aPanicName, TInt aLine);
28 void TextBasePanicLogWithInfo(const TDesC& aCommand, const TDesC& aCondition, const TDesC& aFileName, TInt aLine);
31 #define TEXTBASE_ASSERT_FILENAME(f) _LIT(KPanicFileName, f);
32 #define TEXTBASE_ASSERT_PANICNAME(p) _LIT(KPanicEnum ## p, # p);
33 #define TEXTBASE_ASSERT_PANICCOMMAND(a) _LIT(KPanicCommand, a);
34 #define TEXTBASE_ASSERT_CONDITION(c) _LIT(KPanicCondition, c);
36 /* Use these macros for GDI Asserts & Panics with diagnostic logging:
37 TEXTBASE_ASSERT_ALWAYS, TEXTBASE_ASSERT_ALWAYS_GENERAL, TEXTBASE_ASSERT_DEBUG
38 and TEXTBASE_ASSERT_DEBUG_GENERAL
39 Note that the "do { ... } while (0)" construction forces the invocation to have a ';'
40 and makes the macro expansion safe in nested "if ... else ..." clauses that forget to use the
41 { braces } in the Coding Standard.
44 #define TEXTBASE_ASSERT_ALWAYS(c, p) \
48 TEXTBASE_ASSERT_FILENAME(__FILE__); \
49 TEXTBASE_ASSERT_PANICNAME(p); \
50 TEXTBASE_ASSERT_CONDITION(#c); \
51 TextBasePanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \
55 #define TEXTBASE_ASSERT_ALWAYS_GENERAL(c, a) \
59 TEXTBASE_ASSERT_FILENAME(__FILE__); \
60 TEXTBASE_ASSERT_PANICCOMMAND(#a); \
61 TEXTBASE_ASSERT_CONDITION(#c); \
62 TextBasePanicLogWithInfo(KPanicCondition, KPanicCommand, KPanicFileName, __LINE__); \
68 #define TEXTBASE_ASSERT_DEBUG(c, p) \
72 TEXTBASE_ASSERT_FILENAME(__FILE__); \
73 TEXTBASE_ASSERT_PANICNAME(p); \
74 TEXTBASE_ASSERT_CONDITION(#c); \
75 TextBasePanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \
79 #define TEXTBASE_ASSERT_DEBUG_GENERAL(c, a) \
83 TEXTBASE_ASSERT_FILENAME(__FILE__); \
84 TEXTBASE_ASSERT_PANICCOMMAND(#a); \
85 TEXTBASE_ASSERT_CONDITION(#c); \
86 TextBasePanicLogWithInfo(KPanicCondition, KPanicCommand, KPanicFileName, __LINE__); \
92 #define TEXTBASE_ASSERT_DEBUG(c, p)
93 #define TEXTBASE_ASSERT_DEBUG_GENERAL(c, p)