|
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 "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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CCAINNERQUERY_H__ |
|
19 #define __CCAINNERQUERY_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "caentryattribute.h" |
|
23 |
|
24 //FORWARD DECLARATIONS |
|
25 class CDesC16ArrayFlat; |
|
26 class RWriteStream; |
|
27 class RReadStream; |
|
28 |
|
29 /** |
|
30 * Class represents Content Arsenal query |
|
31 */ |
|
32 NONSHARABLE_CLASS( CCaInnerQuery ): public CBase |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 enum TSortAttribute |
|
38 { |
|
39 Name = 1, |
|
40 NameDesc, |
|
41 CreatedTimestamp, |
|
42 CreatedTimestampDesc, |
|
43 MostUsed, |
|
44 MostUsedDesc, |
|
45 LastUsed, |
|
46 LastUsedDesc, |
|
47 Default, // default - return items in custom order |
|
48 DefaultDesc |
|
49 }; |
|
50 |
|
51 enum TEntryRole |
|
52 { |
|
53 Item = 0x1, |
|
54 Group = 0x2 |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CCaInnerQuery(); |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * @return The created object. |
|
65 */ |
|
66 IMPORT_C static CCaInnerQuery* NewL(); |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 * @return The created object. |
|
71 */ |
|
72 IMPORT_C static CCaInnerQuery* NewLC(); |
|
73 |
|
74 /** |
|
75 * Get query entry array ids. |
|
76 * @return Array od entries' ids to be queried. |
|
77 */ |
|
78 IMPORT_C const RArray<TInt>& GetIds() const; |
|
79 |
|
80 /** |
|
81 * Sets the ids to be queried, entries to be fetched from storage. |
|
82 * @param aArray The array of entries to be fetched. |
|
83 */ |
|
84 IMPORT_C void SetIdsL( const RArray<TInt>& aArray ); |
|
85 |
|
86 /** |
|
87 * Returns the parent id set for the query. |
|
88 * @return Id of entry's parent. |
|
89 */ |
|
90 IMPORT_C TInt GetParentId() const; |
|
91 |
|
92 /** |
|
93 * Sets the parent id to be queried. This will cause returning only entries whose parent ids are aId. |
|
94 * @param aId The parent id to be set for the query. |
|
95 */ |
|
96 IMPORT_C void SetParentId( TInt aId ); |
|
97 |
|
98 /** |
|
99 * Returns the child id set for the query. |
|
100 * @return Id of entry's child. |
|
101 */ |
|
102 IMPORT_C TInt GetChildId() const; |
|
103 |
|
104 /** |
|
105 * Sets the child id to be queried. This will cause returning parents of the entry with id aId |
|
106 * @param aId The child id to be set for the query. |
|
107 */ |
|
108 IMPORT_C void SetChildId( TInt aId ); |
|
109 |
|
110 |
|
111 /** |
|
112 * Gets the typenames filter set in the query. |
|
113 * @return Array of typenames set in this query. |
|
114 */ |
|
115 IMPORT_C const CDesC16ArrayFlat* GetEntryTypeNames() const; |
|
116 |
|
117 /** |
|
118 * Sets the typename filter for the query. |
|
119 * @param aArray Sets the typename filter for the query. |
|
120 */ |
|
121 IMPORT_C void SetEntryTypeNames( CDesC16ArrayFlat* aArray ); |
|
122 |
|
123 /** |
|
124 * Reutrns the role of teh queried entries. |
|
125 * @return Role filter. |
|
126 */ |
|
127 IMPORT_C TInt GetRole() const; |
|
128 |
|
129 /** |
|
130 * Sets the role filter for the query. |
|
131 * @param The role of which type items should be fetched. |
|
132 */ |
|
133 IMPORT_C void SetRole( TInt aRole ); |
|
134 |
|
135 /** |
|
136 * Gets flags which are on. |
|
137 * @return Flags which are on. |
|
138 */ |
|
139 IMPORT_C TUint GetFlagsOn() const; |
|
140 |
|
141 /** |
|
142 * Sets flags which are on (filter). |
|
143 * @param aFlagsOn Flags which are on filter. |
|
144 */ |
|
145 IMPORT_C void SetFlagsOn( TUint aFlagsOn ); |
|
146 |
|
147 /** |
|
148 * Gets flags which are on filter. |
|
149 * @return Filter of flags which are on. |
|
150 */ |
|
151 IMPORT_C TUint GetFlagsOff() const; |
|
152 |
|
153 /** |
|
154 * Sets flags which are off (filter). |
|
155 * @param aFlagsOff Flags which are off filter. |
|
156 */ |
|
157 IMPORT_C void SetFlagsOff( TUint aFlagsOff ); |
|
158 |
|
159 /** |
|
160 * The uid filter of the entry to be fetched. |
|
161 * @return Uid of entry to be fetched. |
|
162 */ |
|
163 IMPORT_C TUint GetUid() const; |
|
164 |
|
165 /** |
|
166 * Sets the uid filter. |
|
167 * @param aUid Uid filter. Items will be fetched with only the specific uid. |
|
168 */ |
|
169 IMPORT_C void SetUid( TUint aUid ); |
|
170 |
|
171 /** |
|
172 * Specifies the order type in which queried entiries are returned. |
|
173 * @return The sort type of the query. |
|
174 */ |
|
175 IMPORT_C CCaInnerQuery::TSortAttribute GetSort() const; |
|
176 |
|
177 /** |
|
178 * Sets the sort order to in which items will be returned. |
|
179 * @param aSort The sort order to in which items will be returned. |
|
180 */ |
|
181 IMPORT_C void SetSort( CCaInnerQuery::TSortAttribute aSort ); |
|
182 |
|
183 /** |
|
184 * Externalizes to stream. |
|
185 * @param aStream Stream to which CCaInnerQuery is externalized. |
|
186 */ |
|
187 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
188 |
|
189 /** |
|
190 * Internalizes from stream. |
|
191 * @param aStream Stream from which CCaInnerQuery is internalized. |
|
192 */ |
|
193 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
194 |
|
195 /** |
|
196 * Sets the maximum amount of entries to be fetched. |
|
197 * @param aCount The number of entries to be fetched. |
|
198 */ |
|
199 IMPORT_C void SetCount( TUint aCount ); |
|
200 |
|
201 /** |
|
202 * Gets the maximum amount of entries to be fetched. |
|
203 * @return The maximum amount of entries to be fetched. |
|
204 */ |
|
205 IMPORT_C TUint GetCount() const; |
|
206 |
|
207 /** |
|
208 * Adds attribute to query. |
|
209 * @param aKey Attribute key. |
|
210 * @param aValue Attribute value. |
|
211 */ |
|
212 IMPORT_C void AddAttributeL( const TDesC& aKey, const TDesC& aValue ); |
|
213 |
|
214 /** |
|
215 * Get attributes array |
|
216 * @return attributes array |
|
217 */ |
|
218 IMPORT_C const RCaEntryAttrArray& GetAttributes() const; |
|
219 |
|
220 |
|
221 private: |
|
222 |
|
223 /** |
|
224 * Second phased constructor. |
|
225 */ |
|
226 void ConstructL(); |
|
227 |
|
228 /** |
|
229 * Constructor |
|
230 */ |
|
231 CCaInnerQuery(); |
|
232 |
|
233 private: |
|
234 // data |
|
235 |
|
236 /* |
|
237 * Unique identifier of entries. Own |
|
238 */ |
|
239 RArray<TInt> iIds; |
|
240 |
|
241 /* |
|
242 * Unique identifier of the parent. |
|
243 */ |
|
244 TInt iParentId; |
|
245 |
|
246 /* |
|
247 * Unique identifier of the child entry. |
|
248 */ |
|
249 TInt iChildId; |
|
250 |
|
251 /* |
|
252 * Own. |
|
253 */ |
|
254 CDesC16ArrayFlat* iEntryTypeNames; |
|
255 |
|
256 /* |
|
257 * Entry types. |
|
258 */ |
|
259 TInt iRole; |
|
260 |
|
261 /* |
|
262 * Flags on. |
|
263 */ |
|
264 TUint iFlagsOn; |
|
265 |
|
266 /* |
|
267 * Flags off. |
|
268 */ |
|
269 TUint iFlagsOff; |
|
270 |
|
271 /* |
|
272 * Uid. |
|
273 */ |
|
274 TUint iUid; |
|
275 |
|
276 /* |
|
277 * Sorting option. |
|
278 */ |
|
279 TUint iSort; |
|
280 |
|
281 /* |
|
282 * Number of entries to fetch |
|
283 */ |
|
284 TUint iCount; |
|
285 |
|
286 /* |
|
287 * Attributes array. Own |
|
288 */ |
|
289 RCaEntryAttrArray iAttributes; |
|
290 |
|
291 }; |
|
292 |
|
293 #endif // __CCAQUERY_H__ |