equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: A class for simplifying cleanup of RPointerArrays |
14 * Description: A class for simplifying cleanup of RPointerArrays |
15 * |
15 * |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 |
19 |
20 /** |
20 /** |
21 Pushes an RPointerArray onto the cleanup stack. When popped with PopAndDestroy, |
21 Pushes an RPointerArray onto the cleanup stack. When popped with PopAndDestroy, |
22 the array will be reset with ResetAndDestroy. |
22 the array will be reset with ResetAndDestroy. |
23 @param aRef The RPointerArray to be cleaned up. |
23 @param aRef The RPointerArray to be cleaned up. |
24 @internalTechnology |
24 @internalTechnology |
25 */ |
25 */ |
26 template <class T> |
26 template <class T> |
27 inline void TCleanupPointerArray<T>::PushL(T& aRef) |
27 inline void TCleanupPointerArray<T>::PushL(T& aRef) |
28 { |
28 { |
29 CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef)); |
29 CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef)); |
30 } |
30 } |
31 |
31 |
32 /** |
32 /** |
33 Takes a pointer to an RPointerArray and calls ResetAndDestroy on it. |
33 Takes a pointer to an RPointerArray and calls ResetAndDestroy on it. |
34 @param aPtr The RPointerArray |
34 @param aPtr The RPointerArray |
35 @internalTechnology |
35 @internalTechnology |
36 */ |
36 */ |
37 template <class T> |
37 template <class T> |
38 inline void TCleanupPointerArray<class T>::ResetAndDestroy(TAny* aPtr) |
38 inline void TCleanupPointerArray<T>::ResetAndDestroy(TAny* aPtr) |
39 { |
39 { |
40 reinterpret_cast<T *>(aPtr)->ResetAndDestroy(); |
40 reinterpret_cast<T *>(aPtr)->ResetAndDestroy(); |
41 } |
41 } |
42 |
42 |
43 /** |
43 /** |