installationservices/swi/source/swis/server/fileextractor.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * fileextractor.cpp
       
    16 * Component which handles extracting of files asynchronously
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology
       
    24 */
       
    25 
       
    26 #ifndef __FILEEXTRACTOR_H__
       
    27 #define __FILEEXTRACTOR_H__
       
    28  
       
    29 #include <e32base.h>
       
    30 
       
    31 #include "appinfo.h"
       
    32 
       
    33 class RFs;
       
    34 class RFile;
       
    35 
       
    36 namespace Swi
       
    37 {
       
    38 class CSisRegistryFileDescription;
       
    39 class RSisHelper;
       
    40 class RUiHandler;
       
    41 
       
    42 /**
       
    43  * This class is an active object, which manages file extraction in chunks, using SISHelper
       
    44  */
       
    45 class CFileExtractor : public CActive
       
    46 	{
       
    47 public:
       
    48 	static CFileExtractor* NewLC(RFs& aFs, RSisHelper& aSisHelper, RUiHandler& aUiHandler, const TAppInfo& aAppInfo);
       
    49 	
       
    50 	static CFileExtractor* NewL(RFs& aFs, RSisHelper& aSisHelper, RUiHandler& aUiHandler, const TAppInfo& aAppInfo);
       
    51 	
       
    52 	/**
       
    53 	 * Extract the file, using provided file handle which must be set up correctly.
       
    54 	 */	
       
    55 	void ExtractFileL(TInt aDataUnit, const CSisRegistryFileDescription& aFileDescription, RFile& aFile, TRequestStatus& aStatus);
       
    56 
       
    57 	/**
       
    58 	 * Extract the file, using provided file handle which must be set up correctly.
       
    59 	 */	
       
    60 	void ExtractFileL(TInt aDataUnit, const CSisRegistryFileDescription& aFileDescription, const TDesC& aFileName, TRequestStatus& aStatus);
       
    61 		
       
    62 	~CFileExtractor();
       
    63 	
       
    64 private:
       
    65 	CFileExtractor(RFs& aFs, RSisHelper& aSisHelper, RUiHandler& aUiHandler, const TAppInfo& aAppInfo);	
       
    66 	void ConstructL();
       
    67 	
       
    68 // from CActive
       
    69 	void RunL();
       
    70 	void DoCancel();
       
    71 	TInt RunError(TInt aError);
       
    72 	
       
    73 
       
    74 	/// Sets up the file handle, owned by the file extractor for the duration of the extraction
       
    75 	void SetupFileHandleL(const TDesC& aFileName);
       
    76 
       
    77 	/// finishes the extraction and notifies the client of the result
       
    78 	TInt FinishExtraction(TInt aResult);	
       
    79 
       
    80 private:	
       
    81 	RFs&	iFs;
       
    82 	RSisHelper& iSisHelper;
       
    83 	RUiHandler& iUiHandler;
       
    84 	const TAppInfo& iAppInfo;
       
    85 	
       
    86 	TRequestStatus* iClientStatus;
       
    87 
       
    88 	TBool iCancelled;
       
    89 	TInt iBytesToExtract;
       
    90 	RFile* iCurrentFile;
       
    91 	CSisRegistryFileDescription* iFileDescription;
       
    92 	TInt32 iDataUnit;
       
    93 	TBool iManagedFileHandle; // whether we manage the file handle used for file extraction.
       
    94 	};
       
    95 	
       
    96 }
       
    97 
       
    98 #endif // #ifndef __FILEEXTRACTOR_H__