equal
deleted
inserted
replaced
|
1 |
|
2 // MmCleanup.h |
|
3 |
|
4 // MmCleanup - various CleanupStack related utilities |
|
5 |
|
6 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
7 // All rights reserved. |
|
8 // This component and the accompanying materials are made available |
|
9 // under the terms of "Eclipse Public License v1.0" |
|
10 // which accompanies this distribution, and is available |
|
11 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
12 // |
|
13 // Initial Contributors: |
|
14 // Nokia Corporation - initial contribution. |
|
15 // |
|
16 // Contributors: |
|
17 // |
|
18 // Description: |
|
19 // |
|
20 |
|
21 /** |
|
22 @internalTechnology |
|
23 @file |
|
24 */ |
|
25 |
|
26 #ifndef MMCLEANUP_H |
|
27 #define MMCLEANUP_H |
|
28 |
|
29 /* Template class CleanupResetAndDestroy |
|
30 * |
|
31 * Copied from CleanupClose to clean up |
|
32 * the array of implementation information from the cleanup stack. |
|
33 * |
|
34 * Note keeps non-standard layout etc of original, as it seemingly makes |
|
35 * maintenance easier. |
|
36 */ |
|
37 |
|
38 template <class T> |
|
39 class CleanupResetAndDestroy |
|
40 { |
|
41 public: |
|
42 inline static void PushL(T& aRef); |
|
43 private: |
|
44 static void ResetAndDestroy(TAny *aPtr); |
|
45 }; |
|
46 template <class T> |
|
47 inline void CleanupResetAndDestroyPushL(T& aRef); |
|
48 |
|
49 template <class T> |
|
50 inline void CleanupResetAndDestroy<T>::PushL(T& aRef) |
|
51 {CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));} |
|
52 template <class T> |
|
53 void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr) |
|
54 {(STATIC_CAST(T*,aPtr))->ResetAndDestroy();} |
|
55 template <class T> |
|
56 inline void CleanupResetAndDestroyPushL(T& aRef) |
|
57 {CleanupResetAndDestroy<T>::PushL(aRef);} |
|
58 |
|
59 #endif // MMCLEANUP_H |