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