|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Class for removing a fetch context from a list |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef T_GLXFETCHCONTEXTREMOVER_H |
|
22 #define T_GLXFETCHCONTEXTREMOVER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 // Forward declarations |
|
27 class MGlxFetchContext; |
|
28 class MGlxMediaList; |
|
29 |
|
30 /** |
|
31 * Class that removes the given fetch context from a media list when goes out |
|
32 * of scope. Use this to avoid trap, and to achieve safe cleanup, when a fetch |
|
33 * context is created and used within a function. |
|
34 * |
|
35 * Note: the media list must not have been deleted when the destructor of this |
|
36 * class is called. |
|
37 * |
|
38 */ |
|
39 class TGlxFetchContextRemover |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Constructor |
|
44 * @param aContext the context to remove upon destruction |
|
45 * @param aMediaList List from which to remove the context |
|
46 */ |
|
47 IMPORT_C TGlxFetchContextRemover(MGlxFetchContext* aContext, MGlxMediaList& aMediaList); |
|
48 /** |
|
49 * Destructor |
|
50 */ |
|
51 IMPORT_C ~TGlxFetchContextRemover(); |
|
52 |
|
53 /** |
|
54 * Remove the context from the list |
|
55 */ |
|
56 IMPORT_C void Close(); |
|
57 |
|
58 private: |
|
59 /// Context that needs to be removed upon destruction |
|
60 MGlxFetchContext* iContext; |
|
61 |
|
62 /// Media list from which to remove the context from |
|
63 MGlxMediaList& iMediaList; |
|
64 }; |
|
65 |
|
66 #endif // T_GLXFETCHCONTEXTREMOVER_H |