epoc32/include/app/MVPbkContactLink.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/MVPbkContactLink.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,128 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Virtual Phonebook contact link for referencing contacts 
    1.18 +*                in different stores.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef MVPBKCONTACTLINK_H
    1.24 +#define MVPBKCONTACTLINK_H
    1.25 +
    1.26 +// INCLUDES
    1.27 +#include <e32cmn.h>
    1.28 +#include <e32std.h>
    1.29 +#include <cvpbkcontactlinkarray.h>
    1.30 +
    1.31 +// FORWARD DECLARATIONS
    1.32 +class TVPbkContactStoreUriPtr;
    1.33 +class MVPbkStreamable;
    1.34 +class MVPbkContactStore;
    1.35 +class MVPbkContactLinkPacking;
    1.36 +class MVPbkBaseContact;
    1.37 +
    1.38 +
    1.39 +// CLASS DECLARATIONS
    1.40 +
    1.41 +/**
    1.42 + * Virtual Phonebook Contact link.
    1.43 + * An object that uniquely identifies a single Contact and its ContactStore.
    1.44 + */
    1.45 +class MVPbkContactLink
    1.46 +    {
    1.47 +    public: // destructor
    1.48 +        /**
    1.49 +         * Destructor.
    1.50 +         */
    1.51 +        virtual ~MVPbkContactLink() { }
    1.52 +
    1.53 +    public: // interface
    1.54 +        /**
    1.55 +         * Packages this link for IPC transfer.
    1.56 +         * Read it using CVPbkContactLinkArray::NewL.
    1.57 +         * @return Packed link.
    1.58 +         * @see CVPbkContactLinkArray::NewL
    1.59 +         */
    1.60 +        HBufC8* PackLC();
    1.61 +
    1.62 +        /**
    1.63 +         * Returns the contact store which this link belongs to.
    1.64 +         * @return Contact store associated with this link.
    1.65 +         */
    1.66 +        virtual MVPbkContactStore& ContactStore() const =0;
    1.67 +
    1.68 +        /**
    1.69 +         * Returns ETrue if this link refers to the same contact than
    1.70 +         * aOther, EFalse otherwise.
    1.71 +         * @param aOther Contact to check equality for.
    1.72 +         * @return ETrue if this link refers to the same contact than
    1.73 +         *         aOther, EFalse otherwise.
    1.74 +         */
    1.75 +        virtual TBool IsSame(const MVPbkContactLink& aOther) const =0;
    1.76 +        
    1.77 +        /**
    1.78 +         * Checks if this link refers to the contact aContact.
    1.79 +         * @param aContact Contact to check.
    1.80 +         * @return ETrue if this link refers to aContact, EFalse otherwise.
    1.81 +         */
    1.82 +        virtual TBool RefersTo(const MVPbkBaseContact& aContact) const =0;
    1.83 +        
    1.84 +        /**
    1.85 +         * Returns persistent streaming interface for this object, or NULL
    1.86 +         * if persistent streaming is not supported.
    1.87 +         * @return Persistent streaming object or NULL if not supported.
    1.88 +         */
    1.89 +        virtual const MVPbkStreamable* Streamable() const =0;
    1.90 +
    1.91 +        /**
    1.92 +         * Returns a packing interface for this link.
    1.93 +         * @see CVPbkContactLinkArray
    1.94 +         * @internal
    1.95 +         * @return Link packing object.
    1.96 +         */
    1.97 +        virtual const MVPbkContactLinkPacking& Packing() const = 0;
    1.98 +        
    1.99 +        /**
   1.100 +         * Returns a clone of this contact link.
   1.101 +         * @return Contact link copy.
   1.102 +         */
   1.103 +        virtual MVPbkContactLink* CloneLC() const =0;
   1.104 +
   1.105 +        /**
   1.106 +         * Returns an extension point for this interface or NULL.
   1.107 +         * @param aExtensionUid Uid of extension.
   1.108 +         * @return Extension point or NULL.
   1.109 +         */
   1.110 +        virtual TAny* ContactLinkExtension(
   1.111 +                TUid /*aExtensionUid*/) { return NULL; }
   1.112 +    };
   1.113 +
   1.114 +
   1.115 +// INLINE FUNCTIONS
   1.116 +inline HBufC8* MVPbkContactLink::PackLC()
   1.117 +    {
   1.118 +    CVPbkContactLinkArray* array = CVPbkContactLinkArray::NewLC();
   1.119 +    MVPbkContactLink* clone = CloneLC();
   1.120 +    array->AppendL(clone);
   1.121 +    CleanupStack::Pop(); // clone
   1.122 +    HBufC8* packed = array->PackLC();
   1.123 +    CleanupStack::Pop(); // packed
   1.124 +    CleanupStack::PopAndDestroy(); // array
   1.125 +    CleanupStack::PushL(packed);
   1.126 +    return packed;
   1.127 +    }
   1.128 +
   1.129 +#endif // MVPBKCONTACTLINK_H
   1.130 +
   1.131 +// End of File