phoneengine/PhoneCntFinder/ContactService/inc/cphcntvpbkcontactid.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:  Contact identifier used with virtual phonebook
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHCNTVPBKCONTACTID_H
       
    20 #define CPHCNTVPBKCONTACTID_H
       
    21 
       
    22 #include "cphcntcontactid.h"
       
    23 
       
    24 class MVPbkContactLink;
       
    25 class MPhCntContactManager;
       
    26 
       
    27 /**
       
    28  *  Contact identifier.
       
    29  *
       
    30  *  @lib PhoneCntFinder
       
    31  *  @since S60 v3.1
       
    32  */
       
    33 NONSHARABLE_CLASS( CPhCntVPbkContactId ) : public CPhCntContactId
       
    34     {
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Static constructor.
       
    39      * 
       
    40      * @since S60 v3.1
       
    41      * @param aContactLink Contact link, takes ownership.
       
    42      * @param aContactManager Contact manager.
       
    43      */
       
    44     static CPhCntVPbkContactId* NewL( 
       
    45         MVPbkContactLink* aContactLink,
       
    46         MPhCntContactManager& aContactManager );
       
    47 
       
    48     /**
       
    49      * Static constructor.
       
    50      * 
       
    51      * @since S60 v3.1
       
    52      * @param aContactLink Contact link, takes ownership.
       
    53      * @param aContactManager Contact manager.
       
    54      */
       
    55     static CPhCntVPbkContactId* NewLC( 
       
    56         MVPbkContactLink* aContactLink,
       
    57         MPhCntContactManager& aContactManager );
       
    58     
       
    59     /**
       
    60      * Static constructor.
       
    61      * 
       
    62      * @since S60 v3.1
       
    63      * @param aContactId Contact identifier.
       
    64      * @param aContactManager Contact manager.
       
    65      */
       
    66     static CPhCntVPbkContactId* NewL( 
       
    67         TContactItemId aContactId,
       
    68         MPhCntContactManager& aContactManager );
       
    69     
       
    70     /**
       
    71      * Static constructor.
       
    72      * 
       
    73      * @since S60 v3.1
       
    74      * @param aContactId Contact identifier.
       
    75      * @param aContactManager Contact manager.
       
    76      */
       
    77     static CPhCntVPbkContactId* NewLC( 
       
    78         TContactItemId aContactId,
       
    79         MPhCntContactManager& aContactManager );
       
    80         
       
    81     /** 
       
    82      * Static constructor.
       
    83      * 
       
    84      * @since S60 v3.2
       
    85      * @param aContactLink MVPbkContactLink as descriptor.
       
    86      * @param aContactManager.
       
    87      */
       
    88     static CPhCntVPbkContactId* NewL( 
       
    89         const TDesC8& aContactLink,
       
    90         MPhCntContactManager& aContactManager );
       
    91 
       
    92         
       
    93     /**
       
    94      * Destructor. 
       
    95      *
       
    96      * @since S60 v3.1
       
    97      */
       
    98     virtual ~CPhCntVPbkContactId();
       
    99 
       
   100     /**
       
   101      * Gives access to contact link, which
       
   102      * identifies a contact in contact store.
       
   103      * @precond IsValid() returns ETrue
       
   104      * @since S60 v3.1
       
   105      * @return Contact link, which identifies contacts.
       
   106      */
       
   107     const MVPbkContactLink& ContactLink() const;
       
   108 
       
   109 // from base CPhCntContactId
       
   110 
       
   111      /**
       
   112       * From CPhCntContactId
       
   113       *
       
   114       * @since S60 v3.1
       
   115       * @see CPhCntContactId
       
   116       */
       
   117      CPhCntContactId* CloneL() const;
       
   118      
       
   119      /**
       
   120       * From CPhCntContactId
       
   121       *
       
   122       * @since S60 v3.1
       
   123       * @see CPhCntContactId
       
   124       */
       
   125      void Invalidate();
       
   126       
       
   127      /**
       
   128       * From CPhCntContactId
       
   129       *
       
   130       * @since S60 v3.1
       
   131       * @see CPhCntContactId
       
   132       */
       
   133      TBool IsValid() const;
       
   134      
       
   135      /**
       
   136       * From CPhCntContactId
       
   137       *
       
   138       * @since S60 v3.1
       
   139       * @see CPhCntContactId
       
   140       */
       
   141      TContactItemId ContactId() const;
       
   142       
       
   143      /**
       
   144       * From CPhCntContactId
       
   145       *
       
   146       * @since S60 v3.1
       
   147       * @see CPhCntContactId
       
   148       */
       
   149      HBufC8* PackLC() const;
       
   150       
       
   151 
       
   152 private:
       
   153 
       
   154     CPhCntVPbkContactId( 
       
   155         MVPbkContactLink* aContactLink,
       
   156         MPhCntContactManager& aContactManager );
       
   157 
       
   158     void ConstructL( TContactItemId aContactItemId );
       
   159     
       
   160     void ConstructL( const TDesC8& aContactLink );
       
   161 
       
   162 private: // data
       
   163 
       
   164     /**
       
   165      * Contact link, which identifies the contact.
       
   166      * Own.
       
   167      */
       
   168     MVPbkContactLink* iContactLink;
       
   169      
       
   170     /**
       
   171      * Contact manager for converting contact id to contact link.
       
   172      * Not own.
       
   173      */
       
   174     MPhCntContactManager& iContactManager;     
       
   175 
       
   176     };
       
   177 
       
   178 
       
   179 
       
   180 #endif // CPHCNTVPBKCONTACTID_H