filemanager/GFLM/src/CGflmFileRecognizer.cpp
branchRCL_3
changeset 13 5181328fad28
parent 0 6a9f87576119
child 14 efe289f793e7
equal deleted inserted replaced
11:649c558486f0 13:5181328fad28
    94 //
    94 //
    95 void CGflmFileRecognizer::ConstructExtMimePairsL(
    95 void CGflmFileRecognizer::ConstructExtMimePairsL(
    96         RResourceFile& aResFile,
    96         RResourceFile& aResFile,
    97         TInt aResId,
    97         TInt aResId,
    98         RPointerArray< CExtMimePair >& aPairs )
    98         RPointerArray< CExtMimePair >& aPairs )
    99     {
    99     {   
       
   100     TCleanupItem cleanupItem( ResetAndDestroyExtMimePairs, &aPairs );
       
   101     CleanupStack::PushL( cleanupItem );
   100     // read the pairs
   102     // read the pairs
   101     HBufC8* resData = aResFile.AllocReadLC( aResId );
   103     HBufC8* resData = aResFile.AllocReadLC( aResId );
   102     TResourceReader reader;
   104     TResourceReader reader;
   103     reader.SetBuffer( resData );
   105     reader.SetBuffer( resData );
   104     TInt count( reader.ReadInt16() );
   106     TInt count( reader.ReadInt16() );
   113         pair->iMime = mime.AllocL();
   115         pair->iMime = mime.AllocL();
   114         aPairs.AppendL( pair );
   116         aPairs.AppendL( pair );
   115         CleanupStack::Pop( pair );
   117         CleanupStack::Pop( pair );
   116         }
   118         }
   117     CleanupStack::PopAndDestroy( resData );
   119     CleanupStack::PopAndDestroy( resData );
       
   120     CleanupStack::Pop( &aPairs );
   118     }
   121     }
   119 
   122 
   120 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   121 // CGflmFileRecognizer::FindMimeFromExt
   124 // CGflmFileRecognizer::FindMimeFromExt
   122 //
   125 //
   318             return iMimeTypes->MdcaPoint( newPair->iTypeIndex );
   321             return iMimeTypes->MdcaPoint( newPair->iTypeIndex );
   319             }
   322             }
   320         return TPtrC( KNullDesC );
   323         return TPtrC( KNullDesC );
   321     }
   324     }
   322 
   325 
       
   326 
       
   327 // -----------------------------------------------------------------------------
       
   328 //  CGflmFileRecognizer::ResetAndDestroyExtMimePairs( )
       
   329 // 
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 void CGflmFileRecognizer::ResetAndDestroyExtMimePairs( TAny* aPtr )
       
   333     {
       
   334     RPointerArray< CExtMimePair >* extMimePairs = 
       
   335         static_cast< RPointerArray< CExtMimePair >* >( aPtr );
       
   336     extMimePairs->ResetAndDestroy();
       
   337     extMimePairs->Close();
       
   338     }
       
   339  
       
   340  
   323 // -----------------------------------------------------------------------------
   341 // -----------------------------------------------------------------------------
   324 // CGflmFileRecognizer::FlushCache( )
   342 // CGflmFileRecognizer::FlushCache( )
   325 //
   343 //
   326 // -----------------------------------------------------------------------------
   344 // -----------------------------------------------------------------------------
   327 //
   345 //