|
1 /* |
|
2 * Copyright (c) 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MDELOGICCONDITION_H__ |
|
20 #define __MDELOGICCONDITION_H__ |
|
21 |
|
22 |
|
23 #include <e32std.h> |
|
24 |
|
25 #include <mdecondition.h> |
|
26 #include <mderange.h> |
|
27 #include <mderangepropertycondition.h> |
|
28 #include <mdetextpropertycondition.h> |
|
29 |
|
30 |
|
31 /* Forward declarations. */ |
|
32 class CMdEBoolPropertyCondition; |
|
33 class CMdEObjectDef; |
|
34 class CMdEPropertyDef; |
|
35 class CMdERelationDef; |
|
36 class CMdEEventDef; |
|
37 class CMdCSerializationBuffer; |
|
38 class CMdEEventCondition; |
|
39 class CMdEObjectCondition; |
|
40 class CMdEPropertyCondition; |
|
41 class CMdERelationCondition; |
|
42 |
|
43 /** |
|
44 * Logic conditions are used for combining other conditions with boolean |
|
45 * AND or OR operators. Each logic condition can have an unlimited number of |
|
46 * child conditions. The same operator is applied to all of the child |
|
47 * conditions: (X and Y and Z), (X or Y or Z). |
|
48 * |
|
49 * CMdELogicCondition provides a number of factory methods for creating and |
|
50 * adding new nodes as children of the logic condition node. Always use the |
|
51 * factory methods when constructing a query condition tree. |
|
52 * |
|
53 * A logic condition node owns all of its children. |
|
54 */ |
|
55 NONSHARABLE_CLASS(CMdELogicCondition) : public CMdECondition |
|
56 { |
|
57 public: |
|
58 |
|
59 /* Constructors and destructor. */ |
|
60 |
|
61 /** |
|
62 * Constructs a new logic condition node. |
|
63 * |
|
64 * @param aOperator Operator to use for the child conditions. |
|
65 */ |
|
66 IMPORT_C static CMdELogicCondition* NewL(TLogicConditionOperator aOperator); |
|
67 |
|
68 /** |
|
69 * Constructs a new logic condition node, leaving the node on the |
|
70 * cleanup stack. |
|
71 * |
|
72 * @param aOperator Operator to use for the child conditions. |
|
73 */ |
|
74 IMPORT_C static CMdELogicCondition* NewLC(TLogicConditionOperator aOperator); |
|
75 |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 virtual ~CMdELogicCondition(); |
|
81 |
|
82 |
|
83 /* Methods. */ |
|
84 |
|
85 /** |
|
86 * Returns the operator of the logic condition. |
|
87 * |
|
88 * @return Logic operator. |
|
89 */ |
|
90 IMPORT_C TLogicConditionOperator Operator() const; |
|
91 |
|
92 /** |
|
93 * Changes the operator of the logic condition. |
|
94 * |
|
95 * @param aLogicOperator The new logic operator for the condition. |
|
96 * |
|
97 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
98 */ |
|
99 IMPORT_C void SetOperator(TLogicConditionOperator aLogicOperator); |
|
100 |
|
101 /** |
|
102 * Determines the number of child conditions. |
|
103 * |
|
104 * @return Number of conditions in the logic operation. |
|
105 */ |
|
106 IMPORT_C TInt Count() const; |
|
107 |
|
108 /** |
|
109 * Returns a child condition node. |
|
110 * |
|
111 * @param aIndex Index of the condition to return. |
|
112 * |
|
113 * @return Condition node at the specified index. |
|
114 */ |
|
115 IMPORT_C CMdECondition& Condition(TInt aIndex) const; |
|
116 |
|
117 /** |
|
118 * Removes a condition node from the logic condition. |
|
119 * |
|
120 * @param aIndex Index of the condition to remove. |
|
121 * |
|
122 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
123 */ |
|
124 IMPORT_C void Remove(TInt aIndex); |
|
125 |
|
126 |
|
127 /* Factory methods for creating and adding new condition nodes into |
|
128 * the tree. */ |
|
129 |
|
130 /** |
|
131 * Creates a new logic condition and makes it a child condition of this |
|
132 * logic condition node. |
|
133 * |
|
134 * @param aLogicOperator Operator of the new logic condition. |
|
135 * |
|
136 * @return Reference to the new condition node. |
|
137 * |
|
138 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
139 */ |
|
140 IMPORT_C CMdELogicCondition& AddLogicConditionL(TLogicConditionOperator aLogicOperator); |
|
141 |
|
142 /** |
|
143 * Creates a new object condition and makes it a child condition of this |
|
144 * logic condition node. The object condition node sets a requirement for |
|
145 * the object class. |
|
146 * |
|
147 * Example: |
|
148 * // We want the condition to match with image objects. |
|
149 * CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); |
|
150 * CleanupStack::PushL( condition ); |
|
151 * |
|
152 * CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); |
|
153 * CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
154 * condition->AddObjectConditionL( imageDef ); |
|
155 * |
|
156 * @param aObjectDef Object definition. |
|
157 * |
|
158 * @return Reference to the new condition node. |
|
159 * |
|
160 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
161 */ |
|
162 IMPORT_C CMdEObjectCondition& |
|
163 AddObjectConditionL(const CMdEObjectDef& aObjectDef); |
|
164 |
|
165 /** |
|
166 * Creates a new object condition and makes it a child condition of this |
|
167 * logic condition node. The object condition node sets a requirement for |
|
168 * the object's ID number. |
|
169 * |
|
170 * Example: |
|
171 * CMdERelationQuery* relationQuery = iMdeSession->NewRelationQueryL( defNamespace, this ); |
|
172 * CMdERelationCondition& filterCond = relationQuery->Conditions(). |
|
173 * AddRelationConditionL( ERelationConditionSideRight ); |
|
174 * // Left object in relation must have this ID. |
|
175 * filterCond.LeftL().AddObjectConditionL( aObjectId ); |
|
176 * |
|
177 * @param aObjectId ID number of the object. |
|
178 * |
|
179 * @return Reference to the new condition node. |
|
180 * |
|
181 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
182 */ |
|
183 IMPORT_C CMdEObjectCondition& AddObjectConditionL(TItemId aObjectId); |
|
184 |
|
185 /** |
|
186 * Creates a new object condition and makes it a child condition of this |
|
187 * logic condition node. The object condition node sets a requirement for |
|
188 * the objects' ID numbers. |
|
189 * |
|
190 * @param aObjectId ID numbers of objects. |
|
191 * |
|
192 * @return Reference to the new condition node. |
|
193 * |
|
194 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
195 * |
|
196 */ |
|
197 IMPORT_C CMdEObjectCondition& AddObjectConditionL( |
|
198 const RArray<TItemId>& aObjectIds); |
|
199 |
|
200 /** |
|
201 * Creates a new object condition and makes it a child condition of this |
|
202 * logic condition node. The object condition node sets a requirement for |
|
203 * the object's GUID. |
|
204 * |
|
205 * @param aObjectGuidHigh GUID high part of the object. |
|
206 * @param aObjectGuidLow GUID low part of the object. |
|
207 * |
|
208 * @return Reference to the new condition node. |
|
209 * |
|
210 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
211 */ |
|
212 IMPORT_C CMdEObjectCondition& AddObjectConditionL( |
|
213 TInt64 aObjectGuidHigh, TInt64 aObjectGuidLow); |
|
214 |
|
215 /** |
|
216 * Creates a new object condition and makes it a child condition of this |
|
217 * logic condition node. |
|
218 * |
|
219 * @param aCompareMethod Comparison method. |
|
220 * @param aString Text string to look for. |
|
221 * |
|
222 * @return Reference to the new condition node. |
|
223 * |
|
224 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
225 */ |
|
226 IMPORT_C CMdEObjectCondition& AddObjectConditionL( |
|
227 TObjectConditionCompareMethod aCompareMethod, |
|
228 const TDesC& aString); |
|
229 |
|
230 /** |
|
231 * Creates a new object condition and makes it a child condition of this |
|
232 * logic condition node. |
|
233 * |
|
234 * @param aRange range for usage count |
|
235 * |
|
236 * @return Reference to the new condition node. |
|
237 * |
|
238 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
239 */ |
|
240 IMPORT_C CMdEObjectCondition& AddObjectConditionL( |
|
241 const TMdEUintRange& aRange); |
|
242 |
|
243 /** |
|
244 * Creates a new property condition and makes it a child condition of this |
|
245 * logic condition node. The property condition tests if a property |
|
246 * exists in an object. |
|
247 * |
|
248 * Example: |
|
249 * CMdEPropertyDef& commentDef = objDef.GetPropertyDefL( MdeConstants::MediaObject::KCommentProperty ); |
|
250 * iQuery->Conditions().AddPropertyConditionL( commentDef ); |
|
251 * |
|
252 * @param aPropertyDef The property to look for. |
|
253 * |
|
254 * @return Reference to the new condition node. |
|
255 * |
|
256 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
257 */ |
|
258 IMPORT_C CMdEPropertyCondition& AddPropertyConditionL( |
|
259 const CMdEPropertyDef& aPropertyDef); |
|
260 |
|
261 /** |
|
262 * Creates a new boolean property condition and makes it a child |
|
263 * condition of this logic condition node. The property condition |
|
264 * tests the value of a boolean property. |
|
265 * |
|
266 * Example: |
|
267 * CMdEPropertyDef& commentDef = objDef.GetPropertyDefL( MdeConstants::MediaObject::KProtectedProperty ); |
|
268 * iQuery->Conditions().AddPropertyConditionL( commentDef, ETrue ); |
|
269 * |
|
270 * @param aPropertyDef Property definition. |
|
271 * @param aBoolValue Boolean value. |
|
272 * |
|
273 * @return Reference to the new condition node. |
|
274 * |
|
275 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
276 */ |
|
277 IMPORT_C CMdEBoolPropertyCondition& AddPropertyConditionL( |
|
278 const CMdEPropertyDef& aPropertyDef, TBool aBoolValue); |
|
279 |
|
280 /** |
|
281 * Creates a new integer property condition and makes it a child |
|
282 * condition of this logic condition node. The property condition defines |
|
283 * a range of integer values. If the property's value is within the range |
|
284 * the condition evaluates to True. |
|
285 * |
|
286 * Example: |
|
287 * CMdEPropertyDef& frameCountDef = objDef.GetPropertyDefL( MdeConstants::Image::FrameCount ); |
|
288 * iQuery->Conditions().AddPropertyConditionL( frameCountDef, TMdEIntRange(0, 5, rangeType) ); |
|
289 * |
|
290 * @param aPropertyDef Property definition. |
|
291 * @param aIntRange Range of integer values. |
|
292 * |
|
293 * @return Reference to the new condition node. |
|
294 * |
|
295 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
296 */ |
|
297 IMPORT_C CMdEIntRangePropertyCondition& AddPropertyConditionL( |
|
298 const CMdEPropertyDef& aPropertyDef, |
|
299 const TMdEIntRange& aIntRange); |
|
300 |
|
301 /** |
|
302 * Creates a new 64 bit integer property condition and makes it a child |
|
303 * condition of this logic condition node. The property condition defines |
|
304 * a range of integer values. If the property's value is within the range |
|
305 * the condition evaluates to True. |
|
306 * |
|
307 * @param aPropertyDef Property definition. |
|
308 * @param aInt64Range Range of 64 bit integer values. |
|
309 * |
|
310 * @return Reference to the new condition node. |
|
311 * |
|
312 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
313 */ |
|
314 IMPORT_C CMdEInt64RangePropertyCondition& AddPropertyConditionL( |
|
315 const CMdEPropertyDef& aPropertyDef, |
|
316 const TMdEInt64Range& aIntRange); |
|
317 |
|
318 /** |
|
319 * Creates a new unsigned integer property condition and makes it a child |
|
320 * condition of this logic condition node. The property condition defines |
|
321 * a range of unsigned integer values. If the property's value is within |
|
322 * the range the condition evaluates to True. |
|
323 * |
|
324 * @param aPropertyDef Property definition. |
|
325 * @param aUintRange Range of unsigned integer values. |
|
326 * |
|
327 * @return Reference to the new condition node. |
|
328 * |
|
329 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
330 */ |
|
331 IMPORT_C CMdEUintRangePropertyCondition& AddPropertyConditionL( |
|
332 const CMdEPropertyDef& aPropertyDef, |
|
333 const TMdEUintRange& aUintRange); |
|
334 |
|
335 /** |
|
336 * Creates a new floating-point property condition and makes it a child |
|
337 * condition of this logic condition node. The property condition defines |
|
338 * a range of floating-point values. If the property's value is within |
|
339 * the range the condition evaluates to True. |
|
340 * |
|
341 * @param aPropertyDef Property definition. |
|
342 * @param aRealRange Range of floating-point values. |
|
343 * |
|
344 * @return Reference to the new condition node. |
|
345 * |
|
346 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
347 */ |
|
348 IMPORT_C CMdERealRangePropertyCondition& AddPropertyConditionL( |
|
349 const CMdEPropertyDef& aPropertyDef, |
|
350 const TMdERealRange& aRealRange); |
|
351 |
|
352 /** |
|
353 * Creates a new time property condition and makes it a child |
|
354 * condition of this logic condition node. The property condition defines |
|
355 * a range of time values. If the property's value is within the range |
|
356 * the condition evaluates to True. |
|
357 * |
|
358 * @param aPropertyDef Property definition. |
|
359 * @param aTimeRange Range of time values. |
|
360 * |
|
361 * @return Reference to the new condition node. |
|
362 * |
|
363 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
364 */ |
|
365 IMPORT_C CMdETimeRangePropertyCondition& AddPropertyConditionL( |
|
366 const CMdEPropertyDef& aPropertyDef, |
|
367 const TMdETimeRange& aTimeRange); |
|
368 |
|
369 /** |
|
370 * Creates a new text property condition and makes it a child condition |
|
371 * of this logic condition node. |
|
372 * |
|
373 * @param aPropertyDef Property definition. |
|
374 * @param aCompareMethod Comparison method. |
|
375 * @param aText Text string to look for. |
|
376 * |
|
377 * @return Reference to the new condition node. |
|
378 * |
|
379 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
380 */ |
|
381 IMPORT_C CMdETextPropertyCondition& AddPropertyConditionL( |
|
382 const CMdEPropertyDef& aPropertyDef, |
|
383 TTextPropertyConditionCompareMethod aCompareMethod, |
|
384 const TDesC& aText); |
|
385 |
|
386 /** |
|
387 * Creates a new relation condition and makes it a child condition of this |
|
388 * logic condition node. The new relation condition contains no parameters |
|
389 * by default. It is assumed that the relation condition is augmented |
|
390 * with further conditions for the objects to which the relation is |
|
391 * attached. |
|
392 * |
|
393 * Example: |
|
394 * TItemId relationId( 1 ); |
|
395 * CMdERelationCondition& relationCond = relationQuery->Conditions(). |
|
396 * AddRelationConditionL( relationId, ERelationConditionSideRight ); |
|
397 * |
|
398 * @param aRelationId Relation ID. |
|
399 * @param aSide The side on which an object must be. |
|
400 * |
|
401 * @return Reference to the new condition node. |
|
402 * |
|
403 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
404 */ |
|
405 IMPORT_C CMdERelationCondition& AddRelationConditionL(TItemId aRelationId, |
|
406 TRelationConditionSide aSide = ERelationConditionSideEither); |
|
407 |
|
408 /** |
|
409 * Creates a new relation condition and makes it a child condition of this |
|
410 * logic condition node. The new relation condition contains no parameters |
|
411 * by default. It is assumed that the relation condition is augmented |
|
412 * with further conditions for the objects to which the relation is |
|
413 * attached. |
|
414 * |
|
415 * Example: |
|
416 * RArray<TItemId> arrayOfIds; |
|
417 * arrayOfIds.Append( TItemId( 1 ) ); |
|
418 * arrayOfIds.Append( TItemId( 2 ) ); |
|
419 * CMdERelationCondition& relationCond = relationQuery->Conditions(). |
|
420 * AddRelationConditionL( arrayOfIds, ERelationConditionSideRight ); |
|
421 * |
|
422 * @param aRelationIds Array of Relation IDs. |
|
423 * @param aSide The side on which an object must be. |
|
424 * |
|
425 * @return Reference to the new condition node. |
|
426 * |
|
427 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
428 */ |
|
429 IMPORT_C CMdERelationCondition& AddRelationConditionL( |
|
430 RArray<TItemId>& aRelationIds, |
|
431 TRelationConditionSide aSide = ERelationConditionSideEither); |
|
432 |
|
433 /** |
|
434 * Creates a new relation condition and makes it a child condition of this |
|
435 * logic condition node. The new relation condition contains no parameters |
|
436 * by default. It is assumed that the relation condition is augmented |
|
437 * with further conditions for the objects to which the relation is |
|
438 * attached. |
|
439 * |
|
440 * Example: |
|
441 * CMdERelationCondition& relationCond = relationQuery->Conditions(). |
|
442 * AddRelationConditionL( ERelationConditionSideRight ); |
|
443 * |
|
444 * @param aSide The side on which an object must be. |
|
445 * |
|
446 * @return Reference to the new condition node. |
|
447 * |
|
448 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
449 */ |
|
450 IMPORT_C CMdERelationCondition& AddRelationConditionL( |
|
451 TRelationConditionSide aSide = ERelationConditionSideEither); |
|
452 |
|
453 /** |
|
454 * Creates a new relation condition and makes it a child condition of this |
|
455 * logic condition node. The new relation condition tests the relation's |
|
456 * type. The relation condition can be augmented with further conditions |
|
457 * for the objects to which the relation is attached. |
|
458 * |
|
459 * @param aRelationDef relation definition |
|
460 * @param aSide The side on which an object must be. Defaults to |
|
461 * ERelationConditionSideEither. |
|
462 * |
|
463 * @return Reference to the new condition node. |
|
464 * |
|
465 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
466 */ |
|
467 IMPORT_C CMdERelationCondition& AddRelationConditionL( |
|
468 const CMdERelationDef& aRelationDef, |
|
469 TRelationConditionSide aSide = ERelationConditionSideEither); |
|
470 |
|
471 /** |
|
472 * Creates a new relation condition and makes it a child condition of this |
|
473 * logic condition node. The new relation condition tests the relation's |
|
474 * type. The relation condition can be augmented with further conditions |
|
475 * for the objects to which the relation is attached. |
|
476 * |
|
477 * @param aRelationDef relation definition |
|
478 * @param aIntRange parameter range conditions |
|
479 * @param aSide The side on which an object must be. |
|
480 * |
|
481 * @return Reference to the new condition node. |
|
482 * |
|
483 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
484 */ |
|
485 IMPORT_C CMdERelationCondition& AddRelationConditionL( |
|
486 const CMdERelationDef& aRelationDef, const TMdEIntRange& aIntRange, |
|
487 TRelationConditionSide aSide = ERelationConditionSideEither); |
|
488 |
|
489 |
|
490 /** |
|
491 * Creates a new event condition and makes it a child condition of this |
|
492 * logic condition node. The new event condition contains no parameters |
|
493 * by default. It is assumed that the event condition is augmented |
|
494 * with further conditions for the object to which the event is attached. |
|
495 * |
|
496 * @return Reference to the new condition node. |
|
497 * |
|
498 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
499 */ |
|
500 IMPORT_C CMdEEventCondition& AddEventConditionL(); |
|
501 |
|
502 /** |
|
503 * Creates a new event condition and makes it a child condition of this |
|
504 * logic condition node. The new event condition tests the event's type. |
|
505 * The event condition can be augmented with further conditions |
|
506 * for the object to which the event is attached. |
|
507 * |
|
508 * @param aEventId Event ID. |
|
509 * |
|
510 * @return Reference to the new condition node. |
|
511 * |
|
512 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
513 */ |
|
514 IMPORT_C CMdEEventCondition& AddEventConditionL(TItemId aEventId); |
|
515 |
|
516 /** |
|
517 * Creates a new event condition and makes it a child condition of this |
|
518 * logic condition node. The new event condition tests the event's type. |
|
519 * The event condition can be augmented with further conditions |
|
520 * for the object to which the event is attached. |
|
521 * |
|
522 * @param aEventDef Event definition. |
|
523 * |
|
524 * @return Reference to the new condition node. |
|
525 * |
|
526 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
527 */ |
|
528 IMPORT_C CMdEEventCondition& AddEventConditionL( |
|
529 const CMdEEventDef& aEventDef); |
|
530 |
|
531 /** |
|
532 * Creates a new event condition and makes it a child condition of this |
|
533 * logic condition node. The new event condition tests the event's |
|
534 * creation time. The event condition can be augmented with further |
|
535 * conditions for the object to which the event is attached. |
|
536 * |
|
537 * @param aCreationTimeRange Time range. |
|
538 * |
|
539 * @return Reference to the new condition node. |
|
540 * |
|
541 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
542 */ |
|
543 IMPORT_C CMdEEventCondition& AddEventConditionL( |
|
544 const TMdETimeRange& aCreationTimeRange); |
|
545 |
|
546 /** |
|
547 * Creates a new event condition and makes it a child condition of this |
|
548 * logic condition node. The new event condition tests the event's |
|
549 * source or participant. The event condition can be augmented with |
|
550 * further conditions for the object to which the event is attached. |
|
551 * |
|
552 * @param aCompareMethod Comparison method. |
|
553 * @param aString Text string to look for. |
|
554 * |
|
555 * @return Reference to the new condition node. |
|
556 * |
|
557 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
558 */ |
|
559 IMPORT_C CMdEEventCondition& AddEventConditionL( |
|
560 TEventConditionCompareMethod aCompareMethod, const TDesC& aString); |
|
561 |
|
562 /** |
|
563 * Creates a new event condition and makes it a child condition of this |
|
564 * logic condition node. The new event condition tests the event's |
|
565 * creation time. The new event condition also tests the event's |
|
566 * source or participant. The event condition can be augmented with |
|
567 * further conditions for the object to which the event is attached. |
|
568 * |
|
569 * @param aCreationTimeRange Time range. |
|
570 * @param aCompareMethod Comparison method. |
|
571 * @param aString Text string to look for. |
|
572 * |
|
573 * @return Reference to the new condition node. |
|
574 * |
|
575 * @panic TMdEPanic::EConditionLocked Condition node is locked. |
|
576 */ |
|
577 IMPORT_C CMdEEventCondition& AddEventConditionL( |
|
578 const TMdETimeRange& aCreationTimeRange, |
|
579 TEventConditionCompareMethod aCompareMethod, const TDesC& aString); |
|
580 |
|
581 /** |
|
582 * Locking a logic condition causes all children to be locked as well. |
|
583 * Attempting to modify a locked condition causes a panic. |
|
584 * |
|
585 * @param aLocked <code>ETrue</code> to lock; |
|
586 * <code>EFalse</code> to unlock. |
|
587 */ |
|
588 void SetLocked(TBool aLocked = ETrue); |
|
589 |
|
590 /** |
|
591 * Get possible query's internal optimization flags from condition. |
|
592 * |
|
593 * @param aFlaga query's internal optimization flags |
|
594 * @return last level internal optimization flags |
|
595 */ |
|
596 TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); |
|
597 |
|
598 /** |
|
599 * Get required size of serialized buffer when this is serialized. |
|
600 * |
|
601 * @return required size of serialized buffer |
|
602 */ |
|
603 TUint32 RequiredBufferSize() const; |
|
604 |
|
605 /** |
|
606 * Serialize own data to serialized buffer (correct position must be set |
|
607 * before calling). |
|
608 * |
|
609 * @param aBuffer serialized buffer. |
|
610 */ |
|
611 void SerializeL(CMdCSerializationBuffer& aBuffer, |
|
612 TMdCOffset& aFreespaceOffset) const; |
|
613 |
|
614 protected: |
|
615 |
|
616 /* Constructors. */ |
|
617 |
|
618 /** |
|
619 * Constructor. |
|
620 * |
|
621 * @param aOperator Logic operator. |
|
622 */ |
|
623 CMdELogicCondition(TLogicConditionOperator aOperator); |
|
624 |
|
625 /** |
|
626 * Second-phase constructor. |
|
627 */ |
|
628 void ConstructL(); |
|
629 |
|
630 |
|
631 /* Utility methods. */ |
|
632 |
|
633 /** |
|
634 * Makes an existing condition node a child node of this logic condition. |
|
635 * The logic condition takes ownership of the node. |
|
636 * |
|
637 * @param aCondition Condition node. |
|
638 * |
|
639 * @return Reference to the added node (aCondition). |
|
640 */ |
|
641 CMdECondition& AddL(CMdECondition* aCondition); |
|
642 |
|
643 |
|
644 private: |
|
645 |
|
646 /** Type of the condition. */ |
|
647 TLogicConditionOperator iOperator; |
|
648 |
|
649 /** Children of the condition. The logic condition owns all the |
|
650 child nodes. */ |
|
651 RPointerArray<CMdECondition> iChildren; |
|
652 |
|
653 TUint32 iOptimizationFlags; |
|
654 }; |
|
655 |
|
656 #endif // __MDELOGICCONDITION_H__ |