epoc32/include/app/cntfilt.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __CNTFILT_H__
williamr@2
    17
#define __CNTFILT_H__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
williamr@4
    21
#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ )
williamr@2
    22
#include <d32dbms.h>
williamr@2
    23
#endif
williamr@2
    24
williamr@2
    25
#include <cntdb.h>
williamr@2
    26
williamr@2
    27
class CCntFilter : public CBase
williamr@2
    28
/** A contact database filter.
williamr@2
    29
williamr@2
    30
This is used to get a subset of the items in a contact database. 
williamr@2
    31
There are three criteria used when filtering a database:
williamr@2
    32
williamr@2
    33
- the contact item's state
williamr@2
    34
williamr@2
    35
- the date/time the contact item was created/last modified/deleted
williamr@2
    36
williamr@2
    37
- the contact item's type
williamr@2
    38
williamr@2
    39
The state can be one of: deleted, modified or created (since 
williamr@2
    40
a specified date/time). The filter can be set to include contact items of 
williamr@2
    41
only one state, or it can be set to include contact items of all states, using 
williamr@2
    42
the TInclude enumeration. 
williamr@2
    43
williamr@2
    44
The date/time value is used in combination with the contact item's state.
williamr@2
    45
williamr@2
    46
The contact item's type is one of contact card, contact card group, contact 
williamr@2
    47
card template, or own card. Any combination of contact types may be specified 
williamr@2
    48
in the filter, in addition to the contact item's state.
williamr@2
    49
williamr@2
    50
After the filter has been set up, it should be passed to the function 
williamr@2
    51
CContactDatabase::FilterDatabaseL(). 
williamr@2
    52
@publishedAll
williamr@2
    53
@released
williamr@2
    54
*/
williamr@2
    55
	{
williamr@2
    56
	friend class CPackagerTests; //Comparison test
williamr@2
    57
public:	
williamr@2
    58
	/** Flags to identify which contact items should be included in the filter.
williamr@2
    59
williamr@2
    60
	Only one of the following values can be set in the filter at a time. However 
williamr@2
    61
	the client may select to filter contacts in all states using EIncludeAllContacts. */
williamr@2
    62
	enum TInclude 
williamr@2
    63
		{ 
williamr@2
    64
		/** Contact items in all states should be included. */
williamr@2
    65
		EIncludeAllContacts,
williamr@2
    66
		/** Only contact items which have been added since the date/time should be included. */
williamr@2
    67
		EIncludeNewContacts,
williamr@2
    68
		/** Only contact items which have been modified since the date/time should be included. */
williamr@2
    69
		EIncludeModifiedContacts,
williamr@2
    70
		/** Only contact items which have been deleted since the date/time should be included. */
williamr@2
    71
		EIncludeDeletedContacts	
williamr@2
    72
		};
williamr@2
    73
	/** Contact item types.*/
williamr@2
    74
	enum TContactType
williamr@2
    75
		{
williamr@2
    76
		/** All contact item types should be included. */
williamr@2
    77
		EIncludeAllTypes = 0x01,
williamr@2
    78
		/** Contact cards should be included in the filter. */
williamr@2
    79
		EContactCards = 0x02,
williamr@2
    80
		/** Contact card groups should be included in the filter. */
williamr@2
    81
		EContactGroups = 0x04, 
williamr@2
    82
		/** Contact card templates should be included in the filter. */
williamr@2
    83
		EContactTemplates = 0x08,
williamr@2
    84
		/** Own cards should be included in the filter. */
williamr@2
    85
		EContactOwnCard = 0x10 
williamr@2
    86
		};
williamr@2
    87
williamr@2
    88
	IMPORT_C static CCntFilter* NewL();
williamr@2
    89
	IMPORT_C static CCntFilter* NewLC();
williamr@2
    90
	IMPORT_C static CCntFilter* NewL(const CCntFilter* aFilter);
williamr@2
    91
	IMPORT_C static CCntFilter* NewLC(const CCntFilter* aFilter);
williamr@2
    92
	static CCntFilter* NewLC(RReadStream& aStream);
williamr@2
    93
	IMPORT_C ~CCntFilter();
williamr@2
    94
public:
williamr@2
    95
	/** A pointer to an array which stores the filtered list of contact IDs. */
williamr@2
    96
	CContactIdArray* iIds;
williamr@2
    97
//
williamr@2
    98
	IMPORT_C void SetIncludeModifiedContacts(TBool aIncludeModified); 
williamr@2
    99
	IMPORT_C void SetIncludeNewContacts(TBool aIncludeNew); 
williamr@2
   100
	IMPORT_C void SetIncludeDeletedContacts(TBool aIncludeDeleted);
williamr@2
   101
//
williamr@2
   102
	IMPORT_C TBool TestContactFilterType(TUid aTypeUid);
williamr@2
   103
	IMPORT_C void SetContactFilterTypeALL(TBool aFilterAllContacts);
williamr@2
   104
	IMPORT_C void SetContactFilterTypeCard(TBool aFilterCards);
williamr@2
   105
	IMPORT_C void SetContactFilterTypeGroup(TBool aFilterGroups);
williamr@2
   106
	IMPORT_C void SetContactFilterTypeTemplate(TBool aFilterTemplates);
williamr@2
   107
	IMPORT_C void SetContactFilterTypeOwnCard(TBool aFilterOwnCard);
williamr@2
   108
	void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   109
	void InternalizeL(RReadStream& aStream);	
williamr@2
   110
//
williamr@2
   111
	inline TBool ContactFilterTypeALL() const;
williamr@2
   112
	inline TBool ContactFilterTypeCard() const;
williamr@2
   113
	inline TBool ContactFilterTypeGroup() const;
williamr@2
   114
	inline TBool ContactFilterTypeOwnCard() const;
williamr@2
   115
	inline TBool ContactFilterTypeTemplate() const;
williamr@2
   116
//
williamr@2
   117
	inline TBool IncludeModifiedContacts();
williamr@2
   118
	inline TBool IncludeNewContacts();
williamr@2
   119
	inline TBool IncludeDeletedContacts();
williamr@2
   120
//
williamr@2
   121
	inline TTime GetFilterDateTime();
williamr@2
   122
	inline void SetFilterDateTime(TTime aTime);
williamr@2
   123
//
williamr@2
   124
	IMPORT_C void Reset();
williamr@2
   125
//
williamr@2
   126
/**	
williamr@2
   127
    Intended usage: Reserved to preserve future BC  */ 
williamr@2
   128
	IMPORT_C void Reserved1();
williamr@2
   129
/**	
williamr@2
   130
    Intended usage: Reserved to preserve future BC  */
williamr@2
   131
  	IMPORT_C void Reserved2();
williamr@2
   132
williamr@2
   133
private:
williamr@2
   134
	TTime            iSinceDateTime;
williamr@2
   135
	TInclude		 iInclude;
williamr@2
   136
	TInt32			 iContactType;
williamr@2
   137
	TAny*	         iReserved1;
williamr@2
   138
	TAny*			 iReserved2;
williamr@2
   139
	CCntFilter();
williamr@2
   140
	CCntFilter(const CCntFilter* aFilter);
williamr@2
   141
	};
williamr@2
   142
williamr@2
   143
williamr@2
   144
inline TBool CCntFilter::IncludeModifiedContacts()
williamr@2
   145
/** Tests whether the filter includes only contacts modified since the filter's 
williamr@2
   146
date/time.
williamr@2
   147
williamr@2
   148
@return ETrue if the filter only includes modified contacts. EFalse if not. */
williamr@2
   149
	{return iInclude == EIncludeModifiedContacts;};
williamr@2
   150
williamr@2
   151
inline TBool CCntFilter::IncludeNewContacts()
williamr@2
   152
/** Tests whether the filter includes only contacts created since the filter's 
williamr@2
   153
date/time.
williamr@2
   154
williamr@2
   155
@return ETrue if the filter only includes new contacts. EFalse if not. */
williamr@2
   156
	{return iInclude == EIncludeNewContacts;};
williamr@2
   157
williamr@2
   158
inline TBool CCntFilter::IncludeDeletedContacts()
williamr@2
   159
/** Tests whether the filter includes only contacts deleted since the filter's 
williamr@2
   160
date/time.
williamr@2
   161
williamr@2
   162
@return ETrue if the filter only includes deleted contacts. EFalse if not. */
williamr@2
   163
	{return iInclude == EIncludeDeletedContacts;};
williamr@2
   164
williamr@2
   165
inline TTime CCntFilter::GetFilterDateTime()
williamr@2
   166
/** Gets the date and time used by the filter, as set by SetFilterDateTime().
williamr@2
   167
williamr@2
   168
@return The filter's date and time value. */
williamr@2
   169
	{return iSinceDateTime;};
williamr@2
   170
williamr@2
   171
inline void CCntFilter::SetFilterDateTime(TTime aTime)
williamr@2
   172
/** Sets the date and time used by the filter in combination with the TInclude 
williamr@2
   173
value to test contact items against.
williamr@2
   174
williamr@2
   175
@param aTime The new date and time value. */
williamr@2
   176
	{iSinceDateTime = aTime;};
williamr@2
   177
williamr@2
   178
// CONTACT TYPE
williamr@2
   179
inline TBool CCntFilter::ContactFilterTypeALL() const
williamr@2
   180
/** Tests whether all contact item types are included in the filter, as set by 
williamr@2
   181
SetContactFilterTypeALL().
williamr@2
   182
williamr@2
   183
@return ETrue if all contact item types are included in the filter, EFalse 
williamr@2
   184
if not. */
williamr@2
   185
	{return iContactType & EIncludeAllTypes;}
williamr@2
   186
williamr@2
   187
inline TBool CCntFilter::ContactFilterTypeCard() const
williamr@2
   188
/** Tests whether contact cards are included in the filter, as set by SetContactFilterTypeCard().
williamr@2
   189
williamr@2
   190
@return ETrue if contact cards are included in the filter, EFalse if not. */
williamr@2
   191
	{return iContactType & EContactCards;}
williamr@2
   192
williamr@2
   193
inline TBool CCntFilter::ContactFilterTypeGroup() const
williamr@2
   194
/** Tests whether contact card groups are included in the filter, as set by SetContactFilterTypeGroup().
williamr@2
   195
williamr@2
   196
@return ETrue if contact card groups are included in the filter, EFalse if 
williamr@2
   197
not. */
williamr@2
   198
	{return iContactType & EContactGroups;}
williamr@2
   199
williamr@2
   200
inline TBool CCntFilter::ContactFilterTypeOwnCard() const
williamr@2
   201
/** Tests whether own cards are included in the filter, as set by SetContactFilterTypeOwnCard().
williamr@2
   202
williamr@2
   203
@return ETrue if own cards are included in the filter, EFalse if not. */
williamr@2
   204
	{return iContactType & EContactOwnCard;}
williamr@2
   205
williamr@2
   206
inline TBool CCntFilter::ContactFilterTypeTemplate() const
williamr@2
   207
/** Tests whether contact card templates are included in the filter, as set by 
williamr@2
   208
SetContactFilterTypeTemplate().
williamr@2
   209
williamr@2
   210
@return ETrue if contact card templates are included in the filter, EFalse 
williamr@2
   211
if not. */
williamr@2
   212
	{return iContactType & EContactTemplates;}
williamr@2
   213
williamr@2
   214
#endif