|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declearation for exception handling. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef IPSSETUTILSEXCEPTION_H |
|
19 #define IPSSETUTILSEXCEPTION_H |
|
20 |
|
21 class TIpsSetUtilsException; |
|
22 |
|
23 #ifdef __DEBUG |
|
24 |
|
25 /** |
|
26 * Panic, when the test fails |
|
27 */ |
|
28 #define IPS_ASSERT_DEBUG( test, reason, id ) !test ? IPSPANIC(reason, id) : NULL |
|
29 #else |
|
30 #define IPS_ASSERT_DEBUG( test, reason, id ) |
|
31 #endif /* _DEBUG */ |
|
32 |
|
33 /** |
|
34 * Invokes panic |
|
35 * |
|
36 * @param reason Reason from the TIpsSetUtilsErrorCode enumeration |
|
37 * @param id ID from the TIpsSetUtilsExceptionIds enumeration |
|
38 */ |
|
39 #define IPS_PANIC( reason, id ) TIpsSetUtilsException::Panic( TIpsSetUtilsException::reason, TIpsSetUtilsException::id ) |
|
40 |
|
41 /** |
|
42 * Invokes panic or leave based on the |
|
43 * |
|
44 * @param reason Reason from the TIpsSetUtilsErrorCode enumeration |
|
45 * @param id ID from the TIpsSetUtilsExceptionIds enumeration |
|
46 */ |
|
47 #define IPSASSERT_LEAVE_OR_PANIC_L( reason, id ) TIpsSetUtilsException::LeaveOrPanicL( TIpsSetUtilsException::reason, TIpsSetUtilsException::id ) |
|
48 |
|
49 |
|
50 /** |
|
51 * Class for exception control |
|
52 * |
|
53 * @lib IpsSosSettings.lib |
|
54 * @since FS v1.0 |
|
55 */ |
|
56 class TIpsSetUtilsException |
|
57 { |
|
58 public: |
|
59 |
|
60 /** Id's for classes */ |
|
61 enum TIpsSetUtilsExceptionIds |
|
62 { |
|
63 EItemText = 0, |
|
64 EItemValue, |
|
65 EItemLink, |
|
66 EItemLinkExt, |
|
67 EBaseArray, |
|
68 EBaseDialog, |
|
69 ESoftkeys, |
|
70 EPageResource, |
|
71 EDialogCtrl, |
|
72 EAccountCtrl, |
|
73 EParameter, |
|
74 EStorer |
|
75 }; |
|
76 |
|
77 /** Enumeration of all panics for IPS SOS Settings */ |
|
78 enum TIpsSetUtilsErrorCode |
|
79 { |
|
80 ENoError = 0, |
|
81 ENullPointer = -1100, |
|
82 ENullPointerInParam, |
|
83 EUnidentifiedItem, |
|
84 ESoftkeyLeft, |
|
85 ESoftkeyMiddle, |
|
86 ESoftkeyRight, |
|
87 EWrongType, |
|
88 EStackEmpty, |
|
89 EStackNull, |
|
90 EArrayNull, |
|
91 EUnknownType, |
|
92 EInvalidAccount, |
|
93 EInvalidMtm, |
|
94 EUnderflowMailboxId, |
|
95 EUnderflowAccountId, |
|
96 EOverflowAccountId, |
|
97 EIllegalMtm, |
|
98 ESettingsNotValid |
|
99 }; |
|
100 |
|
101 /** |
|
102 * Invokes panic in debug mode, does nothing in release mode |
|
103 * |
|
104 * @param aReason Reason for panic |
|
105 * @param aId ID of the panicing component |
|
106 */ |
|
107 inline static void Panic( const TInt aReason, const TUint aId ); |
|
108 |
|
109 /** |
|
110 * Leaves or Panic based on rel/debug mode |
|
111 * |
|
112 * @param aReason Reason for panic |
|
113 * @param aId ID of the panicing component |
|
114 */ |
|
115 inline static void LeaveOrPanicL( const TInt aReason, const TInt aId ); |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * Converts the id to string |
|
121 * |
|
122 * @param aId ID of the panicing component |
|
123 */ |
|
124 static const TDesC& Id2Name( const TInt aId ); |
|
125 }; |
|
126 |
|
127 #include "ipssetutilsexception.inl" |
|
128 |
|
129 #endif // IPSSETUTILSEXCEPTION_H |
|
130 |
|
131 // End of File |