|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Class representing the search condition with clauses |
|
15 * a file |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_SEARCHBOOLEANCONDITION_H |
|
21 #define C_SEARCHBOOLEANCONDITION_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <s32strm.h> |
|
25 #include <searchcondition.h> |
|
26 |
|
27 /** |
|
28 * Represents a boolean condition in search criteria. Boolean condition |
|
29 * always contains other conditions that are linked to a boolean clause. |
|
30 * I.e. this can be used to link several single conditions with boolean |
|
31 * operators. |
|
32 * E.g. sender = John Smith AND subject = hello. This type of query is |
|
33 * formed by having one boolean condition inserted with to simple conditions |
|
34 * both linking to EBooleanMust clauses. |
|
35 * Currently nested boolean conditions are not supported. |
|
36 * |
|
37 * @lib searchutilities.lib |
|
38 */ |
|
39 NONSHARABLE_CLASS( CSearchBooleanCondition ) : public CSearchCondition |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Clauses, linking conditions |
|
46 */ |
|
47 enum TBooleanClause |
|
48 { |
|
49 EBooleanMust, |
|
50 EBooleanShould, |
|
51 EBooleanMustNot |
|
52 }; |
|
53 |
|
54 /** |
|
55 * two phase constructor |
|
56 * |
|
57 * @return CSearchBooleanCondition |
|
58 */ |
|
59 IMPORT_C static CSearchBooleanCondition* NewL(); |
|
60 |
|
61 /** |
|
62 * two phase constructor |
|
63 * |
|
64 * @param aStream - Stream |
|
65 * @return CSearchBooleanCondition |
|
66 */ |
|
67 IMPORT_C static CSearchBooleanCondition* NewL( RReadStream& aStream ); |
|
68 |
|
69 /** |
|
70 * destructor |
|
71 */ |
|
72 virtual ~CSearchBooleanCondition(); |
|
73 |
|
74 /** |
|
75 * Externalizes the object |
|
76 * @param aStream |
|
77 */ |
|
78 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
79 |
|
80 /** |
|
81 * Adds a new condition and boolean clause to condition array. Adding another boolean |
|
82 * condition is not currently supported and function will leave with KErrArgument in |
|
83 * such a case. |
|
84 * |
|
85 * @param aCondition The condition to be added. |
|
86 * @param aClause The clause to be linked to the condition. |
|
87 */ |
|
88 IMPORT_C void AddConditionL( CSearchCondition* aCondition, TBooleanClause aClause ); |
|
89 |
|
90 /** |
|
91 * Gets the conditions |
|
92 * |
|
93 * @param aConditions |
|
94 * @param aClauses |
|
95 */ |
|
96 IMPORT_C void GetConditions( RPointerArray<CSearchCondition>& aConditions, |
|
97 RArray<TBooleanClause>& aClauses ) const; |
|
98 |
|
99 private: |
|
100 |
|
101 /** |
|
102 * Constructor |
|
103 * |
|
104 * @param aType |
|
105 */ |
|
106 CSearchBooleanCondition( CSearchCondition::TConditionType aType ); |
|
107 |
|
108 /** |
|
109 * 2nd phase constructor |
|
110 * |
|
111 * @param aStream |
|
112 */ |
|
113 void ConstructL( RReadStream& aStream ); |
|
114 |
|
115 private: |
|
116 |
|
117 /** |
|
118 * Simple Conditions |
|
119 */ |
|
120 RPointerArray<CSearchCondition> iConditions; |
|
121 |
|
122 /** |
|
123 * Clauses to link Simple Conditions |
|
124 */ |
|
125 RArray<TBooleanClause> iClauses; |
|
126 |
|
127 }; |
|
128 |
|
129 |
|
130 #endif //C_SEARCHBOOLEANCONDITION_H |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |