predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp
branchRCL_3
changeset 21 b3431bff8c19
parent 15 e8e3147d53eb
child 32 2828b4d142c0
equal deleted inserted replaced
15:e8e3147d53eb 21:b3431bff8c19
   295     }
   295     }
   296     
   296     
   297     return ETrue;
   297     return ETrue;
   298 }
   298 }
   299 
   299 
       
   300 // ----------------------------------------------------------------------------
       
   301 // CPcsAlgorithm1Helper::FilterDataFieldsL()
       
   302 // Constructs a bit pattern using the required/supported data fields
       
   303 // For example, 6, 4 and 27 are supported fields <-- 00000111
       
   304 //              6 and 4 are required fields      <-- 00000011
       
   305 // Bit pattern returned is 00000011.
       
   306 // ----------------------------------------------------------------------------
       
   307 TUint8 CPcsAlgorithm1Utils::FilterDataFieldsL(const RArray<TInt>& aRequiredDataFields,
       
   308                                               const RArray<TInt>& aSupportedDataFields)
       
   309 {
       
   310     TUint8 filteredMatch = 0x0;
       
   311 
       
   312     for ( TInt i = 0; i < aSupportedDataFields.Count(); i++ )
       
   313     {
       
   314         for ( TInt j = 0; j < aRequiredDataFields.Count(); j++ )
       
   315         {
       
   316             if ( aSupportedDataFields[i] == aRequiredDataFields[j] )
       
   317             {
       
   318                 TUint8 val = 1 << i;
       
   319                 filteredMatch |= val;
       
   320             }
       
   321         }
       
   322     }
       
   323 
       
   324     return filteredMatch;
       
   325 }
       
   326 
       
   327 // ----------------------------------------------------------------------------
       
   328 // CPcsAlgorithm1Utils::AppendMatchToSeqL
       
   329 // ----------------------------------------------------------------------------
       
   330 void CPcsAlgorithm1Utils::AppendMatchToSeqL( 
       
   331         RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch )
       
   332     {
       
   333     HBufC* seq = aMatch.AllocLC();
       
   334     seq->Des().UpperCase();
       
   335     TIdentityRelation<TDesC> rule(CompareExact);
       
   336     if ( aMatchSeq.Find(seq, rule) == KErrNotFound )
       
   337         {
       
   338         aMatchSeq.AppendL(seq);
       
   339         CleanupStack::Pop( seq );
       
   340         }
       
   341     else 
       
   342         {
       
   343         CleanupStack::PopAndDestroy( seq );
       
   344         }
       
   345     }
       
   346 
   300 // End of File
   347 // End of File
   301 
   348