contacts_plat/virtual_phonebook_store_api/inc/CVPbkContactStoreList.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:00:21 +0300
branchRCL_3
changeset 32 2828b4d142c0
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* 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