williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: CPosLmCompositeCriteria class
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef CPOSLMCOMPOSITECRITERIA_H
|
williamr@2
|
20 |
#define CPOSLMCOMPOSITECRITERIA_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#include <e32base.h>
|
williamr@2
|
23 |
#include "EPos_CPosLmSearchCriteria.h"
|
williamr@2
|
24 |
|
williamr@2
|
25 |
/**
|
williamr@2
|
26 |
* Class used to combine multiple search criterion.
|
williamr@2
|
27 |
*
|
williamr@2
|
28 |
* For instance, to search for all restaurants in the area, this class can be
|
williamr@2
|
29 |
* used to combine a @ref CPosLmAreaCriteria and a @ref CPosLmCategoryCriteria.
|
williamr@2
|
30 |
*
|
williamr@2
|
31 |
* If a @ref CPosLmNearestCriteria is used and no sort preference is specified,
|
williamr@2
|
32 |
* the result will be sorted by distance. If more than one
|
williamr@2
|
33 |
* @ref CPosLmNearestCriteria are combined using a @ref CPosLmCompositeCriteria,
|
williamr@2
|
34 |
* the sort order will be undefined unless a sort preference is specified.
|
williamr@2
|
35 |
*
|
williamr@2
|
36 |
* Nested @ref CPosLmCompositeCriteria are not allowed.
|
williamr@2
|
37 |
*
|
williamr@2
|
38 |
* This criterion only supports searching for landmarks, e.g. if it is passed
|
williamr@2
|
39 |
* to @p CPosLandmarkSearch::StartCategorySearchL, the function will fail with
|
williamr@2
|
40 |
* error code @p KErrNotSupported.
|
williamr@2
|
41 |
*
|
williamr@2
|
42 |
* @lib eposlmsearchlib.lib
|
williamr@2
|
43 |
* @since S60 3.0
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
class CPosLmCompositeCriteria : public CPosLmSearchCriteria
|
williamr@2
|
46 |
{
|
williamr@2
|
47 |
public:
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* Specifies the type of the composite criterion.
|
williamr@2
|
51 |
* ECompositionOR - is supported only when all the contained critarias are CPosLmTextCriteria. it is not supported for other criteria.
|
williamr@2
|
52 |
*/
|
williamr@2
|
53 |
enum TCompositionType
|
williamr@2
|
54 |
{
|
williamr@2
|
55 |
ECompositionAND = 0, /**< Search results must match all
|
williamr@2
|
56 |
* contained criteria. */
|
williamr@2
|
57 |
ECompositionOR = 1 /**< Search result must match one of the contained criteria
|
williamr@2
|
58 |
|
williamr@2
|
59 |
* ECompositionOR - is supported only when all the contained critarias are CPosLmTextCriteria. it is not supported for other criteria*/
|
williamr@2
|
60 |
};
|
williamr@2
|
61 |
|
williamr@2
|
62 |
public:
|
williamr@2
|
63 |
|
williamr@2
|
64 |
/**
|
williamr@2
|
65 |
* Two-phased constructor.
|
williamr@2
|
66 |
*
|
williamr@2
|
67 |
* @param[in] aType The composition type to use.
|
williamr@2
|
68 |
* @returns A new instance of this class.
|
williamr@2
|
69 |
*/
|
williamr@2
|
70 |
IMPORT_C static CPosLmCompositeCriteria* NewLC(
|
williamr@2
|
71 |
TCompositionType aType
|
williamr@2
|
72 |
);
|
williamr@2
|
73 |
|
williamr@2
|
74 |
/**
|
williamr@2
|
75 |
* Destructor.
|
williamr@2
|
76 |
*/
|
williamr@2
|
77 |
virtual ~CPosLmCompositeCriteria();
|
williamr@2
|
78 |
|
williamr@2
|
79 |
public:
|
williamr@2
|
80 |
|
williamr@2
|
81 |
/**
|
williamr@2
|
82 |
* Returns the type of this composite criterion.
|
williamr@2
|
83 |
*
|
williamr@2
|
84 |
* @return The composition type.
|
williamr@2
|
85 |
*/
|
williamr@2
|
86 |
IMPORT_C TCompositionType CompositionType() const;
|
williamr@2
|
87 |
|
williamr@2
|
88 |
/**
|
williamr@2
|
89 |
* Set the type of this composite criterion.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* @param[in] The composition type to use.
|
williamr@2
|
92 |
*/
|
williamr@2
|
93 |
IMPORT_C void SetCompositionType( TCompositionType aType );
|
williamr@2
|
94 |
|
williamr@2
|
95 |
/**
|
williamr@2
|
96 |
* Returns the number of criteria this object contains.
|
williamr@2
|
97 |
*
|
williamr@2
|
98 |
* @return The number of criteria this object contains.
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
IMPORT_C TUint NumOfArguments() const;
|
williamr@2
|
101 |
|
williamr@2
|
102 |
/**
|
williamr@2
|
103 |
* Returns a criterion argument contained in this object.
|
williamr@2
|
104 |
*
|
williamr@2
|
105 |
* This overload returns a const reference to the criterion argument.
|
williamr@2
|
106 |
* There is another overload which returns a non-const reference.
|
williamr@2
|
107 |
*
|
williamr@2
|
108 |
* @param aIndex The argument to read. Must be in the interval
|
williamr@2
|
109 |
* [0, @ref NumOfArguments - 1], or this function will raise a
|
williamr@2
|
110 |
* USER-130 panic.
|
williamr@2
|
111 |
* @return The requested argument.
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
IMPORT_C const CPosLmSearchCriteria& Argument( TUint aIndex ) const;
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Returns a criterion argument contained in this object.
|
williamr@2
|
117 |
*
|
williamr@2
|
118 |
* This overload returns a non-const reference to the criterion
|
williamr@2
|
119 |
* argument. There is another overload which returns a const reference.
|
williamr@2
|
120 |
*
|
williamr@2
|
121 |
* @param aIndex The argument to read. Must be in the interval
|
williamr@2
|
122 |
* [0, @ref NumOfArguments - 1], or this function will raise a
|
williamr@2
|
123 |
* USER-130 panic.
|
williamr@2
|
124 |
* @return The requested argument.
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
IMPORT_C CPosLmSearchCriteria& Argument( TUint aIndex );
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
* Adds a criterion to this composition.
|
williamr@2
|
130 |
*
|
williamr@2
|
131 |
* The composite criterion must contain at least one argument, otherwise
|
williamr@2
|
132 |
* @ref CPosLandmarkSearch::StartLandmarkSearchL will fail with error
|
williamr@2
|
133 |
* code @p KErrArgument.
|
williamr@2
|
134 |
*
|
williamr@2
|
135 |
* If this function returns without an error code, ownership of the
|
williamr@2
|
136 |
* added criterion object is transferred to the composite object.
|
williamr@2
|
137 |
*
|
williamr@2
|
138 |
* @ref CPosLmCompositeCriteria are not supported when composition type is @ref ECompositionAND.
|
williamr@2
|
139 |
* @ref Only CPosLmTextCriteria is supported in the case of @ref ECompositionOR
|
williamr@2
|
140 |
*
|
williamr@2
|
141 |
* Searching for landmark categories using @ref CPosLmCompositeCriteria
|
williamr@2
|
142 |
* is not supported in the case of ECompositionAND.
|
williamr@2
|
143 |
*
|
williamr@2
|
144 |
* @param[in] aCriteria The criterion to add to the composition.
|
williamr@2
|
145 |
* @returns - @p KErrNone if successful
|
williamr@2
|
146 |
* - @p KErrNotSupported
|
williamr@2
|
147 |
* - @p if @ref CPosLmCompositeCriteria or @ref CPosLmCatNameCriteria is specified when coposition type is ECompositionAND.
|
williamr@2
|
148 |
* - @p If criteria other than CPosLmTextCriteria is specified with ECompositionOR
|
williamr@2
|
149 |
* - @p otherwise a system wide error code.
|
williamr@2
|
150 |
*/
|
williamr@2
|
151 |
IMPORT_C TInt AddArgument( CPosLmSearchCriteria* aCriteria );
|
williamr@2
|
152 |
|
williamr@2
|
153 |
/**
|
williamr@2
|
154 |
* Removes a criterion from this composition.
|
williamr@2
|
155 |
*
|
williamr@2
|
156 |
* Note: This function does not delete the criterion object. Instead,
|
williamr@2
|
157 |
* the ownership of the object is passed to the caller.
|
williamr@2
|
158 |
*
|
williamr@2
|
159 |
* @param aIndex The argument to remove. Must be in the interval
|
williamr@2
|
160 |
* [0, @ref NumOfArguments - 1], or this function will raise a
|
williamr@2
|
161 |
* USER-130 panic.
|
williamr@2
|
162 |
*
|
williamr@2
|
163 |
* @returns The criterion object which was removed from the composition.
|
williamr@2
|
164 |
*/
|
williamr@2
|
165 |
IMPORT_C CPosLmSearchCriteria* RemoveArgument( TUint aIndex );
|
williamr@2
|
166 |
|
williamr@2
|
167 |
/**
|
williamr@2
|
168 |
* Removes and deletes all contained criterion objects.
|
williamr@2
|
169 |
*
|
williamr@2
|
170 |
* The composite criterion must contain at least one argument, otherwise
|
williamr@2
|
171 |
* @ref CPosLandmarkSearch::StartLandmarkSearchL will fail with error
|
williamr@2
|
172 |
* code @p KErrArgument.
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
IMPORT_C void ClearArguments();
|
williamr@2
|
175 |
|
williamr@2
|
176 |
private:
|
williamr@2
|
177 |
|
williamr@2
|
178 |
CPosLmCompositeCriteria( TCompositionType aType );
|
williamr@2
|
179 |
|
williamr@2
|
180 |
void ConstructL();
|
williamr@2
|
181 |
|
williamr@2
|
182 |
// Prohibit copy constructor
|
williamr@2
|
183 |
CPosLmCompositeCriteria( const CPosLmCompositeCriteria& );
|
williamr@2
|
184 |
// Prohibit assigment operator
|
williamr@2
|
185 |
CPosLmCompositeCriteria& operator= ( const CPosLmCompositeCriteria& );
|
williamr@2
|
186 |
|
williamr@2
|
187 |
private:
|
williamr@2
|
188 |
|
williamr@2
|
189 |
TCompositionType iCompositionType;
|
williamr@2
|
190 |
RPointerArray<CPosLmSearchCriteria> iArguments;
|
williamr@2
|
191 |
|
williamr@2
|
192 |
};
|
williamr@2
|
193 |
|
williamr@2
|
194 |
#endif // CPOSLMCOMPOSITECRITERIA_H
|
williamr@2
|
195 |
|
williamr@2
|
196 |
|