|
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: Serialize query criteria |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MDEQUERYCRITERIASERIALIZATION_H__ |
|
19 #define __MDEQUERYCRITERIASERIALIZATION_H__ |
|
20 |
|
21 #include <e32cmn.h> |
|
22 #include <e32def.h> |
|
23 #include <e32des8.h> |
|
24 |
|
25 #include "mdccommon.h" |
|
26 #include "mdcserializationbuffer.h" |
|
27 #include "mdeorderrule.h" |
|
28 #include "mdscommoninternal.h" |
|
29 |
|
30 |
|
31 // forward declaration |
|
32 class CMdELogicCondition; |
|
33 class CMdENamespaceDef; |
|
34 class CMdEObjectDef; |
|
35 |
|
36 |
|
37 /** |
|
38 * Query criteria serialization. |
|
39 */ |
|
40 NONSHARABLE_CLASS(CMdEQueryCriteriaSerialization) : public CBase |
|
41 { |
|
42 friend class CMdSFindSqlClause; |
|
43 |
|
44 public: |
|
45 |
|
46 /* Constructors and destructor. */ |
|
47 |
|
48 /** |
|
49 * Constructs a new serialized query criteria. |
|
50 * @param aResultMode Query's result type |
|
51 * @param aQueryType Type of query |
|
52 * @param aNamespaceDef namespace definition |
|
53 * @param aObjectDef |
|
54 * @param aObjectDefs |
|
55 * @param aLimit |
|
56 * @param aOffset |
|
57 * @param aQueryOptimizationFlags query optimization flags |
|
58 * @param aRootCondition the root condition |
|
59 * @param aOrderRule array of order rules |
|
60 * @param aPropertyFilter array of property filters |
|
61 * |
|
62 * @return query criteria serialization instance |
|
63 * |
|
64 * @leave KErrNotSupported result mode and query type don't match |
|
65 * @leave KErrCompletion result mode is EModeDistinctValues and query |
|
66 * criteria is incorrect |
|
67 */ |
|
68 static CMdEQueryCriteriaSerialization* NewL( |
|
69 TQueryResultMode aResultMode, |
|
70 TQueryType aQueryType, CMdENamespaceDef& aNamespaceDef, |
|
71 CMdEObjectDef* aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs, |
|
72 TUint32 aLimit, TUint32 aOffset, TUint32 aQueryOptimizationFlags, |
|
73 CMdELogicCondition& aRootCondition, |
|
74 RArray<TMdEOrderRule>& aOrderRule, RPointerArray<CMdEPropertyDef>* aPropertyFilter); |
|
75 |
|
76 /** |
|
77 * Constructs a new serialized query criteria and leaves it in the |
|
78 * cleanup stack. |
|
79 * @param aResultMode Query's result type |
|
80 * @param aQueryType Type of query |
|
81 * @param aNamespaceDef namespace definition |
|
82 * @param aObjectDef |
|
83 * @param aObjectDefs |
|
84 * @param aLimit |
|
85 * @param aOffset |
|
86 * @param aQueryOptimizationFlags query optimization flags |
|
87 * @param aRootCondition the root condition |
|
88 * @param aOrderRule array of order rules |
|
89 * @param aPropertyFilter array of property filters |
|
90 * |
|
91 * @return query criteria serialization instance |
|
92 * |
|
93 * @leave KErrNotSupported result mode and query type don't match |
|
94 * @leave KErrCompletion result mode is EModeDistinctValues and query |
|
95 * criteria is incorrect |
|
96 */ |
|
97 static CMdEQueryCriteriaSerialization* NewLC( |
|
98 TQueryResultMode aResultMode, |
|
99 TQueryType aQueryType, CMdENamespaceDef& aNamespaceDef, |
|
100 CMdEObjectDef* aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs, |
|
101 TUint32 aLimit, TUint32 aOffset, TUint32 aQueryOptimizationFlags, |
|
102 CMdELogicCondition& aRootCondition, |
|
103 RArray<TMdEOrderRule>& aOrderRule, RPointerArray<CMdEPropertyDef>* aPropertyFilter); |
|
104 |
|
105 /** |
|
106 * Constructs a new serialized query criteria. |
|
107 * @param aSerializationBuffer serialized query |
|
108 * |
|
109 * @return query criteria serialization instance |
|
110 */ |
|
111 static CMdEQueryCriteriaSerialization* NewL(CMdCSerializationBuffer& aSerializationBuffer); |
|
112 |
|
113 /** |
|
114 * Constructs a new serialized query criteria and leaves it in the |
|
115 * cleanup stack. |
|
116 * @param aSerializationBuffer serialized query |
|
117 * |
|
118 * @return query criteria serialization instance |
|
119 */ |
|
120 static CMdEQueryCriteriaSerialization* NewLC(CMdCSerializationBuffer& aSerializationBuffer); |
|
121 |
|
122 /** |
|
123 * Destructor. |
|
124 */ |
|
125 virtual ~CMdEQueryCriteriaSerialization(); |
|
126 |
|
127 /** |
|
128 * Returns pointer to the serialized data (read only) |
|
129 */ |
|
130 TPtr8 Buffer() const; |
|
131 |
|
132 /** |
|
133 * Returns pointer to the serialized data (read only) |
|
134 */ |
|
135 const TPtr8* BufferPtr() const; |
|
136 |
|
137 /** |
|
138 * Returns pointer to the serialization buffer |
|
139 */ |
|
140 CMdCSerializationBuffer& SerializationBuffer(); |
|
141 |
|
142 private: |
|
143 |
|
144 /* Constructors. */ |
|
145 |
|
146 /** |
|
147 * Constructor. |
|
148 */ |
|
149 CMdEQueryCriteriaSerialization(TBool aOwnSerializedBuffer); |
|
150 |
|
151 /** |
|
152 * Second-phase constructor. |
|
153 * |
|
154 * @param aResultMode result mode to serialize |
|
155 * @param aQueryType query type to serialize |
|
156 * @param aLimit limit to serialize |
|
157 * @param aOffset offset to serialize |
|
158 * @param aCondition root logic condition to serialize |
|
159 * @param aOrderRule order rules to serialize |
|
160 * @param aPropertyFilter property filters to serialize |
|
161 */ |
|
162 void ConstructL( TQueryResultMode aResultMode, TQueryType aQueryType, |
|
163 CMdENamespaceDef& aNamespaceDef, |
|
164 CMdEObjectDef* aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs, |
|
165 TUint32 aLimit, TUint32 aOffset, TUint32 aQueryOptimizationFlags, |
|
166 CMdELogicCondition& aRootCondition, RArray<TMdEOrderRule>& aOrderRules, |
|
167 RPointerArray<CMdEPropertyDef>* aPropertyFilter ); |
|
168 |
|
169 private: |
|
170 |
|
171 /** Serialized query criteria. */ |
|
172 CMdCSerializationBuffer* iSerializedBuffer; |
|
173 |
|
174 /** Does own serialized buffer. */ |
|
175 const TBool iOwnSerializedBuffer; |
|
176 }; |
|
177 |
|
178 |
|
179 #endif // __MDEQUERYCRITERIASERIALIZATION_H__ |