phoneengine/PhoneCntFinder/ContactService/inc/tphcntvoipmatchArray.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:  Array of voip matches.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TPHCNTVOIPMATCHARRAY_H
       
    20 #define TPHCNTVOIPMATCHARRAY_H
       
    21 
       
    22 #include <e32std.h>
       
    23 
       
    24 class CPhCntContact;
       
    25 class TPhCntSipURI;
       
    26 
       
    27 /**
       
    28  *  Array of voip matches
       
    29  *
       
    30  *  Offers way to figure out correct match from many matches.
       
    31  *
       
    32  *  @lib PhoneCntFinder
       
    33  *  @since S60 v3.1
       
    34  */
       
    35 class TPhCntVoipMatchArray 
       
    36     {
       
    37 public:
       
    38     TPhCntVoipMatchArray();
       
    39     
       
    40     ~TPhCntVoipMatchArray();
       
    41     
       
    42     /**
       
    43      * Adds contact, takes ownership if the contact.
       
    44      *
       
    45      * @since S60 v3.1
       
    46      * @param aVoipMatch Voip match.
       
    47      */
       
    48     void AppendL( CPhCntContact* aVoipMatch );
       
    49 
       
    50     /**
       
    51      * Finds first matched contact, which number
       
    52      * is matches aSipNumber. If no such match is found, null is
       
    53      * returned. Note that the found match is not in this
       
    54      * array after this call. Ownership of match is given
       
    55      * to client.
       
    56      *
       
    57      * @since S60 v3.1
       
    58      * @return Contact, which voip number is aSipURI
       
    59      */
       
    60     CPhCntContact* FindFullMatch( const TPhCntSipURI& aSipURI );
       
    61     
       
    62     /**
       
    63      * Finds full or just username match from contacts added to this array.
       
    64      * If no full matches are found then possible username match is given.
       
    65      * Note that the found match is not in this array after this call. 
       
    66      * Ownership of match is given to client.
       
    67      * 
       
    68      * @since S60 v3.1
       
    69      * @param aSipUri Sip URI that the match is compared against.
       
    70      * @return Found match. Null is returned if no match is found.
       
    71      */
       
    72     CPhCntContact* FindFullOrUsernameMatch( 
       
    73         const TPhCntSipURI& aSipUri,
       
    74         const TInt aCharsForMatch = 0 );
       
    75     
       
    76     /**
       
    77      * Releases the matches. Needs to be called before this class goes 
       
    78      * out of scope.
       
    79      * @since S60 
       
    80      */
       
    81     void ReleaseMatches();
       
    82     
       
    83 private:
       
    84     
       
    85     /**
       
    86      * Removes contact from array of iMatches. If aMatch does not
       
    87      * exist in iMatches then nothing is done.
       
    88      * 
       
    89      * @since S60 v3.1
       
    90      * @param aContact Contact to be removed from iMatches.
       
    91      */
       
    92     void RemoveMatchFromArray( const CPhCntContact* const aContact );    
       
    93 
       
    94     /**
       
    95      * Match type.
       
    96      */
       
    97     enum TMatchType 
       
    98         {
       
    99         ENone,
       
   100         EFullMatch,
       
   101         EUserNameMatch,
       
   102         };
       
   103          
       
   104     /**
       
   105      * Determines if contact has aSipURI voip number.
       
   106      *
       
   107      * @since S60 v3.2
       
   108      * @param aContact Contact, which is checked.
       
   109      * @param aSipURI SIP URI
       
   110      * @return ENone Contact does not have aSipURI voip number.
       
   111      *         EFullMatch Contact has aSipUri voip number.
       
   112      *         EUserNameMatch Contact has voip number which user name part
       
   113      *         equals to aSupURI's user name part.
       
   114      */
       
   115     TMatchType HasVoipNumber( 
       
   116         CPhCntContact& aContact,
       
   117         const TPhCntSipURI& aSipURI,
       
   118         const TInt aCharsForMatch = 0 ) const;
       
   119     
       
   120     /**
       
   121      * Finds contact, which voip number is aSipUri or username part
       
   122      * are same.
       
   123      * 
       
   124      * @since S60 v3.2
       
   125      * @param aSipURI Voip number of wanted contact.
       
   126      * @param aContact Contact found or null.
       
   127      * @return ENone - No contact found.
       
   128      *         EFullMatch Contact found with full match.
       
   129      *         EUserNameMatch contact found that has same user name part
       
   130      *         than aSipURI.
       
   131      */
       
   132     TMatchType FindFullOrUsernameMatch( 
       
   133         const TPhCntSipURI& aSipUri,
       
   134         CPhCntContact*& aFoundContact,
       
   135         const TInt aCharsForMatch = 0 );
       
   136       
       
   137     
       
   138 private: // data
       
   139 
       
   140     /**
       
   141      * Array of contact matches.
       
   142      * Own.
       
   143      */
       
   144     RPointerArray<CPhCntContact> iMatches;
       
   145 
       
   146     };
       
   147 
       
   148 #endif // TPHCNTVOIPMATCHARRAY_H