2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Virtual Phonebook contact link for referencing contacts
15 * in different stores.
20 #ifndef MVPBKCONTACTLINK_H
21 #define MVPBKCONTACTLINK_H
26 #include <cvpbkcontactlinkarray.h>
28 // FORWARD DECLARATIONS
29 class TVPbkContactStoreUriPtr;
30 class MVPbkStreamable;
31 class MVPbkContactStore;
32 class MVPbkContactLinkPacking;
33 class MVPbkBaseContact;
39 * Virtual Phonebook Contact link.
40 * An object that uniquely identifies a single Contact and its ContactStore.
42 class MVPbkContactLink
48 virtual ~MVPbkContactLink() { }
52 * Packages this link for IPC transfer.
53 * Read it using CVPbkContactLinkArray::NewL.
54 * @return Packed link.
55 * @see CVPbkContactLinkArray::NewL
60 * Returns the contact store which this link belongs to.
61 * @return Contact store associated with this link.
63 virtual MVPbkContactStore& ContactStore() const =0;
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.
72 virtual TBool IsSame(const MVPbkContactLink& aOther) const =0;
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.
79 virtual TBool RefersTo(const MVPbkBaseContact& aContact) const =0;
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.
86 virtual const MVPbkStreamable* Streamable() const =0;
89 * Returns a packing interface for this link.
90 * @see CVPbkContactLinkArray
92 * @return Link packing object.
94 virtual const MVPbkContactLinkPacking& Packing() const = 0;
97 * Returns a clone of this contact link.
98 * @return Contact link copy.
100 virtual MVPbkContactLink* CloneLC() const =0;
103 * Returns an extension point for this interface or NULL.
104 * @param aExtensionUid Uid of extension.
105 * @return Extension point or NULL.
107 virtual TAny* ContactLinkExtension(
108 TUid /*aExtensionUid*/) { return NULL; }
113 inline HBufC8* MVPbkContactLink::PackLC()
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);
126 #endif // MVPBKCONTACTLINK_H