epoc32/include/app/cntfilt.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/cntfilt.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,214 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __CNTFILT_H__
    1.20 +#define __CNTFILT_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +
    1.24 +#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ && defined __SYMBIAN_CNTMODEL_USE_SQLITE__ )
    1.25 +#include <d32dbms.h>
    1.26 +#endif
    1.27 +
    1.28 +#include <cntdb.h>
    1.29 +
    1.30 +class CCntFilter : public CBase
    1.31 +/** A contact database filter.
    1.32 +
    1.33 +This is used to get a subset of the items in a contact database. 
    1.34 +There are three criteria used when filtering a database:
    1.35 +
    1.36 +- the contact item's state
    1.37 +
    1.38 +- the date/time the contact item was created/last modified/deleted
    1.39 +
    1.40 +- the contact item's type
    1.41 +
    1.42 +The state can be one of: deleted, modified or created (since 
    1.43 +a specified date/time). The filter can be set to include contact items of 
    1.44 +only one state, or it can be set to include contact items of all states, using 
    1.45 +the TInclude enumeration. 
    1.46 +
    1.47 +The date/time value is used in combination with the contact item's state.
    1.48 +
    1.49 +The contact item's type is one of contact card, contact card group, contact 
    1.50 +card template, or own card. Any combination of contact types may be specified 
    1.51 +in the filter, in addition to the contact item's state.
    1.52 +
    1.53 +After the filter has been set up, it should be passed to the function 
    1.54 +CContactDatabase::FilterDatabaseL(). 
    1.55 +@publishedAll
    1.56 +@released
    1.57 +*/
    1.58 +	{
    1.59 +	friend class CPackagerTests; //Comparison test
    1.60 +public:	
    1.61 +	/** Flags to identify which contact items should be included in the filter.
    1.62 +
    1.63 +	Only one of the following values can be set in the filter at a time. However 
    1.64 +	the client may select to filter contacts in all states using EIncludeAllContacts. */
    1.65 +	enum TInclude 
    1.66 +		{ 
    1.67 +		/** Contact items in all states should be included. */
    1.68 +		EIncludeAllContacts,
    1.69 +		/** Only contact items which have been added since the date/time should be included. */
    1.70 +		EIncludeNewContacts,
    1.71 +		/** Only contact items which have been modified since the date/time should be included. */
    1.72 +		EIncludeModifiedContacts,
    1.73 +		/** Only contact items which have been deleted since the date/time should be included. */
    1.74 +		EIncludeDeletedContacts	
    1.75 +		};
    1.76 +	/** Contact item types.*/
    1.77 +	enum TContactType
    1.78 +		{
    1.79 +		/** All contact item types should be included. */
    1.80 +		EIncludeAllTypes = 0x01,
    1.81 +		/** Contact cards should be included in the filter. */
    1.82 +		EContactCards = 0x02,
    1.83 +		/** Contact card groups should be included in the filter. */
    1.84 +		EContactGroups = 0x04, 
    1.85 +		/** Contact card templates should be included in the filter. */
    1.86 +		EContactTemplates = 0x08,
    1.87 +		/** Own cards should be included in the filter. */
    1.88 +		EContactOwnCard = 0x10 
    1.89 +		};
    1.90 +
    1.91 +	IMPORT_C static CCntFilter* NewL();
    1.92 +	IMPORT_C static CCntFilter* NewLC();
    1.93 +	IMPORT_C static CCntFilter* NewL(const CCntFilter* aFilter);
    1.94 +	IMPORT_C static CCntFilter* NewLC(const CCntFilter* aFilter);
    1.95 +	static CCntFilter* NewLC(RReadStream& aStream);
    1.96 +	IMPORT_C ~CCntFilter();
    1.97 +public:
    1.98 +	/** A pointer to an array which stores the filtered list of contact IDs. */
    1.99 +	CContactIdArray* iIds;
   1.100 +//
   1.101 +	IMPORT_C void SetIncludeModifiedContacts(TBool aIncludeModified); 
   1.102 +	IMPORT_C void SetIncludeNewContacts(TBool aIncludeNew); 
   1.103 +	IMPORT_C void SetIncludeDeletedContacts(TBool aIncludeDeleted);
   1.104 +//
   1.105 +	IMPORT_C TBool TestContactFilterType(TUid aTypeUid);
   1.106 +	IMPORT_C void SetContactFilterTypeALL(TBool aFilterAllContacts);
   1.107 +	IMPORT_C void SetContactFilterTypeCard(TBool aFilterCards);
   1.108 +	IMPORT_C void SetContactFilterTypeGroup(TBool aFilterGroups);
   1.109 +	IMPORT_C void SetContactFilterTypeTemplate(TBool aFilterTemplates);
   1.110 +	IMPORT_C void SetContactFilterTypeOwnCard(TBool aFilterOwnCard);
   1.111 +	void ExternalizeL(RWriteStream& aStream) const;
   1.112 +	void InternalizeL(RReadStream& aStream);	
   1.113 +//
   1.114 +	inline TBool ContactFilterTypeALL() const;
   1.115 +	inline TBool ContactFilterTypeCard() const;
   1.116 +	inline TBool ContactFilterTypeGroup() const;
   1.117 +	inline TBool ContactFilterTypeOwnCard() const;
   1.118 +	inline TBool ContactFilterTypeTemplate() const;
   1.119 +//
   1.120 +	inline TBool IncludeModifiedContacts();
   1.121 +	inline TBool IncludeNewContacts();
   1.122 +	inline TBool IncludeDeletedContacts();
   1.123 +//
   1.124 +	inline TTime GetFilterDateTime();
   1.125 +	inline void SetFilterDateTime(TTime aTime);
   1.126 +//
   1.127 +	IMPORT_C void Reset();
   1.128 +//
   1.129 +/**	
   1.130 +    Intended usage: Reserved to preserve future BC  */ 
   1.131 +	IMPORT_C void Reserved1();
   1.132 +/**	
   1.133 +    Intended usage: Reserved to preserve future BC  */
   1.134 +  	IMPORT_C void Reserved2();
   1.135 +
   1.136 +private:
   1.137 +	TTime            iSinceDateTime;
   1.138 +	TInclude		 iInclude;
   1.139 +	TInt32			 iContactType;
   1.140 +	TAny*	         iReserved1;
   1.141 +	TAny*			 iReserved2;
   1.142 +	CCntFilter();
   1.143 +	CCntFilter(const CCntFilter* aFilter);
   1.144 +	};
   1.145 +
   1.146 +
   1.147 +inline TBool CCntFilter::IncludeModifiedContacts()
   1.148 +/** Tests whether the filter includes only contacts modified since the filter's 
   1.149 +date/time.
   1.150 +
   1.151 +@return ETrue if the filter only includes modified contacts. EFalse if not. */
   1.152 +	{return iInclude == EIncludeModifiedContacts;};
   1.153 +
   1.154 +inline TBool CCntFilter::IncludeNewContacts()
   1.155 +/** Tests whether the filter includes only contacts created since the filter's 
   1.156 +date/time.
   1.157 +
   1.158 +@return ETrue if the filter only includes new contacts. EFalse if not. */
   1.159 +	{return iInclude == EIncludeNewContacts;};
   1.160 +
   1.161 +inline TBool CCntFilter::IncludeDeletedContacts()
   1.162 +/** Tests whether the filter includes only contacts deleted since the filter's 
   1.163 +date/time.
   1.164 +
   1.165 +@return ETrue if the filter only includes deleted contacts. EFalse if not. */
   1.166 +	{return iInclude == EIncludeDeletedContacts;};
   1.167 +
   1.168 +inline TTime CCntFilter::GetFilterDateTime()
   1.169 +/** Gets the date and time used by the filter, as set by SetFilterDateTime().
   1.170 +
   1.171 +@return The filter's date and time value. */
   1.172 +	{return iSinceDateTime;};
   1.173 +
   1.174 +inline void CCntFilter::SetFilterDateTime(TTime aTime)
   1.175 +/** Sets the date and time used by the filter in combination with the TInclude 
   1.176 +value to test contact items against.
   1.177 +
   1.178 +@param aTime The new date and time value. */
   1.179 +	{iSinceDateTime = aTime;};
   1.180 +
   1.181 +// CONTACT TYPE
   1.182 +inline TBool CCntFilter::ContactFilterTypeALL() const
   1.183 +/** Tests whether all contact item types are included in the filter, as set by 
   1.184 +SetContactFilterTypeALL().
   1.185 +
   1.186 +@return ETrue if all contact item types are included in the filter, EFalse 
   1.187 +if not. */
   1.188 +	{return iContactType & EIncludeAllTypes;}
   1.189 +
   1.190 +inline TBool CCntFilter::ContactFilterTypeCard() const
   1.191 +/** Tests whether contact cards are included in the filter, as set by SetContactFilterTypeCard().
   1.192 +
   1.193 +@return ETrue if contact cards are included in the filter, EFalse if not. */
   1.194 +	{return iContactType & EContactCards;}
   1.195 +
   1.196 +inline TBool CCntFilter::ContactFilterTypeGroup() const
   1.197 +/** Tests whether contact card groups are included in the filter, as set by SetContactFilterTypeGroup().
   1.198 +
   1.199 +@return ETrue if contact card groups are included in the filter, EFalse if 
   1.200 +not. */
   1.201 +	{return iContactType & EContactGroups;}
   1.202 +
   1.203 +inline TBool CCntFilter::ContactFilterTypeOwnCard() const
   1.204 +/** Tests whether own cards are included in the filter, as set by SetContactFilterTypeOwnCard().
   1.205 +
   1.206 +@return ETrue if own cards are included in the filter, EFalse if not. */
   1.207 +	{return iContactType & EContactOwnCard;}
   1.208 +
   1.209 +inline TBool CCntFilter::ContactFilterTypeTemplate() const
   1.210 +/** Tests whether contact card templates are included in the filter, as set by 
   1.211 +SetContactFilterTypeTemplate().
   1.212 +
   1.213 +@return ETrue if contact card templates are included in the filter, EFalse 
   1.214 +if not. */
   1.215 +	{return iContactType & EContactTemplates;}
   1.216 +
   1.217 +#endif