epoc32/include/app/MVPbkContactLink.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     1 /*
       
     2 * Copyright (c) 2002-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 "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:  Virtual Phonebook contact link for referencing contacts 
       
    15 *                in different stores.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef MVPBKCONTACTLINK_H
       
    21 #define MVPBKCONTACTLINK_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32cmn.h>
       
    25 #include <e32std.h>
       
    26 #include <cvpbkcontactlinkarray.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class TVPbkContactStoreUriPtr;
       
    30 class MVPbkStreamable;
       
    31 class MVPbkContactStore;
       
    32 class MVPbkContactLinkPacking;
       
    33 class MVPbkBaseContact;
       
    34 
       
    35 
       
    36 // CLASS DECLARATIONS
       
    37 
       
    38 /**
       
    39  * Virtual Phonebook Contact link.
       
    40  * An object that uniquely identifies a single Contact and its ContactStore.
       
    41  */
       
    42 class MVPbkContactLink
       
    43     {
       
    44     public: // destructor
       
    45         /**
       
    46          * Destructor.
       
    47          */
       
    48         virtual ~MVPbkContactLink() { }
       
    49 
       
    50     public: // interface
       
    51         /**
       
    52          * Packages this link for IPC transfer.
       
    53          * Read it using CVPbkContactLinkArray::NewL.
       
    54          * @return Packed link.
       
    55          * @see CVPbkContactLinkArray::NewL
       
    56          */
       
    57         HBufC8* PackLC();
       
    58 
       
    59         /**
       
    60          * Returns the contact store which this link belongs to.
       
    61          * @return Contact store associated with this link.
       
    62          */
       
    63         virtual MVPbkContactStore& ContactStore() const =0;
       
    64 
       
    65         /**
       
    66          * Returns ETrue if this link refers to the same contact than
       
    67          * aOther, EFalse otherwise.
       
    68          * @param aOther Contact to check equality for.
       
    69          * @return ETrue if this link refers to the same contact than
       
    70          *         aOther, EFalse otherwise.
       
    71          */
       
    72         virtual TBool IsSame(const MVPbkContactLink& aOther) const =0;
       
    73         
       
    74         /**
       
    75          * Checks if this link refers to the contact aContact.
       
    76          * @param aContact Contact to check.
       
    77          * @return ETrue if this link refers to aContact, EFalse otherwise.
       
    78          */
       
    79         virtual TBool RefersTo(const MVPbkBaseContact& aContact) const =0;
       
    80         
       
    81         /**
       
    82          * Returns persistent streaming interface for this object, or NULL
       
    83          * if persistent streaming is not supported.
       
    84          * @return Persistent streaming object or NULL if not supported.
       
    85          */
       
    86         virtual const MVPbkStreamable* Streamable() const =0;
       
    87 
       
    88         /**
       
    89          * Returns a packing interface for this link.
       
    90          * @see CVPbkContactLinkArray
       
    91          * @internal
       
    92          * @return Link packing object.
       
    93          */
       
    94         virtual const MVPbkContactLinkPacking& Packing() const = 0;
       
    95         
       
    96         /**
       
    97          * Returns a clone of this contact link.
       
    98          * @return Contact link copy.
       
    99          */
       
   100         virtual MVPbkContactLink* CloneLC() const =0;
       
   101 
       
   102         /**
       
   103          * Returns an extension point for this interface or NULL.
       
   104          * @param aExtensionUid Uid of extension.
       
   105          * @return Extension point or NULL.
       
   106          */
       
   107         virtual TAny* ContactLinkExtension(
       
   108                 TUid /*aExtensionUid*/) { return NULL; }
       
   109     };
       
   110 
       
   111 
       
   112 // INLINE FUNCTIONS
       
   113 inline HBufC8* MVPbkContactLink::PackLC()
       
   114     {
       
   115     CVPbkContactLinkArray* array = CVPbkContactLinkArray::NewLC();
       
   116     MVPbkContactLink* clone = CloneLC();
       
   117     array->AppendL(clone);
       
   118     CleanupStack::Pop(); // clone
       
   119     HBufC8* packed = array->PackLC();
       
   120     CleanupStack::Pop(); // packed
       
   121     CleanupStack::PopAndDestroy(); // array
       
   122     CleanupStack::PushL(packed);
       
   123     return packed;
       
   124     }
       
   125 
       
   126 #endif // MVPBKCONTACTLINK_H
       
   127 
       
   128 // End of File