serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactiter.h
changeset 5 989d2f495d90
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     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 the License "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:  Provides the Iterator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CCONTACTITER_H
       
    20 #define C_CCONTACTITER_H
       
    21 
       
    22 //System include files
       
    23 #include <MVPbkStoreContact.h>
       
    24 #include <MVPbkContactLinkArray.h>
       
    25 #include <CVPbkContactManager.h>
       
    26 #include <badesca.h>
       
    27 
       
    28 #include "contactservice.h"
       
    29 #include "contactservice.hrh"
       
    30 #include "syncbehaviour.h"
       
    31 #include "singlecontact.h"
       
    32 
       
    33 //Class Declarations
       
    34 
       
    35 class CContactService;
       
    36 class CContactRetrieveObserver;
       
    37 class CSingleContact;
       
    38 class CGetListStoreListObserver;
       
    39 
       
    40 /**
       
    41  * CContactIter - Iterator Class
       
    42  * @since S60 5.0
       
    43  */
       
    44 class CContactIter:public CBase
       
    45 {
       
    46     public:// Construction and Destruction
       
    47 			
       
    48 		/**
       
    49          * Two-phased constructor.
       
    50          * @return CContactIter*
       
    51          */
       
    52         IMPORT_C static CContactIter* NewL();
       
    53 		
       
    54 		/**
       
    55          * Destructor - virtual and class not intended
       
    56          * for derivation, so not exported
       
    57          */
       
    58 	    virtual ~CContactIter();
       
    59     
       
    60     public:// General Functions - Exported	    
       
    61         /**
       
    62 		 * NextL
       
    63 		 * 
       
    64 		 * Gets the Next Contact/Group
       
    65 		 *
       
    66 		 * Returns pointer to contact/group and also the ContactId in the form 
       
    67 		 * of a buffer
       
    68 		 * @return MVPbkStoreContact* and  HBufC8* respectively
       
    69 		 */
       
    70         IMPORT_C void NextL(CSingleContact*& aSingleContact, HBufC8*& aContactID);
       
    71         /**
       
    72 		 * NextL
       
    73 		 * 
       
    74 		 * Gets the Next Database Name
       
    75 		 *
       
    76 		 * Returns pointer to the DbName
       
    77 		 * @return TPtrC16*
       
    78 		 */
       
    79         IMPORT_C void NextL(TPtrC& iDbs);
       
    80         /**
       
    81 		 * Reset
       
    82 		 * 
       
    83 		 * Resets the cursor position 
       
    84 	  	 * @return void
       
    85 		 */
       
    86         IMPORT_C void Reset();
       
    87         /**
       
    88          * Sets the iContacts which is array of contact ids
       
    89          *
       
    90          * @param aContactIdArray - Array of Contact Ids
       
    91          * @return void
       
    92          */	
       
    93         TInt SetParams(MVPbkContactLinkArray * aContactIdArray,
       
    94         			   const TDesC& aStoreUri,
       
    95         			   TOrder aSortOrder,
       
    96         			   TInt aTransId,
       
    97         			   Ttype aIndicator,
       
    98         			   CContactService* aContactService);
       
    99         /**
       
   100          * Sets the iDbNamePtr which is array of Database names
       
   101          * and the number of them
       
   102          * @return void
       
   103          */	
       
   104         void SetDbNamePtr(RPointerArray<HBufC>& aArray, TInt aCnt);
       
   105 
       
   106         /**
       
   107          * Sets the iContact member variable
       
   108          * @return void
       
   109          */	
       
   110         void SetContactFetchResult(MVPbkStoreContact* aContact);  
       
   111         
       
   112         
       
   113         //Sets up Environment before NextL() is called
       
   114         void SetupEnvironL();
       
   115                 
       
   116         // Sets up the Database
       
   117         void SetupDBL();
       
   118         
       
   119         //Reads the contact from the database
       
   120         void ReadContactL(const MVPbkContactLink& aLink, 
       
   121                           CContactRetrieveObserver& aObserver);
       
   122     private:
       
   123         
       
   124         /** 
       
   125 		 * C++ constructor - not exported;
       
   126 		 * implicitly called from NewLC()
       
   127 		 */
       
   128 	    CContactIter();
       
   129                  
       
   130         
       
   131    private: 
       
   132         // POINTER MEMBERS
       
   133         /**
       
   134          * Pointer to the array of contact Links
       
   135          */  
       
   136 		MVPbkContactLinkArray* iContactLinkArray;
       
   137         
       
   138         // Index or Cursor 
       
   139 		TInt iCursor; 
       
   140 		
       
   141 		// Number of search results
       
   142 		TInt iCount;
       
   143 		
       
   144 		// Pointer to list of Database names
       
   145 		RPointerArray<HBufC> iDbArray;
       
   146 		
       
   147 		// Contact info
       
   148 		MVPbkStoreContact* iContact;
       
   149 		
       
   150 		//File Session
       
   151 	    RFs iFs;
       
   152 	    
       
   153 	    // Store Uri
       
   154 		const TDesC* iStoreUri;
       
   155 		
       
   156 		//Order in which to sort
       
   157 		TOrder iSortOrder;
       
   158 		
       
   159 		//Contact Manager
       
   160 		CVPbkContactManager* iContactManager;
       
   161 		
       
   162 		//Contact Store
       
   163 		MVPbkContactStore* iContactStore;
       
   164 		
       
   165 		//Pointer to Service Class
       
   166 		CContactService* iContactService;
       
   167 		
       
   168 		//Handle to GetlistStoreList Observer
       
   169 		CGetListStoreListObserver* iGetListStoreListObserver ;
       
   170 		
       
   171 		//Transaction Id
       
   172 		TInt iTransId;
       
   173 public:
       
   174 		//Synchronous Iterator
       
   175 		CContactSyncIter* iSyncIter;
       
   176 				
       
   177 		//Indicator for the kind of data iterator is iterating on.
       
   178 		Ttype iIndicator;
       
   179 };
       
   180 #endif // C_CCONTACTITER_H