2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: For adding content to be synchronized.
19 #ifndef __SYNCMLDATAFILTER_H__
20 #define __SYNCMLDATAFILTER_H__
22 //-------------------------------------------------------------------------------------------------
24 //-------------------------------------------------------------------------------------------------
29 //-------------------------------------------------------------------------------------------------
31 //-------------------------------------------------------------------------------------------------
33 // Filter type (inclusive/exclusive)
34 enum TSyncMLFilterType
40 // Logical operator of CGI script
41 enum TSyncMLFilterMatchType
43 ESyncMLMatchDisabled, // Value cannot be changed
44 ESyncMLMatchNotSelected, // Value is not set yet
49 // Data type of filter property
50 enum TSyncMLFilterPropertyDataType
54 ESyncMLDataTypeNumber,
61 // This is used when DataProvider makes some changes to dynamic filters
62 // or removes/adds filter based on store format of remote server
63 enum TSyncMLFilterChangeInfo
67 ESyncMLDynamicFiltersUpdated,
68 ESyncMLFiltersMoreFiltersSupportedByServer,
69 ESyncMLFiltersLessFiltersSupportedByServer,
70 ESyncMLFiltersUpdated // General if many changes
75 * Filter Property Class.
77 * @lib syncmldatafilter.lib
79 class CSyncMLFilterProperty : public CBase
83 * Symbian two-phased constructor.
85 IMPORT_C static CSyncMLFilterProperty* NewLC();
88 * Symbian two-phased constructor.
89 * @param aReader TResourceReader for recource file that includes needed information to initialize filter property.
91 IMPORT_C static CSyncMLFilterProperty* NewLC( TResourceReader& aReader );
94 * Symbian two-phased constructor.
95 * @param aStream RReadStream for stream that includes needed information to initialize filter property.
97 IMPORT_C static CSyncMLFilterProperty* NewLC( RReadStream& aStream );
102 IMPORT_C ~CSyncMLFilterProperty();
105 * Externalizes filter property.
106 * @param aStream Specifies stream where filter property is externalized.
108 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
111 * Name of filter property.
112 * @return TDesC Name of the filter property.
114 IMPORT_C const TDesC& DisplayName() const;
117 * Data type of default values for filter property.
118 * @return TSyncMLFilterPropertyDataType Data type.
120 IMPORT_C TSyncMLFilterPropertyDataType DefaultValueDataType() const;
123 * Data type of query value for filter property.
124 * @return TSyncMLFilterPropertyDataType Data type.
126 IMPORT_C TSyncMLFilterPropertyDataType QueryValueDataType() const;
129 * Maximum text length of filter property. This is useful only if data type is text16 or text8.
130 * @return TUint Maximum text length of the filter property.
132 IMPORT_C TUint MaxTextLength() const;
135 * Number of default values.
136 * @return TInt Number of default values of the filter property.
138 IMPORT_C TInt DefaultValueCount() const;
141 * Default value from given index for text16 property. This is useful only if data type is text16.
142 * @param aIndex Specifies index where default value is returned.
143 * @return TDesC16 Default value from given index.
145 IMPORT_C const TDesC16& DefaultValueText16L( TInt aIndex ) const;
148 * Default value from given index for text8 property. This is useful only if data type is text8.
149 * @param aIndex Specifies index where default value is returned.
150 * @return TDesC8 Default value from given index.
152 IMPORT_C const TDesC8& DefaultValueText8L( TInt aIndex ) const;
155 * Default value from given index for number property. This is useful only if data type is number.
156 * @param aIndex Specifies index where default value is returned.
157 * @return TInt Default value from given index.
159 IMPORT_C TInt DefaultValueIntL( TInt aIndex ) const;
162 * Default value from given index for boolean property. This is useful only if data type is boolean.
163 * @param aIndex Specifies index where default value is returned.
164 * @return TBool Default value from given index.
166 IMPORT_C TBool DefaultValueBoolL( TInt aIndex ) const;
169 * Default value from given index for date property. This is useful only if data type is date.
170 * @param aIndex Specifies index where default value is returned.
171 * @return TTime Default value from given index.
173 IMPORT_C const TTime& DefaultValueDateL( TInt aIndex ) const;
176 * Default value from given index for time property. This is useful only if data type is time.
177 * @param aIndex Specifies index where default value is returned.
178 * @return TTime Default value from given index.
180 IMPORT_C const TTime& DefaultValueTimeL( TInt aIndex ) const;
183 * Clears all default values and value selections.
185 IMPORT_C void ClearDefaultValuesL();
188 * Adds default value for text16 property. This is useful only if data type is text16.
189 * @param aNewDefaultValue Value of added default value.
190 * @param aSelected Specifies if value is selected or not.
192 IMPORT_C void AddDefaultValueText16L( TDesC16& aNewDefaultValue, const TBool aSelected );
195 * Adds default value for text8 property. This is useful only if data type is text8.
196 * @param aNewDefaultValue Value of added default value.
197 * @param aSelected Specifies if value is selected or not.
199 IMPORT_C void AddDefaultValueText8L( TDesC8& aNewDefaultValue, const TBool aSelected );
202 * Adds default value for number property. This is useful only if data type is number.
203 * @param aNewDefaultValue Value of added default value.
204 * @param aSelected Specifies if value is selected or not.
206 IMPORT_C void AddDefaultValueIntL( const TInt aNewDefaultValue, const TBool aSelected );
209 * Adds default value for boolean property. This is useful only if data type is boolean.
210 * @param aNewDefaultValue Value of added default value.
211 * @param aSelected Specifies if value is selected or not.
213 IMPORT_C void AddDefaultValueBoolL( const TBool aNewDefaultValue, const TBool aSelected );
216 * Adds default value for date property. This is useful only if data type is date.
217 * @param aNewDefaultValue Value of added default value.
218 * @param aSelected Specifies if value is selected or not.
220 IMPORT_C void AddDefaultValueDateL( const TTime& aNewDefaultValue, const TBool aSelected );
223 * Adds default value for time property. This is useful only if data type is time.
224 * @param aNewDefaultValue Value of added default value.
225 * @param aSelected Specifies if value is selected or not.
227 IMPORT_C void AddDefaultValueTimeL( const TTime& aNewDefaultValue, const TBool aSelected );
230 * Can use query value with default values or not.
231 * @return TBool Returns ETrue if query can be used. Otherwise EFalse is returned.
233 IMPORT_C TBool CanUseQueryValue() const;
236 * Does filter property support multiple selection.
237 * @return TBool Returns ETrue if multiple values can be selected. Otherwise EFalse is returned.
239 IMPORT_C TBool SupportsMultipleSelection() const;
242 * Does filter property support empty selection.
243 * @return TBool Returns ETrue if none of values can be selected. Otherwise EFalse is returned.
245 IMPORT_C TBool SupportsEmptySelection() const;
248 * Returns information about which default values are selected.
249 * @param aIndex Specifies index where selection information is returned.
250 * @return TBool Returns ETrue if default value in given index is selected. Otherwise EFalse is returned.
252 IMPORT_C TBool IsDefaultValueSelected( TInt aIndex ) const;
255 * Returns information about query value selection. This is useful only if query value can be used.
256 * @return TBool Returns ETrue if query value is selected. Otherwise EFalse is returned.
258 IMPORT_C TBool IsQueryValueSelected() const;
261 * Selects default value from given index.
262 * @param aIndex Specifies index which is selected.
264 IMPORT_C void SelectDefaultValueL( TInt aIndex );
267 * Unselects default value from given index.
268 * @param aIndex Specifies index which is unselected.
270 IMPORT_C void UnselectDefaultValueL( TInt aIndex );
273 * Returns query value for text16 property. This is useful only if data type is text16 and if query value can be used.
274 * @return TDesC16 Query value.
276 IMPORT_C const TDesC16& QueryValueText16L() const;
279 * Returns query value for text8 property. This is useful only if data type is text8 and if query value can be used.
280 * @return TDesC8 Query value.
282 IMPORT_C const TDesC8& QueryValueText8L() const;
285 * Returns query value for number property. This is useful only if data type is number and if query value can be used.
286 * @return TInt Query value.
288 IMPORT_C TInt QueryValueIntL() const;
291 * Returns query value for boolean property. This is useful only if data type is boolean and if query value can be used.
292 * @return TBool Query value.
294 IMPORT_C TBool QueryValueBoolL() const;
297 * Returns query value for date property. This is useful only if data type is date and if query value can be used.
298 * @return TTime Query value.
300 IMPORT_C const TTime& QueryValueDateL() const;
303 * Returns query value for time property. This is useful only if data type is time and if query value can be used.
304 * @return TTime Query value.
306 IMPORT_C const TTime& QueryValueTimeL() const;
309 * Unselects query value. This is useful only if query value can be used.
310 * This method still keeps the value
312 IMPORT_C void UnselectQueryValueL();
315 * Sets query value for text16 property. This is useful only if data type is text16 and if query value can be used.
316 * This method also selects query value.
317 * @param aValue Specifies new value for query value.
319 IMPORT_C void SetQueryValueText16L( const TDesC16& aValue );
322 * Sets query value for text8 property. This is useful only if data type is text8 and if query value can be used.
323 * This method also selects query value.
324 * @param aValue Specifies new value for query value.
326 IMPORT_C void SetQueryValueText8L( const TDesC8& aValue );
329 * Sets query value for number property. This is useful only if data type is number and if query value can be used.
330 * This method also selects query value.
331 * @param aValue Specifies new value for query value.
333 IMPORT_C void SetQueryValueIntL( TInt aValue );
336 * Sets query value for boolean property. This is useful only if data type is boolean and if query value can be used.
337 * This method also selects query value.
338 * @param aValue Specifies new value for query value.
340 IMPORT_C void SetQueryValueBoolL( TBool aValue );
343 * Sets query value for date property. This is useful only if data type is date and if query value can be used.
344 * This method also selects query value.
345 * @param aValue Specifies new value for query value.
347 IMPORT_C void SetQueryValueDateL( const TTime& aValue );
350 * Sets query value for time property. This is useful only if data type is time and if query value can be used.
351 * This method also selects query value.
352 * @param aValue Specifies new value for query value.
354 IMPORT_C void SetQueryValueTimeL( const TTime& aValue );
358 * @return Size of internal data
360 IMPORT_C TInt DataSize();
366 CSyncMLFilterProperty();
371 TSyncMLFilterPropertyDataType iDataTypeForDefaultValues;
372 TSyncMLFilterPropertyDataType iDataTypeForQueryValue;
373 TUint iMaxTextLength;
375 RPointerArray<HBufC16> iDefaultValueText16List;
376 RPointerArray<HBufC8> iDefaultValueText8List;
377 RArray<TInt> iDefaultValueIntOrBoolList;
378 RPointerArray<TTime> iDefaultValueDateOrTimeList;
380 TBool iCanUseQueryValue;
381 TBool iSupportsMultpleSelection;
382 TBool iSupportsEmptySelection;
384 RArray<TBool> iDefaultValueSelected;
385 TBool iQueryValueSelected;
387 HBufC16* iQueryValueText16;
388 HBufC8* iQueryValueText8;
389 TInt iQueryValueIntOrBool;
390 TTime iQueryValueDateOrTime;
398 * @lib syncmldatafilter.lib
400 class CSyncMLFilter : public CBase
404 * Symbian two-phased constructor.
406 IMPORT_C static CSyncMLFilter* NewLC();
409 * Symbian two-phased constructor.
410 * @param aReader TResourceReader for recource file that includes needed information to initialize filter.
412 IMPORT_C static CSyncMLFilter* NewLC( TResourceReader& aReader );
415 * Symbian two-phased constructor.
416 * @param aStream RReadStream for stream that includes needed information to initialize filter.
418 IMPORT_C static CSyncMLFilter* NewLC( RReadStream& aStream );
423 IMPORT_C ~CSyncMLFilter();
426 * Externalizes filter.
427 * @param aStream Specifies stream where filter is externalized.
429 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
433 * @return TUint ID of the filter.
435 IMPORT_C TUint FilterId() const;
439 * @return TDesC Name of the filter.
441 IMPORT_C const TDesC& DisplayName() const
444 * Description of filter.
445 * @return TDesC Description of the filter.
447 IMPORT_C const TDesC& DisplayDescription() const;
450 * Filter enable/disable information.
451 * @return TBool ETrue if filter is enabled. Otherwise EFalse is returned.
453 IMPORT_C TBool Enabled() const;
456 * Set filter enable/disable information.
457 * @param aEnabled ETrue if filter enabled and EFalse is filter is disabled
459 IMPORT_C void SetEnabledL( const TBool aEnabled );
462 * Information about server capabilities to support this filter.
463 * @return TBool ETrue if filter is supported by server. Otherwise EFalse is returned.
465 IMPORT_C TBool SupportedByServer() const;
468 * Set information about server capabilities to support this filter.
469 * @param aSupported ETrue if filter is supported by server and EFalse if it is not supported.
471 IMPORT_C void SetSupportedByServerL( const TBool aSupported );
474 * Information about match type effect to filter.
475 * @return TBool ETrue if match type affect to filter. Otherwise EFalse is returned.
477 IMPORT_C TBool MatchTypeSupported() const;
480 * Set information about match type effect to filter.
481 * @param aSupported ETrue if match type affect to filter and EFalse if it does not affect.
483 IMPORT_C void SetMatchTypeSupported( const TBool aSupported );
486 * Properties of filter.
487 * @return RPointerArray Properties of filter.
489 IMPORT_C RPointerArray<CSyncMLFilterProperty>& FilterProperties();
493 * @return Size of internal data
495 IMPORT_C TInt DataSize();
507 HBufC* iDisplayDescription;
509 TBool iSupportedByServer;
510 TBool iMatchTypeSupported;
511 RPointerArray<CSyncMLFilterProperty> iProperties;