epoc32/include/app/CVPbkxSPContacts.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2005-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:  xSP contacts
    15  *
    16 */
    17 
    18 
    19 #ifndef VPBKXSPCONTACTS_H
    20 #define VPBKXSPCONTACTS_H
    21 
    22 // INCLUDES
    23 #include <e32base.h>
    24 
    25 // FORWARD DECLARATIONS
    26 class MVPbkContactLinkArray;
    27 class CVPbkContactManager;
    28 class MVPbkContactOperationBase;
    29 class MVPbkStoreContact;
    30 template<typename T> class MVPbkOperationResultObserver;
    31 class MVPbkOperationErrorObserver;
    32 
    33 class CVPbkxSPContactsImpl;
    34 
    35 // CLASS DECLARATION
    36 
    37 /**
    38  * A class for fetching xSP Contacts.
    39  * Operations are asynchronous and accept two observers.
    40  * One used to signal completion and return result.
    41  * Another one used to signal an error if operation fails.
    42  *
    43  * @example
    44  * A client fetch xSP contactlinks for given contact.
    45  *
    46  * class CxSPContactsClient :
    47  *   public CActive, 
    48  *   public MVPbkOperationErrorObserver,
    49  *   public MVPbkOperationResultObserver<MVPbkContactLinkArray*>
    50  *    ...
    51  *
    52  * void CxSPContactsClient::FetchxSPLinksL()
    53  *   {
    54  *   ixSPManager = CVPbkxSPContacts::NewL( iContactManager );                                                              
    55  *   ixSPContactOperation = ixSPManager->GetxSPContactLinksL(*iContact, *this, *this);
    56  *   }
    57  * 
    58  * 
    59  * //From MVPbkOperationErrorObserver
    60  * void CxSPContactsClient::VPbkOperationFailed(
    61  *       MVPbkContactOperationBase*,
    62  *       TInt aError )
    63  *   {
    64  *   ...
    65  *   }
    66  *
    67  * // From MVPbkOperationResultObserver
    68  * void CxSPContactsClient::VPbkOperationResultCompleted(
    69  *       MVPbkContactOperationBase*,
    70  *       MVPbkContactLinkArray* aArray )
    71  *   {
    72  *   TInt count = aArray->Count(); 
    73  *   for(TInt a = 0; a < count; a++)
    74  *       {
    75  *       const MVPbkContactLink& link = aArray->At(a);
    76  *       ... do something
    77  *       } 
    78  *   }
    79  */
    80 
    81 NONSHARABLE_CLASS( CVPbkxSPContacts ) : public CBase
    82     {
    83 public:
    84 
    85     /**
    86      * Creates the xsp contacts fetcher.
    87      * @param aContactManager Contact manager which already has its stores opened.
    88      */
    89     IMPORT_C static CVPbkxSPContacts* NewL( CVPbkContactManager& aContactManager );
    90     IMPORT_C ~CVPbkxSPContacts();
    91 
    92 public:
    93 
    94     /**
    95      * Get xSP contacts as contact link array for given contact.
    96      * If contact doesn't have any xSP contactlinks, 
    97      * empty contact link array will be returned.
    98      * If aContact is NULL, KErrArgument is notified via MVPbkOperationErrorObserver.
    99      * 
   100      * @param aContact The contact
   101      * @param aResultObserver The observer that gets xsp contact links array.
   102      * @param aErrorObserver The observer for error notification. 
   103      */
   104     IMPORT_C MVPbkContactOperationBase* GetxSPContactLinksL(
   105             const MVPbkStoreContact& aContact,
   106             MVPbkOperationResultObserver<MVPbkContactLinkArray*>& aResultObserver,
   107             MVPbkOperationErrorObserver& aErrorObserver );
   108 
   109 private: // construction
   110     CVPbkxSPContacts();
   111 
   112 private: // data
   113     CVPbkxSPContactsImpl* iImpl;
   114     };
   115 
   116 #endif //VPBKXSPCONTACTS_H
   117 //End of file