phoneengine/PhoneCntFinder/ContactService/inc/cphcntmatchcontact.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2006 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 "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:  Matches contact to phonenumber from phonebook.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHCNTMATCHCONTACT_H
       
    20 #define CPHCNTMATCHCONTACT_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "cphcntcontactlinkarrayfetch.h"
       
    25 
       
    26 class MVPbkContactLinkArray;
       
    27 class MPhCntContactManager;
       
    28 class MPhCntContactMatchStrategy;
       
    29 
       
    30 
       
    31 /**
       
    32  *  Matches contacts to phone number.
       
    33  *
       
    34  *  @lib PhoneCntFinder.lib
       
    35  *  @since S60 v3.1
       
    36  */
       
    37 NONSHARABLE_CLASS( CPhCntMatchContact ): public CPhCntContactLinkArrayFetch
       
    38     {
       
    39 public:
       
    40 
       
    41     /**
       
    42      * Static constructor.
       
    43      *
       
    44      * @since S60 v3.1
       
    45      */
       
    46     static CPhCntMatchContact* NewL();
       
    47 
       
    48     /**
       
    49      * Static constructor.
       
    50      *
       
    51      * @since S60 v3.1
       
    52      */
       
    53     static CPhCntMatchContact* NewLC();
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     virtual ~CPhCntMatchContact();
       
    59 
       
    60     /**
       
    61      * Finds contacts, which telephone number matches with aTelNumber.
       
    62      * Note that aContactLinkArray ownership is not given. Client has
       
    63      * to call MVPbkContactLink::CloneLC in order to take the ownership of the
       
    64      * link in array. If error returned is KErrNone then there is at least
       
    65      * one entry in aContactLinkArray.
       
    66      *
       
    67      * @since S60 v3.1
       
    68      * @param aTelNumber Number, which is matched with contacts.
       
    69      * @Param aContactLinkArray Array of found contacts.
       
    70      *        Ownership of array nor links inside is NOT given to caller.
       
    71      * @param aStrategy Matching strategy used for finding matches.
       
    72      * @return Error code, KErrNotFound, if contact not found
       
    73      *                     KErrAlreadyExists if many contacts found.
       
    74      */
       
    75     TInt MatchContact( const MVPbkContactLinkArray*& aContactLinkArray, 
       
    76                         const TDesC& aTelNumber,
       
    77                         MPhCntContactMatchStrategy& aStrategy );
       
    78     
       
    79 protected:
       
    80 
       
    81 // from base class CPhCntAsyncToSync
       
    82 
       
    83     /**
       
    84      * From CPhCntAsyncToSync
       
    85      * Makes the asynchronous request, which is converted to synchronous.
       
    86      * @since S60 v3.1
       
    87      */
       
    88     void DoMakeAsyncRequestL();
       
    89 
       
    90 private:
       
    91 
       
    92     CPhCntMatchContact();
       
    93 
       
    94     void ConstructL();
       
    95 
       
    96 
       
    97 private: // data
       
    98 
       
    99     /**
       
   100      * Contact matching strategy
       
   101      * Not own.
       
   102      */
       
   103     MPhCntContactMatchStrategy* iMatchStrategy;
       
   104 
       
   105     /**
       
   106      * Number to match contacts.
       
   107      */
       
   108     TPtrC iPhoneNumber;
       
   109 
       
   110     };
       
   111 
       
   112 
       
   113 
       
   114 #endif // CPHCNTMATCHCONTACT_H