equal
deleted
inserted
replaced
|
1 // Copyright (c) 2002-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 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef SMSSTACKUTILS_H |
|
22 #define SMSSTACKUTILS_H |
|
23 |
|
24 template <class T> |
|
25 class CleanupResetAndDestroy |
|
26 { |
|
27 public: |
|
28 /** |
|
29 Puts an item on the cleanup stack. |
|
30 |
|
31 @param aRef |
|
32 The implementation information to be put on the cleanup stack. |
|
33 */ |
|
34 inline static void PushL(T& aRef); |
|
35 private: |
|
36 static void ResetAndDestroy(TAny *aPtr); |
|
37 }; |
|
38 template <class T> |
|
39 inline void CleanupResetAndDestroyPushL(T& aRef); |
|
40 template <class T> |
|
41 inline void CleanupResetAndDestroy<T>::PushL(T& aRef) |
|
42 {CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));} |
|
43 template <class T> |
|
44 void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr) |
|
45 {(STATIC_CAST(T*,aPtr))->ResetAndDestroy();} |
|
46 template <class T> |
|
47 inline void CleanupResetAndDestroyPushL(T& aRef) |
|
48 {CleanupResetAndDestroy<T>::PushL(aRef);} |
|
49 |
|
50 #endif /* SMSSTACKUTILS_H */ |
|
51 |