crypto/weakcryptospi/test/tcryptospi/src/filereader.h
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology
       
    24 */
       
    25 #ifndef __FILEREADER__
       
    26 #define __FILEREADER__
       
    27 
       
    28 #include <e32cmn.h>
       
    29 #include <e32base.h>
       
    30 #include <e32std.h>
       
    31 #include <e32def.h>
       
    32 #include <f32file.h>
       
    33 #include <bigint.h>
       
    34 
       
    35 	class CFileReader : public CBase
       
    36 		{
       
    37 	public:
       
    38 		static CFileReader* NewL(TPtrC aFileReader);
       
    39 		static CFileReader* NewLC(TPtrC aFileReader);
       
    40 		static CFileReader* NewL(TPtrC aFilePath, TInt aBlockSize);
       
    41 		static CFileReader* NewLC(TPtrC aFilePath, TInt aBlockSize);
       
    42 
       
    43 		operator const TPtrC8();
       
    44 				
       
    45 		virtual ~CFileReader();
       
    46 		
       
    47 		TBool ReadBlockL();
       
    48 		
       
    49 		TInt NumBlocks();
       
    50 		
       
    51 		/** Parse a hex string and return a new RInteger. */
       
    52     	RInteger ParseIntegerL();
       
    53 
       
    54     	/** Parse a hex string and return a new descriptor containing the binary data. */
       
    55 		HBufC8* ParseBinaryL(const TDesC8& aDes);
       
    56 		
       
    57 	private:
       
    58 		CFileReader();
       
    59 	
       
    60 		void ConstructL(TPtrC aFileReader);
       
    61 		void ConstructL(TPtrC aFilePath, TInt aOffsetSize);
       
    62 
       
    63 		HBufC8* iFileContents;
       
    64 		HBufC*	iFilePath;
       
    65 		TInt 	iFileOffset;
       
    66 		TInt 	iBlockSize;
       
    67 		
       
    68 		RFs		iRfs;
       
    69 		RFile	iFile;
       
    70 
       
    71 
       
    72 		};
       
    73 #endif