PECengine/ListLibrary2/ToolsSrc/PEngContactIdsTools.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  ContactId and ContactList ID handling tools
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __PENGCONTACTIDSTOOLS_H__
       
    19 #define __PENGCONTACTIDSTOOLS_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 
       
    25 // CONSTANTS
       
    26 _LIT( KPEngWVIDPrefix, "wv:" );
       
    27 const TInt KPEngWVIDPrefixLength( 3 );
       
    28 
       
    29 _LIT( KPEngWVResourceSeparator, "/" );
       
    30 const TInt KPEngWVResourceSeparatorLength = 1;
       
    31 
       
    32 _LIT( KPEngWVDomainSeparator, "@" );
       
    33 const TInt KPEngWVDomainSeparatorLength = 1;
       
    34 
       
    35 
       
    36 
       
    37 
       
    38 // NAMESPACE DEFINITION
       
    39 
       
    40 /**
       
    41  * Namespace encapsulating a collection of
       
    42  * ContactIds utility functions.
       
    43  */
       
    44 namespace NContactIdsTools
       
    45     {
       
    46 
       
    47     /**
       
    48      * Find Contact Id in the array.
       
    49      *
       
    50      * @since 3.0
       
    51      * @param aArray WV IDs array
       
    52      * @param aContactId Contact Id to look for
       
    53      * @param aIndex The return paramater for the index.
       
    54      * @param aUserDomain user domain
       
    55      * @return KErrNotFound if it is not found otherwise index in array
       
    56      */
       
    57     TInt FindContactIdInArray( const MDesCArray& aArray,
       
    58                                const TDesC& aContactId,
       
    59                                TInt& aIndex,
       
    60                                const TDesC& aUserDomain = KNullDesC );
       
    61 
       
    62 
       
    63     /**
       
    64      * Find Contact Id in the array.
       
    65      *
       
    66      * @since 3.0
       
    67      * @param aArray WV IDs array
       
    68      * @param aContactId Contact Id to look for
       
    69      * @param aUserDomain user domain
       
    70      * @return KErrNotFound if it is not found otherwise index in array
       
    71      */
       
    72     TInt FindContactIdInArray( const MDesCArray& aArray,
       
    73                                const TDesC& aContactId,
       
    74                                const TDesC& aUserDomain = KNullDesC );
       
    75 
       
    76 
       
    77 
       
    78     /**
       
    79      * Add Contact Id to the array.
       
    80      *
       
    81      * @since 3.0
       
    82      * @param aArray Contact Ids array
       
    83      * @param aContactId Contact Id to look for
       
    84      * @return index of the added element in array, or KErrAlreadyExists
       
    85      */
       
    86     TInt AddContactIdToArrayL( CDesCArray& aArray,
       
    87                                const TDesC& aContactId,
       
    88                                const TDesC& aUserDomain = KNullDesC );
       
    89 
       
    90 
       
    91     /**
       
    92      * Remove Contact Id from the array,
       
    93      *
       
    94      * @since 3.0
       
    95      * @param aArray WV IDs array
       
    96      * @param aPresenceID presence ID to look for
       
    97      * @return KErrNotFound if it is not found otherwise KErrNone
       
    98      */
       
    99     TInt RemoveContactIdFromArray( CDesCArray& aArray,
       
   100                                    const TDesC& aContactId,
       
   101                                    const TDesC& aUserDomain = KNullDesC );
       
   102 
       
   103     /**
       
   104      * Compare two Contact Ids
       
   105      *
       
   106      * @since 3.0
       
   107      * @param aContactId1 Contact Id 1
       
   108      * @param aContactId2 Contact Id 2
       
   109      * @param aUserDomain user domain
       
   110      * @return KErrNone if they are same, other non zero number if not
       
   111      */
       
   112     TInt CompareContactIds( const TDesC& aContactId1,
       
   113                             const TDesC& aContactId2,
       
   114                             const TDesC& aUserDomain = KNullDesC );
       
   115 
       
   116 
       
   117     } //namespace NContactIdsTools
       
   118 
       
   119 
       
   120 
       
   121 /**
       
   122  * Namespace encapsulating a collection of
       
   123  * ContactListIds utility functions.
       
   124  */
       
   125 namespace NContactListIdsTools
       
   126     {
       
   127 
       
   128     /**
       
   129       * Extract pure contact list name
       
   130       *
       
   131       * wv prefix, contact id and domain are removed from the contact
       
   132       * list id
       
   133       *
       
   134       * @since 3.0
       
   135       * @param aContactListId contact list id, on the end contains pure id
       
   136       * @param aPlainContactId plain part of contact id of active user
       
   137       */
       
   138     void ExtractPureContactListName( TPtrC& aContactListId,
       
   139                                      const TDesC& aPlainContactId );
       
   140 
       
   141     /**
       
   142       * Compare two Contact list Ids
       
   143       * Compare ignores "/" on the beginning of the lists
       
   144       *
       
   145       * @since 3.0
       
   146       * @param aContactListId1 contact list id 1
       
   147       * @param aContactListId2 contact list id 2
       
   148       * @return KErrNone if they are same, non zero number if not.
       
   149       */
       
   150     TInt CompareContactListIds( const TDesC& aContactListId1,
       
   151                                 const TDesC& aContactListId2 );
       
   152 
       
   153 
       
   154     } //namespace NContactListIdsTools
       
   155 
       
   156 
       
   157 
       
   158 #endif // __PENGCONTACTIDSTOOLS_H__
       
   159 //  End of File
       
   160