|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: Contains cached MDS media items which are being downloaded.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VCXMYVIDEOSDOWNLOADCACHE_H |
|
21 #define VCXMYVIDEOSDOWNLOADCACHE_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CMPXMedia; |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Used for storing download ids and media object pointers to circular buffers for fast access. |
|
34 * |
|
35 * @lib mpxmyvideoscollectionplugin.lib |
|
36 */ |
|
37 NONSHARABLE_CLASS(CVcxMyVideosDownloadCache) : public CBase |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Two-phased constructor |
|
43 * @return Object constructed |
|
44 */ |
|
45 static CVcxMyVideosDownloadCache* NewL(); |
|
46 |
|
47 /** |
|
48 * Destructor |
|
49 */ |
|
50 virtual ~CVcxMyVideosDownloadCache(); |
|
51 |
|
52 private: |
|
53 /** |
|
54 * Constructor |
|
55 */ |
|
56 CVcxMyVideosDownloadCache(); |
|
57 |
|
58 /** |
|
59 * Symbian 2nd phase constructor. |
|
60 */ |
|
61 void ConstructL (); |
|
62 |
|
63 public: |
|
64 /** |
|
65 * Tries to find item with aDownloadId from Download Cache. |
|
66 * |
|
67 * @param aDownloadId Download ID in Download Manager. |
|
68 * @return Returns pointer to media object, NULL if not found. |
|
69 * Ownership does not move. |
|
70 */ |
|
71 CMPXMedia* Get( TUint32 aDownloadId ); |
|
72 |
|
73 /** |
|
74 * Adds download ID and index pair to Download Cache. |
|
75 * |
|
76 * @param aDownloadId Download ID in Download Manager |
|
77 * @param aVideo Pointer to video, ownership does not move. |
|
78 */ |
|
79 void Add( TUint32 aDownloadId, CMPXMedia* aVideo ); |
|
80 |
|
81 /** |
|
82 * Deletes item from Download Cache |
|
83 * |
|
84 * @param aVideo Video to remove. |
|
85 */ |
|
86 void Delete( CMPXMedia* aVideo ); |
|
87 |
|
88 private: |
|
89 |
|
90 /** |
|
91 * Array used as circular buffer, contains download ids. |
|
92 */ |
|
93 RArray<TUint32> iDownloadId; |
|
94 |
|
95 /** |
|
96 * Array used as circular buffer, contains pointers to medias. |
|
97 */ |
|
98 RPointerArray<CMPXMedia> iMedia; |
|
99 |
|
100 /** |
|
101 * Current position of the circular buffers (iDownloadId and iMedia). |
|
102 * Next item added is written to this position. |
|
103 */ |
|
104 TInt iPos; |
|
105 |
|
106 }; |
|
107 |
|
108 #endif // VCXMYVIDEOSVIDEOCACHE_H |
|
109 |
|
110 |