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: Representation of query event condition |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MDEEVENTCONDITION_H__ |
|
19 #define __MDEEVENTCONDITION_H__ |
|
20 |
|
21 |
|
22 #include <mdecondition.h> |
|
23 #include <mderange.h> |
|
24 |
|
25 |
|
26 /* Forward declarations. */ |
|
27 class CMdELogicCondition; |
|
28 class CMdEEventDef; |
|
29 class CMdEEventDef; |
|
30 |
|
31 |
|
32 /** |
|
33 * Query condition for events. |
|
34 */ |
|
35 NONSHARABLE_CLASS(CMdEEventCondition) : public CMdECondition |
|
36 { |
|
37 public: |
|
38 |
|
39 /* Constructors and destructor. */ |
|
40 |
|
41 /** |
|
42 * Create new CMdEEventCondition from serialized buffer |
|
43 * |
|
44 * @return new CMdEEventCondition |
|
45 */ |
|
46 static CMdEEventCondition* NewL( TItemId aEventId = KNoId, |
|
47 const CMdEEventDef* aEventDef = NULL, |
|
48 const TMdETimeRange* aCreationTimeRange = NULL, |
|
49 TEventConditionCompareMethod aCompareMethod = EEventConditionCompareNone, |
|
50 const TDesC* aString = NULL ); |
|
51 |
|
52 /** |
|
53 * Create new CMdEEventCondition from serialized buffer and leaves it on stack |
|
54 * |
|
55 * @return new CMdEEventCondition |
|
56 */ |
|
57 static CMdEEventCondition* NewLC( TItemId aEventId = KNoId, |
|
58 const CMdEEventDef* aEventDef = NULL, |
|
59 const TMdETimeRange* aCreationTimeRange = NULL, |
|
60 TEventConditionCompareMethod aCompareMethod = EEventConditionCompareNone, |
|
61 const TDesC* aString = NULL ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CMdEEventCondition(); |
|
67 |
|
68 |
|
69 /* Methods. */ |
|
70 |
|
71 /** |
|
72 * Returns the logic condition root node of the conditions defined for |
|
73 * the object which the event is attached to. |
|
74 * |
|
75 * @return Logic condition. |
|
76 */ |
|
77 IMPORT_C CMdELogicCondition& ObjectConditionsL(); |
|
78 |
|
79 /** |
|
80 * Returns the logic condition root node of the condition defined for |
|
81 * the object whose URI matches the source URI of the event. |
|
82 */ |
|
83 IMPORT_C CMdELogicCondition& SourceObjectConditionsL(); |
|
84 |
|
85 /** |
|
86 * Returns the logic condition root node of the condition defined for |
|
87 * the object whose URI matches the source URI of the event. |
|
88 */ |
|
89 IMPORT_C CMdELogicCondition& ParticipantObjectConditionsL(); |
|
90 |
|
91 /** |
|
92 * Returns the event ID that the condition matches against. |
|
93 * |
|
94 * @return Event ID. |
|
95 */ |
|
96 IMPORT_C TItemId EventId() const; |
|
97 |
|
98 /** |
|
99 * Returns the event definition that the condition matches against. |
|
100 * |
|
101 * @return Event definition. <code>NULL</code>, if not defined. |
|
102 */ |
|
103 IMPORT_C const CMdEEventDef* EventDef() const; |
|
104 |
|
105 /** |
|
106 * Returns the creation time range of the condition. |
|
107 * |
|
108 * @return Pointer to the time range. <code>NULL</code>, |
|
109 * if not defined. |
|
110 */ |
|
111 IMPORT_C const TMdETimeRange* TimeRange() const; |
|
112 |
|
113 /** |
|
114 * Returns the source URI the condition matches against. |
|
115 * |
|
116 * @return Source URI. <code>NULL</code>, if not defined. |
|
117 */ |
|
118 IMPORT_C const TDesC* SourceURI() const; |
|
119 |
|
120 /** |
|
121 * Returns the participant URI the condition matches against. |
|
122 * |
|
123 * @return Participant URI. <code>NULL</code>, if not defined. |
|
124 */ |
|
125 IMPORT_C const TDesC* ParticipantURI() const; |
|
126 |
|
127 /** |
|
128 * Get possible query's internal optimization flags from condition. |
|
129 * |
|
130 * @param aFlaga query's internal optimization flags |
|
131 * @return last level internal optimization flags |
|
132 */ |
|
133 TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); |
|
134 |
|
135 /** |
|
136 * Get required size of serialized buffer when it is serialized. |
|
137 * |
|
138 * @return required serialized buffer size |
|
139 */ |
|
140 TUint32 RequiredBufferSize() const; |
|
141 |
|
142 /** |
|
143 * Serialize own data to serialized buffer (correct position must be set |
|
144 * before calling) and return new position of serialized buffer. |
|
145 * |
|
146 * @param aBuffer serialized buffer. |
|
147 */ |
|
148 void SerializeL(CMdCSerializationBuffer& aBuffer, |
|
149 TMdCOffset& aFreespaceOffset) const; |
|
150 |
|
151 private: |
|
152 |
|
153 /* Private methods. */ |
|
154 |
|
155 /** |
|
156 * Constructor for a condition that requires that the event ID a |
|
157 * certain ID or event is of a certain type. |
|
158 * |
|
159 * @param aEventId Event ID. |
|
160 * @param aEventDef Event definition. |
|
161 */ |
|
162 CMdEEventCondition(TItemId aEventId, const CMdEEventDef* aEventDef); |
|
163 |
|
164 /** |
|
165 * Second-phase constructor. Pass <code>NULL</code> in parameters that |
|
166 * are not needed. |
|
167 * |
|
168 * @param aCreationTimeRange Range for the creation time. |
|
169 * @param aCompareMethod Comparison method for the string. |
|
170 * @param aString Text string to match. |
|
171 */ |
|
172 void ConstructL(const TMdETimeRange* aCreationTimeRange, |
|
173 TEventConditionCompareMethod aCompareMethod = EEventConditionCompareNone, |
|
174 const TDesC* aString = 0); |
|
175 |
|
176 private: |
|
177 |
|
178 const TItemId iEventId; |
|
179 |
|
180 /** Event definition to match. <code>NULL</code>, if not defined. */ |
|
181 const CMdEEventDef* iEventDef; |
|
182 |
|
183 /** Conditions for the object which the event is associated with. */ |
|
184 CMdELogicCondition* iObjectConditions; |
|
185 |
|
186 /** Creation time range. <code>NULL</code>, if not defined. */ |
|
187 TMdETimeRange* iCreationTimeRange; |
|
188 |
|
189 /** Source of participant URI to match. <code>NULL</code>, if not defined. */ |
|
190 HBufC* iURI; |
|
191 |
|
192 /** Conditions for the object whose URI matches the source URI. */ |
|
193 CMdELogicCondition* iSourceConditions; |
|
194 |
|
195 /** Conditions for the object whose URI matches the participant URI. */ |
|
196 CMdELogicCondition* iParticipantConditions; |
|
197 |
|
198 /** Method of comparison. */ |
|
199 TEventConditionCompareMethod iCompareMethod; |
|
200 }; |
|
201 |
|
202 #endif // __MDEEVENTCONDITION_H__ |
|