|
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 __MDETEXTPROPERTYCONDITION_H__ |
|
20 #define __MDETEXTPROPERTYCONDITION_H__ |
|
21 |
|
22 |
|
23 #include <mdepropertycondition.h> |
|
24 |
|
25 |
|
26 /* Forward declarations. */ |
|
27 class CMdEPropertyDef; |
|
28 |
|
29 |
|
30 /** |
|
31 * Instances of CMdETextPropertyCondition are associated with a specific |
|
32 * property definition. |
|
33 */ |
|
34 NONSHARABLE_CLASS(CMdETextPropertyCondition) : public CMdEPropertyCondition |
|
35 { |
|
36 public: |
|
37 |
|
38 /* Constructors and destructor. */ |
|
39 |
|
40 /** |
|
41 * Constructs a new text property condition node. |
|
42 * |
|
43 * @param aPropertyDef Property definition. |
|
44 * @param aCompareMethod Text comparison method. |
|
45 * @param aText Text to look for. |
|
46 */ |
|
47 static CMdETextPropertyCondition* NewL(const CMdEPropertyDef& aPropertyDef, |
|
48 TTextPropertyConditionCompareMethod aCompareMethod, |
|
49 const TDesC& aText); |
|
50 |
|
51 /** |
|
52 * Constructs a new text property condition node, leaving it on the |
|
53 * cleanup stack. |
|
54 * |
|
55 * @param aPropertyDef Property definition. |
|
56 * @param aCompareMethod Text comparison method. |
|
57 * @param aText Text to look for. |
|
58 */ |
|
59 static CMdETextPropertyCondition* NewLC(const CMdEPropertyDef& aPropertyDef, |
|
60 TTextPropertyConditionCompareMethod aCompareMethod, |
|
61 const TDesC& aText); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CMdETextPropertyCondition(); |
|
67 |
|
68 |
|
69 /* Methods. */ |
|
70 |
|
71 /** |
|
72 * Returns the text of the condition. |
|
73 * |
|
74 * @return Text descriptor. |
|
75 */ |
|
76 const TDesC& Text() const; |
|
77 |
|
78 /** |
|
79 * Returns the comparison method of the condition. |
|
80 * |
|
81 * @return Comparison method. |
|
82 */ |
|
83 TTextPropertyConditionCompareMethod CompareMethod() const; |
|
84 |
|
85 /** |
|
86 * Get possible query's internal optimization flags from condition. |
|
87 * |
|
88 * @param aFlaga query's internal optimization flags |
|
89 * @return last level internal optimization flags |
|
90 */ |
|
91 TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); |
|
92 |
|
93 /** |
|
94 * Get required size of serialized buffer when this is serialized. |
|
95 * |
|
96 * @return required size of serialized buffer |
|
97 */ |
|
98 TUint32 RequiredBufferSize() const; |
|
99 |
|
100 /** |
|
101 * Serialize own data to serialized buffer (correct position must be set |
|
102 * before calling) and return new position of serialized buffer. |
|
103 * |
|
104 * @param aBuffer serialized buffer. |
|
105 */ |
|
106 void SerializeL(CMdCSerializationBuffer& aBuffer, |
|
107 TMdCOffset& aFreespaceOffset) const; |
|
108 |
|
109 protected: |
|
110 |
|
111 /** |
|
112 * Constructor. |
|
113 * |
|
114 * @param aType type of the condition node |
|
115 */ |
|
116 CMdETextPropertyCondition(const CMdEPropertyDef& aPropertyDef, |
|
117 TTextPropertyConditionCompareMethod aCompareMethod); |
|
118 |
|
119 |
|
120 /** |
|
121 * Second-phase constuctor. |
|
122 */ |
|
123 void ConstructL(const TDesC& aText); |
|
124 |
|
125 |
|
126 private: |
|
127 |
|
128 /* Private methods. */ |
|
129 |
|
130 |
|
131 private: |
|
132 |
|
133 /** The comparison method used when searching for the string. */ |
|
134 TTextPropertyConditionCompareMethod iCompareMethod; |
|
135 |
|
136 /** The string to look for. */ |
|
137 HBufC* iText; |
|
138 }; |
|
139 |
|
140 #endif // __MDETEXTPROPERTYCONDITION_H__ |