predictivesearch/PcsAlgorithm/Algorithm2/src/CPsDataPluginInterface.cpp
branchRCL_3
changeset 18 d4f567ce2e7c
parent 0 e686773b3f54
equal deleted inserted replaced
17:2666d9724c76 18:d4f567ce2e7c
    13 *
    13 *
    14 * Description:  
    14 * Description:  
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 
    18 // INCLUDE FILES
    19 // INCLUDE FILES
    19 #include "CPsDataPluginInterface.h"
    20 #include "CPsDataPluginInterface.h"
    20 #include "CPsDataPlugin.h"
    21 #include "CPsDataPlugin.h"
    21 #include "CPcsDebug.h"
    22 #include "CPcsDebug.h"
    22 
    23 
   107     // Get list of all implementations
   108     // Get list of all implementations
   108     ListAllImplementationsL( infoArray );
   109     ListAllImplementationsL( infoArray );
   109     
   110     
   110     // Instantiate plugins for all impUIds by calling 
   111     // Instantiate plugins for all impUIds by calling 
   111     // InstantiatePlugInFromImpUidL
   112     // InstantiatePlugInFromImpUidL
   112     for ( TInt i=0; i<infoArray.Count(); i++ )
   113     const TInt infoArrayCount = infoArray.Count();
       
   114     for ( TInt i=0; i < infoArrayCount; i++ )
   113     {
   115     {
   114         // Get imp info
   116         // Get imp info
   115         CImplementationInformation& info( *infoArray[i] );
   117         CImplementationInformation& info( *infoArray[i] );
   116         
   118         
   117         // Get imp UID
   119         // Get imp UID
   176 // ---------------------------------------------------------------------------- 
   178 // ---------------------------------------------------------------------------- 
   177 void  CPsDataPluginInterface::RequestForDataL(TDesC& aDataStore)
   179 void  CPsDataPluginInterface::RequestForDataL(TDesC& aDataStore)
   178 {
   180 {
   179 
   181 
   180     PRINT ( _L("Enter CPsDataPluginInterface::RequestForDataL") );
   182     PRINT ( _L("Enter CPsDataPluginInterface::RequestForDataL") );
   181    
   183    const TInt instancesCount = iPsDataPluginInstances.Count();
   182     for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
   184     for ( TInt idx = 0; idx < instancesCount; idx++ )
   183     {
   185     {
   184         if(iPsDataPluginInstances[idx]->IsDataStoresSupportedL(aDataStore))
   186         if(iPsDataPluginInstances[idx]->IsDataStoresSupportedL(aDataStore))
   185         {
   187         {
   186        		iPsDataPluginInstances[idx]->RequestForDataL(aDataStore);
   188        		iPsDataPluginInstances[idx]->RequestForDataL(aDataStore);
   187     		break; 
   189     		break; 
   198 // ---------------------------------------------------------------------------- 
   200 // ---------------------------------------------------------------------------- 
   199 void  CPsDataPluginInterface::GetAllSupportedDataStoresL(RPointerArray<TDesC>& aDataStores)
   201 void  CPsDataPluginInterface::GetAllSupportedDataStoresL(RPointerArray<TDesC>& aDataStores)
   200 {
   202 {
   201 
   203 
   202     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   204     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   203    
   205     const TInt instancesCount = iPsDataPluginInstances.Count();
   204     for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
   206     for ( TInt idx = 0; idx < instancesCount; idx++ )
   205     {       
   207     {       
   206        iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
   208        iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
   207     }
   209     }
   208     
   210     
   209     PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   211     PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   217 void  CPsDataPluginInterface::GetSupportedDataFieldsL(TDesC& aUri, RArray<TInt>& aDataFields)
   219 void  CPsDataPluginInterface::GetSupportedDataFieldsL(TDesC& aUri, RArray<TInt>& aDataFields)
   218 {
   220 {
   219 
   221 
   220     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   222     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   221    
   223    
   222     for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
   224     const TInt instancesCount = iPsDataPluginInstances.Count();
   223     {   
   225     for ( TInt idx = 0; idx < instancesCount; idx++ )
   224        RPointerArray<TDesC> aDataStores;    
   226     {
   225        iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
   227        RPointerArray<TDesC> dataStores;
       
   228        CleanupClosePushL( dataStores );
       
   229        iPsDataPluginInstances[idx]->GetSupportedDataStoresL(dataStores);
   226        
   230        
   227        for( TInt i(0); i<aDataStores.Count(); i++)
   231        const TInt dataStoresCount = dataStores.Count();
   228        {       	
   232        for ( TInt i(0); i < dataStoresCount; i++)
   229 	       	if( aDataStores[i]->Compare(aUri) == 0)
   233        {
       
   234 	       	if ( dataStores[i]->Compare(aUri) == 0)
   230 	       	{
   235 	       	{
   231 	       		iPsDataPluginInstances[idx]->GetSupportedDataFieldsL(aDataFields);
   236 	       		iPsDataPluginInstances[idx]->GetSupportedDataFieldsL(aDataFields);
   232 	       		break;
   237 	       		break;
   233 	       	}    	
   238 	       	}
   234        }
   239        }
   235        aDataStores.Reset();
   240        CleanupStack::PopAndDestroy( &dataStores ); // Close
   236     }
   241     }
   237     
   242     
   238     PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   243     PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") );
   239 
   244 
   240 }
   245 }