|
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: Interface for object query |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MDEOBJECTQUERY_H__ |
|
20 #define __MDEOBJECTQUERY_H__ |
|
21 |
|
22 |
|
23 #include <mdequery.h> |
|
24 |
|
25 /* Forward declarations. */ |
|
26 class CMdEObject; |
|
27 class CMdEObjectDef; |
|
28 class CMdEPropertyDef; |
|
29 class CMdEObjectDef; |
|
30 class CMdESession; |
|
31 |
|
32 /** |
|
33 * A query that fetches a set of objects from the metadata engine database. |
|
34 */ |
|
35 NONSHARABLE_CLASS(CMdEObjectQuery) : public CMdEQuery |
|
36 { |
|
37 public: |
|
38 |
|
39 /* Constructors and destructor. */ |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 virtual ~CMdEObjectQuery(); |
|
45 |
|
46 |
|
47 /* Methods. */ |
|
48 |
|
49 |
|
50 /** |
|
51 * Adds new propertyfilter. Propertyfilters determines which properties |
|
52 * are included in result. |
|
53 |
|
54 * @param aPropertyDef property definition of property which is wanted to |
|
55 be part of result. |
|
56 */ |
|
57 IMPORT_C void AddPropertyFilterL( const CMdEPropertyDef* aPropertyDef ); |
|
58 |
|
59 /** |
|
60 Clears propertyfilters. After call to this function all properties are |
|
61 returned unless call to <code>AddPropertyFilterL</code> is done. |
|
62 */ |
|
63 |
|
64 IMPORT_C void ResetPropertyFilter(); |
|
65 |
|
66 /** |
|
67 * Returns one of the result objects. |
|
68 * |
|
69 * @return The result object that was requested. The query retains |
|
70 * ownership of the returned object. |
|
71 */ |
|
72 IMPORT_C CMdEObject& Result(TInt aIndex) const; |
|
73 |
|
74 /** |
|
75 * Returns query's object definition. |
|
76 * |
|
77 * @return object definition. |
|
78 */ |
|
79 IMPORT_C CMdEObjectDef& ObjectDef() const; |
|
80 |
|
81 CMdEObjectQuery(); |
|
82 |
|
83 public: |
|
84 RPointerArray<CMdEPropertyDef>& PropertyFilter(); |
|
85 |
|
86 RPointerArray<CMdEObjectDef>* ObjectDefs() const; |
|
87 |
|
88 CMdEObjectQuery(CMdESession& aSession, CMdENamespaceDef& aNamespaceDef, |
|
89 CMdEObjectDef& aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs); |
|
90 |
|
91 protected: |
|
92 |
|
93 /* Constructors. */ |
|
94 |
|
95 /** |
|
96 * Constuctor. |
|
97 * |
|
98 * @param aSession Session. |
|
99 */ |
|
100 |
|
101 /** |
|
102 * Second-phase constructor. |
|
103 */ |
|
104 void ObjectQueryConstructL(); |
|
105 |
|
106 virtual void DoCancel(); |
|
107 |
|
108 private: |
|
109 |
|
110 /* Private methods. */ |
|
111 |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Properties to include when fetching results. Empty, if |
|
117 * all available properties should be fetched. |
|
118 */ |
|
119 RPointerArray<CMdEPropertyDef> iPropertyFilters; |
|
120 |
|
121 /** |
|
122 * Query's object definition. |
|
123 */ |
|
124 CMdEObjectDef& iObjectDef; |
|
125 |
|
126 /** |
|
127 * Query's object definition. |
|
128 */ |
|
129 RPointerArray<CMdEObjectDef>* iObjectDefs; |
|
130 |
|
131 /** |
|
132 * Speed optimization to drop freetexts from results. |
|
133 */ |
|
134 TBool iFreetextsInResult; |
|
135 }; |
|
136 |
|
137 #endif // __MDEOBJECTQUERY_H__ |