williamr@4: /* williamr@4: * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: Virtual Phonebook contact link for referencing contacts williamr@4: * in different stores. williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef MVPBKCONTACTLINK_H williamr@4: #define MVPBKCONTACTLINK_H williamr@4: williamr@4: // INCLUDES williamr@4: #include williamr@4: #include williamr@4: #include williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: class TVPbkContactStoreUriPtr; williamr@4: class MVPbkStreamable; williamr@4: class MVPbkContactStore; williamr@4: class MVPbkContactLinkPacking; williamr@4: class MVPbkBaseContact; williamr@4: williamr@4: williamr@4: // CLASS DECLARATIONS williamr@4: williamr@4: /** williamr@4: * Virtual Phonebook Contact link. williamr@4: * An object that uniquely identifies a single Contact and its ContactStore. williamr@4: */ williamr@4: class MVPbkContactLink williamr@4: { williamr@4: public: // destructor williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: virtual ~MVPbkContactLink() { } williamr@4: williamr@4: public: // interface williamr@4: /** williamr@4: * Packages this link for IPC transfer. williamr@4: * Read it using CVPbkContactLinkArray::NewL. williamr@4: * @return Packed link. williamr@4: * @see CVPbkContactLinkArray::NewL williamr@4: */ williamr@4: HBufC8* PackLC(); williamr@4: williamr@4: /** williamr@4: * Returns the contact store which this link belongs to. williamr@4: * @return Contact store associated with this link. williamr@4: */ williamr@4: virtual MVPbkContactStore& ContactStore() const =0; williamr@4: williamr@4: /** williamr@4: * Returns ETrue if this link refers to the same contact than williamr@4: * aOther, EFalse otherwise. williamr@4: * @param aOther Contact to check equality for. williamr@4: * @return ETrue if this link refers to the same contact than williamr@4: * aOther, EFalse otherwise. williamr@4: */ williamr@4: virtual TBool IsSame(const MVPbkContactLink& aOther) const =0; williamr@4: williamr@4: /** williamr@4: * Checks if this link refers to the contact aContact. williamr@4: * @param aContact Contact to check. williamr@4: * @return ETrue if this link refers to aContact, EFalse otherwise. williamr@4: */ williamr@4: virtual TBool RefersTo(const MVPbkBaseContact& aContact) const =0; williamr@4: williamr@4: /** williamr@4: * Returns persistent streaming interface for this object, or NULL williamr@4: * if persistent streaming is not supported. williamr@4: * @return Persistent streaming object or NULL if not supported. williamr@4: */ williamr@4: virtual const MVPbkStreamable* Streamable() const =0; williamr@4: williamr@4: /** williamr@4: * Returns a packing interface for this link. williamr@4: * @see CVPbkContactLinkArray williamr@4: * @internal williamr@4: * @return Link packing object. williamr@4: */ williamr@4: virtual const MVPbkContactLinkPacking& Packing() const = 0; williamr@4: williamr@4: /** williamr@4: * Returns a clone of this contact link. williamr@4: * @return Contact link copy. williamr@4: */ williamr@4: virtual MVPbkContactLink* CloneLC() const =0; williamr@4: williamr@4: /** williamr@4: * Returns an extension point for this interface or NULL. williamr@4: * @param aExtensionUid Uid of extension. williamr@4: * @return Extension point or NULL. williamr@4: */ williamr@4: virtual TAny* ContactLinkExtension( williamr@4: TUid /*aExtensionUid*/) { return NULL; } williamr@4: }; williamr@4: williamr@4: williamr@4: // INLINE FUNCTIONS williamr@4: inline HBufC8* MVPbkContactLink::PackLC() williamr@4: { williamr@4: CVPbkContactLinkArray* array = CVPbkContactLinkArray::NewLC(); williamr@4: MVPbkContactLink* clone = CloneLC(); williamr@4: array->AppendL(clone); williamr@4: CleanupStack::Pop(); // clone williamr@4: HBufC8* packed = array->PackLC(); williamr@4: CleanupStack::Pop(); // packed williamr@4: CleanupStack::PopAndDestroy(); // array williamr@4: CleanupStack::PushL(packed); williamr@4: return packed; williamr@4: } williamr@4: williamr@4: #endif // MVPBKCONTACTLINK_H williamr@4: williamr@4: // End of File