contacts_plat/virtual_phonebook_store_api/inc/CVPbkContactStoreList.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:29:52 +0100
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  A class for store list implementation
*
*/


#ifndef CVPBKCONTACTSTORELIST_H
#define CVPBKCONTACTSTORELIST_H

#include <e32base.h>
#include <MVPbkContactStoreList.h>
#include <MVPbkContactStoreObserver.h>

class TVPbkContactStoreUriPtr;
class CVPbkContactStoreUriArray;


/**
 * A class for store list implementation
 *
 * @lib VPbkEng.lib
 */
class CVPbkContactStoreList : 
        public CBase,
        public MVPbkContactStoreList,
        private MVPbkContactStoreObserver
    {
    public:
        /**
         * Constructor.
         * @return A new instance of this class
         */
        IMPORT_C static CVPbkContactStoreList* NewL();
    
        /**
         * Destructor. Destroys all stores.
         */
        virtual ~CVPbkContactStoreList();
    
        /**
         * Appends a new store to the list. Ownership is taken.
         *
         * @param aStore a new store to the list. Ownership is taken.
         */
        IMPORT_C void AppendL( MVPbkContactStore* aStore );
    
    public: // from MVPbkContactStoreList
        TInt Count() const;
        MVPbkContactStore& At( TInt aIndex ) const;
        MVPbkContactStore* Find( const TVPbkContactStoreUriPtr& aUri ) const;
        void OpenAllL( MVPbkContactStoreListObserver& aObserver );
        void CloseAll( MVPbkContactStoreListObserver& aObserver );
    
    private: // from MVPbkContactStoreObserver
        void StoreReady( MVPbkContactStore& aContactStore );
        void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason );
        void HandleStoreEventL(
            MVPbkContactStore& aContactStore, 
            TVPbkContactStoreEvent aStoreEvent);
        
    private: // implementation
        void SignalOpenComplete();  
        
    private: // implementation
        CVPbkContactStoreList();
        
    private: // data
        /// Own: an array that owns the store instances
        RPointerArray<MVPbkContactStore> iStores;
        /// Ref: a references to the stores that are opened
        RPointerArray<MVPbkContactStore> iStoresToOpen;
        /// Ref: the observer of this list.
        MVPbkContactStoreListObserver* iObserver;
    };


#endif // CVPBKCONTACTSTORELIST_H

// End of File