predictivesearch/PcsUtils/src/CPsData.cpp
branchRCL_3
changeset 6 e8e3147d53eb
parent 0 e686773b3f54
child 12 4ae315f230bc
equal deleted inserted replaced
5:81f8547efd4f 6:e8e3147d53eb
    22 #include <s32mem.h>
    22 #include <s32mem.h>
    23 #include <collate.h>
    23 #include <collate.h>
    24 
    24 
    25 #include "CPsData.h"
    25 #include "CPsData.h"
    26 #include "CPcsDefs.h"
    26 #include "CPcsDefs.h"
       
    27 
    27 // ============================== MEMBER FUNCTIONS ============================
    28 // ============================== MEMBER FUNCTIONS ============================
    28 
    29 
    29 
    30 
    30 // ----------------------------------------------------------------------------
    31 // ----------------------------------------------------------------------------
    31 // CPsData::NewL
    32 // CPsData::NewL
   322         CleanupStack::PopAndDestroy(str2);
   323         CleanupStack::PopAndDestroy(str2);
   323         CleanupStack::PopAndDestroy(str1);
   324         CleanupStack::PopAndDestroy(str1);
   324         if( !compareRes )
   325         if( !compareRes )
   325             {
   326             {
   326             break;
   327             break;
   327 			}
   328             }
   328         }
   329         }
   329     return compareRes;
   330     return compareRes;
   330 }
   331 }
   331 
   332 
   332 // ----------------------------------------------------------------------------
   333 // ----------------------------------------------------------------------------
   340 		return ETrue;
   341 		return ETrue;
   341 	}
   342 	}
   342 	
   343 	
   343 	return EFalse;
   344 	return EFalse;
   344 }
   345 }
   345 				     
   346 
   346 
   347 
   347 // ----------------------------------------------------------------------------
   348 // ----------------------------------------------------------------------------
   348 // CPsData::IsDataMatch
   349 // CPsData::IsDataMatch
   349 // Return TRUE if data is matched for predictive search
   350 // Return TRUE if data is matched for predictive search
   350 // ----------------------------------------------------------------------------		
   351 // ----------------------------------------------------------------------------		
   351 EXPORT_C TBool CPsData::IsDataMatch(TInt aIndex)
   352 EXPORT_C TBool CPsData::IsDataMatch(TInt aIndex)
   352 {	
   353 {
   353     TReal val;
   354     __ASSERT_DEBUG( aIndex < 8, User::Panic( _L("CPsData"), KErrOverflow ) );
   354 	Math::Pow(val, 2, aIndex);
   355     TUint8 val = 1 << aIndex;
   355 
   356     return (iDataMatches & val);
   356 	return(iDataMatches & (TUint8)val);
       
   357 }
   357 }
   358 
   358 
   359 // ----------------------------------------------------------------------------
   359 // ----------------------------------------------------------------------------
   360 // CPsData:DataMatch
   360 // CPsData:DataMatch
   361 // Return the data match attribute
   361 // Return the data match attribute
   368 // ----------------------------------------------------------------------------
   368 // ----------------------------------------------------------------------------
   369 // CPsData::SetData1Match
   369 // CPsData::SetData1Match
   370 // 
   370 // 
   371 // ----------------------------------------------------------------------------
   371 // ----------------------------------------------------------------------------
   372 EXPORT_C void CPsData::SetDataMatch(TInt aIndex)
   372 EXPORT_C void CPsData::SetDataMatch(TInt aIndex)
   373 {	
   373 {
   374     TReal val;
   374     __ASSERT_DEBUG( aIndex < 8, User::Panic( _L("CPsData"), KErrOverflow ) );
   375 	Math::Pow(val, 2, aIndex);
   375     TUint8 val = 1 << aIndex;
   376 
   376     iDataMatches |= val;
   377 	iDataMatches |= (TUint8)val;
       
   378 }
   377 }
   379 
   378 
   380 // ----------------------------------------------------------------------------
   379 // ----------------------------------------------------------------------------
   381 // CPsData::ClearDataMatches
   380 // CPsData::ClearDataMatches
   382 // 
   381 //