|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCLFDBITEMCONTAINER_H |
|
20 #define CCLFDBITEMCONTAINER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <CLFContentListing.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 |
|
28 class CMdEObject; |
|
29 class CCLFContainerItem; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Container item. |
|
35 * |
|
36 * @lib ContentListingFramework.lib |
|
37 * @since S60 3.0 |
|
38 */ |
|
39 NONSHARABLE_CLASS( CCLFContainerItem ) : public CBase |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CCLFContainerItem* NewLC( const CMdEObject* aObject ); |
|
47 |
|
48 /** |
|
49 * Destructor |
|
50 */ |
|
51 virtual ~CCLFContainerItem(); |
|
52 |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Increase reference count of item |
|
57 * @since S60 3.0 |
|
58 */ |
|
59 inline void IncreaseReferenceCount(); |
|
60 |
|
61 /** |
|
62 * |
|
63 * @since S60 3.0 |
|
64 * @return ref. to DB item |
|
65 */ |
|
66 inline const CMdEObject& DbItem() const; |
|
67 |
|
68 protected: |
|
69 |
|
70 /** |
|
71 * For find in order |
|
72 */ |
|
73 static TInt Compare( const CCLFContainerItem& aFirst, |
|
74 const CCLFContainerItem& aSecond ); |
|
75 |
|
76 /** |
|
77 * For find in order |
|
78 */ |
|
79 inline void SetItemId( TCLFItemId aItemId ); |
|
80 |
|
81 private: |
|
82 |
|
83 /** |
|
84 * Constructors |
|
85 */ |
|
86 CCLFContainerItem( const CMdEObject* aObject ); |
|
87 |
|
88 CCLFContainerItem(); |
|
89 |
|
90 private: // data |
|
91 |
|
92 // friend classes |
|
93 friend class CCLFDbItemContainer; // CSI: 36 # 36:Use of friends |
|
94 |
|
95 TInt iReferenceCount; |
|
96 const CMdEObject* iMdEObject; //own |
|
97 TBool iDeprecated; |
|
98 TCLFItemId iItemId; |
|
99 }; |
|
100 |
|
101 /** |
|
102 * DBItem container. |
|
103 * |
|
104 * @lib ContentListingFramework.lib |
|
105 * @since S60 3.0 |
|
106 */ |
|
107 NONSHARABLE_CLASS( CCLFDbItemContainer ) : public CBase |
|
108 { |
|
109 public: // Constructors and destructor |
|
110 |
|
111 /** |
|
112 * Two-phased constructor. |
|
113 */ |
|
114 static CCLFDbItemContainer* NewL(); |
|
115 |
|
116 /** |
|
117 * Destructor. |
|
118 */ |
|
119 virtual ~CCLFDbItemContainer(); |
|
120 |
|
121 public: |
|
122 |
|
123 /** |
|
124 * @since S60 3.0 |
|
125 * @param aItemId |
|
126 * @return Container item by CLF item id, if item is not found in |
|
127 * conter then NULL pointer is returned |
|
128 */ |
|
129 CCLFContainerItem* ItemById( const TCLFItemId aItemId ) const; |
|
130 |
|
131 /** |
|
132 * Decrease referency count for item and deletes container item and DB item |
|
133 * @since S60 3.0 |
|
134 * @param aItem |
|
135 */ |
|
136 void ReleaseItem( CCLFContainerItem* aItem ); |
|
137 |
|
138 /** |
|
139 * Add container item to container. |
|
140 * @since S60 3.0 |
|
141 * @param aItem |
|
142 */ |
|
143 inline void AddL( CCLFContainerItem* aItem ); |
|
144 |
|
145 /** |
|
146 * |
|
147 * @since S60 3.0 |
|
148 * @param aItemIdArray |
|
149 */ |
|
150 void SetDeprecatedItems( const RArray<TCLFItemId>& aItemIdArray ); |
|
151 |
|
152 protected: |
|
153 |
|
154 TInt FindItem( TCLFItemId aItemId, CCLFContainerItem*& aItem ) const; |
|
155 TInt NextItem( CCLFContainerItem*& aItem ) const; |
|
156 |
|
157 private: |
|
158 |
|
159 /** |
|
160 * C++ default constructor. |
|
161 */ |
|
162 CCLFDbItemContainer(); |
|
163 |
|
164 private: |
|
165 |
|
166 class TFindHelper |
|
167 { |
|
168 public: |
|
169 TFindHelper(); |
|
170 void Reset(); |
|
171 void Set( TCLFItemId aItemId, TInt aIndex ); |
|
172 |
|
173 public: |
|
174 TCLFItemId iItemId; |
|
175 TInt iIndex; |
|
176 }; |
|
177 |
|
178 private: // Data |
|
179 |
|
180 RPointerArray<CCLFContainerItem> iItemArray; |
|
181 |
|
182 TLinearOrder<CCLFContainerItem> iArraySorter; |
|
183 mutable CCLFContainerItem iFindItem; |
|
184 mutable TFindHelper iFindHelper; |
|
185 }; |
|
186 |
|
187 // inline functions |
|
188 #include "CCLFDbItemContainer.inl" |
|
189 |
|
190 #endif // CCLFDBITEMCONTAINER_H |
|
191 |
|
192 // End of File |