diff -r 000000000000 -r e686773b3f54 predictivesearch/PcsAlgorithm/Algorithm1/src/CPsDataPluginInterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPsDataPluginInterface.cpp Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,242 @@ +/* +* Copyright (c) 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: +* +*/ + + +// INCLUDE FILES +#include "CPsDataPluginInterface.h" +#include "CPsDataPlugin.h" +#include "CPcsDebug.h" + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::NewL +// Two Phase Construction +// ---------------------------------------------------------------------------- +CPsDataPluginInterface* CPsDataPluginInterface::NewL(MDataStoreObserver* aObserverForDataStore, + MStoreListObserver* aStoreListObserver) +{ + PRINT ( _L("Enter CPsDataPluginInterface::NewL") ); + + CPsDataPluginInterface* self = CPsDataPluginInterface::NewLC(aObserverForDataStore, aStoreListObserver); + CleanupStack::Pop( self ); + + PRINT ( _L("End CPsDataPluginInterface::NewL") ); + + return self; +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::NewLC +// Two Phase Construction +// ---------------------------------------------------------------------------- +CPsDataPluginInterface* CPsDataPluginInterface::NewLC(MDataStoreObserver* aObserverForDataStore, + MStoreListObserver* aStoreListObserver) +{ + PRINT ( _L("Enter CPsDataPluginInterface::NewLC") ); + + CPsDataPluginInterface* self = new( ELeave ) CPsDataPluginInterface(); + CleanupStack::PushL( self ); + self->ConstructL(aObserverForDataStore, aStoreListObserver); + + PRINT ( _L("End CPsDataPluginInterface::NewLC") ); + + return self; +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::CPsDataPluginInterface +// Constructor +// ---------------------------------------------------------------------------- +CPsDataPluginInterface::CPsDataPluginInterface() +{ + PRINT ( _L("Enter CPsDataPluginInterface::CPsDataPluginInterface") ); + PRINT ( _L("End CPsDataPluginInterface::CPsDataPluginInterface") ); +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::ConstructL +// 2nd phase constructor +// ---------------------------------------------------------------------------- +void CPsDataPluginInterface::ConstructL(MDataStoreObserver* aObserverForDataStore, + MStoreListObserver* aStoreListObserver) +{ + PRINT ( _L("Enter CPsDataPluginInterface::ConstructL") ); + iObserverForDataStore = aObserverForDataStore; + iStoreListObserver = aStoreListObserver; + PRINT ( _L("End CPsDataPluginInterface::ConstructL") ); +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::~CPsDataPluginInterface +// Constructor +// ---------------------------------------------------------------------------- +CPsDataPluginInterface::~CPsDataPluginInterface( ) +{ + PRINT ( _L("Enter CPsDataPluginInterface::~CPsDataPluginInterface") ); + + UnloadPlugIns(); + iPsDataPluginInstances.ResetAndDestroy(); + + PRINT ( _L("End CPsDataPluginInterface::~CPsDataPluginInterface") ); +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::InstantiateAllPlugInsL +// Instantiates all plugins +// ---------------------------------------------------------------------------- +void CPsDataPluginInterface::InstantiateAllPlugInsL( ) +{ + PRINT ( _L("Enter CPsDataPluginInterface::InstantiateAllPlugInsL") ); + + RImplInfoPtrArray infoArray; + + // Get list of all implementations + ListAllImplementationsL( infoArray ); + + // Instantiate plugins for all impUIds by calling + // InstantiatePlugInFromImpUidL + for ( TInt i=0; iIsDataStoresSupportedL(aDataStore)) + { + iPsDataPluginInstances[idx]->RequestForDataL(aDataStore); + break; + } + } + + PRINT ( _L("End CPsDataPluginInterface::RequestForDataL") ); + +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::GetAllSupportedDataStoresL +// Requests all the supported data stores from data adapters +// ---------------------------------------------------------------------------- +void CPsDataPluginInterface::GetAllSupportedDataStoresL(RPointerArray& aDataStores) +{ + + PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") ); + + for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ ) + { + iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores); + } + + PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") ); + +} + +// ---------------------------------------------------------------------------- +// CPsDataPluginInterface::GetAllSupportedDataFieldsL +// Requests all the supported data fields from from data adapters +// ---------------------------------------------------------------------------- +void CPsDataPluginInterface::GetSupportedDataFieldsL(TDesC& aUri, RArray& aDataFields) +{ + + PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") ); + + for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ ) + { + RPointerArray aDataStores; + iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores); + + for( TInt i(0); iCompare(aUri) == 0) + { + iPsDataPluginInstances[idx]->GetSupportedDataFieldsL(aDataFields); + break; + } + } + aDataStores.Reset(); + } + + PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") ); + +} +// End of file