uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h
branchRCL_3
changeset 8 46927d61fef3
parent 7 88b23e2e82e1
child 12 f93c875b566e
equal deleted inserted replaced
7:88b23e2e82e1 8:46927d61fef3
   214      * and value has been set.
   214      * and value has been set.
   215      * 
   215      * 
   216      * @param aTestType Describes for what case the item is for.
   216      * @param aTestType Describes for what case the item is for.
   217      * @param aKey Key of the map item.
   217      * @param aKey Key of the map item.
   218      * @param aValue If map item is found, value of the item is set here.
   218      * @param aValue If map item is found, value of the item is set here.
       
   219      * @param aAcceptDefault ETrue if an existing object having its default value
       
   220      *                       is accepted. EFalse if value should have been updated
       
   221      *                       separately.
   219      * @return TBool ETrue if map item is found and value has been set. Else EFalse. 
   222      * @return TBool ETrue if map item is found and value has been set. Else EFalse. 
   220      */    
   223      */    
   221     TBool GetActualValue( const TAlfModuleTestType& aTestType, TInt aKey, T& aValue )
   224     TBool GetActualValue( 
       
   225         const TAlfModuleTestType& aTestType, TInt aKey, T& aValue, TBool aAcceptDefault )
   222         {
   226         {
   223         const TAlfModuleTestItem< T >* item( FindActual( aTestType, aKey ) );
   227         const TAlfModuleTestItem< T >* item( FindActual( aTestType, aKey ) );
   224         if ( item && item->ValueSetCount() > 0 )
   228         if ( item && ( aAcceptDefault || item->ValueSetCount() > 0 ) )
   225             {
   229             {
   226             aValue = item->Value();
   230             aValue = item->Value();
   227             return ETrue;
   231             return ETrue;
   228             }
   232             }
   229         return EFalse;
   233         return EFalse;
   231 
   235 
   232 
   236 
   233     /**
   237     /**
   234      * Finds an actual item if it exists and checks if it equals the given value.
   238      * Finds an actual item if it exists and checks if it equals the given value.
   235      * 
   239      * 
       
   240      * @param aTestType Describes for what case the item is for.
       
   241      * @param aKey Key of the map item.
       
   242      * @param aValue Value of the map item.
   236      * @return TBool ETrue if item is found and its value equals given value. Else EFalse. 
   243      * @return TBool ETrue if item is found and its value equals given value. Else EFalse. 
   237      */
   244      */
   238     TBool ActualEquals( const TAlfModuleTestType& aTestType, TInt aKey, const T& aValue )
   245     TBool ActualEquals( const TAlfModuleTestType& aTestType, TInt aKey, const T& aValue )
   239         {
   246         {
   240         T value( aValue );
   247         T value( aValue );
   241         if ( GetActualValue( aTestType, aKey, value ) && value == aValue )
   248         if ( GetActualValue( aTestType, aKey, value, ETrue ) && value == aValue )
   242             {
   249             {
   243             return ETrue;
   250             return ETrue;
   244             }
   251             }
   245         return EFalse;
   252         return EFalse;
   246         }
   253         }