epoc32/include/app/CVPbkxSPContacts.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/CVPbkxSPContacts.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,117 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-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:  xSP contacts
    1.18 + *
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef VPBKXSPCONTACTS_H
    1.23 +#define VPBKXSPCONTACTS_H
    1.24 +
    1.25 +// INCLUDES
    1.26 +#include <e32base.h>
    1.27 +
    1.28 +// FORWARD DECLARATIONS
    1.29 +class MVPbkContactLinkArray;
    1.30 +class CVPbkContactManager;
    1.31 +class MVPbkContactOperationBase;
    1.32 +class MVPbkStoreContact;
    1.33 +template<typename T> class MVPbkOperationResultObserver;
    1.34 +class MVPbkOperationErrorObserver;
    1.35 +
    1.36 +class CVPbkxSPContactsImpl;
    1.37 +
    1.38 +// CLASS DECLARATION
    1.39 +
    1.40 +/**
    1.41 + * A class for fetching xSP Contacts.
    1.42 + * Operations are asynchronous and accept two observers.
    1.43 + * One used to signal completion and return result.
    1.44 + * Another one used to signal an error if operation fails.
    1.45 + *
    1.46 + * @example
    1.47 + * A client fetch xSP contactlinks for given contact.
    1.48 + *
    1.49 + * class CxSPContactsClient :
    1.50 + *   public CActive, 
    1.51 + *   public MVPbkOperationErrorObserver,
    1.52 + *   public MVPbkOperationResultObserver<MVPbkContactLinkArray*>
    1.53 + *    ...
    1.54 + *
    1.55 + * void CxSPContactsClient::FetchxSPLinksL()
    1.56 + *   {
    1.57 + *   ixSPManager = CVPbkxSPContacts::NewL( iContactManager );                                                              
    1.58 + *   ixSPContactOperation = ixSPManager->GetxSPContactLinksL(*iContact, *this, *this);
    1.59 + *   }
    1.60 + * 
    1.61 + * 
    1.62 + * //From MVPbkOperationErrorObserver
    1.63 + * void CxSPContactsClient::VPbkOperationFailed(
    1.64 + *       MVPbkContactOperationBase*,
    1.65 + *       TInt aError )
    1.66 + *   {
    1.67 + *   ...
    1.68 + *   }
    1.69 + *
    1.70 + * // From MVPbkOperationResultObserver
    1.71 + * void CxSPContactsClient::VPbkOperationResultCompleted(
    1.72 + *       MVPbkContactOperationBase*,
    1.73 + *       MVPbkContactLinkArray* aArray )
    1.74 + *   {
    1.75 + *   TInt count = aArray->Count(); 
    1.76 + *   for(TInt a = 0; a < count; a++)
    1.77 + *       {
    1.78 + *       const MVPbkContactLink& link = aArray->At(a);
    1.79 + *       ... do something
    1.80 + *       } 
    1.81 + *   }
    1.82 + */
    1.83 +
    1.84 +NONSHARABLE_CLASS( CVPbkxSPContacts ) : public CBase
    1.85 +    {
    1.86 +public:
    1.87 +
    1.88 +    /**
    1.89 +     * Creates the xsp contacts fetcher.
    1.90 +     * @param aContactManager Contact manager which already has its stores opened.
    1.91 +     */
    1.92 +    IMPORT_C static CVPbkxSPContacts* NewL( CVPbkContactManager& aContactManager );
    1.93 +    IMPORT_C ~CVPbkxSPContacts();
    1.94 +
    1.95 +public:
    1.96 +
    1.97 +    /**
    1.98 +     * Get xSP contacts as contact link array for given contact.
    1.99 +     * If contact doesn't have any xSP contactlinks, 
   1.100 +     * empty contact link array will be returned.
   1.101 +     * If aContact is NULL, KErrArgument is notified via MVPbkOperationErrorObserver.
   1.102 +     * 
   1.103 +     * @param aContact The contact
   1.104 +     * @param aResultObserver The observer that gets xsp contact links array.
   1.105 +     * @param aErrorObserver The observer for error notification. 
   1.106 +     */
   1.107 +    IMPORT_C MVPbkContactOperationBase* GetxSPContactLinksL(
   1.108 +            const MVPbkStoreContact& aContact,
   1.109 +            MVPbkOperationResultObserver<MVPbkContactLinkArray*>& aResultObserver,
   1.110 +            MVPbkOperationErrorObserver& aErrorObserver );
   1.111 +
   1.112 +private: // construction
   1.113 +    CVPbkxSPContacts();
   1.114 +
   1.115 +private: // data
   1.116 +    CVPbkxSPContactsImpl* iImpl;
   1.117 +    };
   1.118 +
   1.119 +#endif //VPBKXSPCONTACTS_H
   1.120 +//End of file