filehandling/htmltorichtextconverter/inc/CHtmlToCrtConvBuffer.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32std.h>
       
    17 #include <e32base.h>
       
    18 #include <f32file.h>
       
    19 #include <charconv.h>
       
    20 
       
    21 class CHtmlToCrtConvBuffer : public CBase
       
    22 	{
       
    23 	public:
       
    24 		static CHtmlToCrtConvBuffer* NewL(const TDesC& aFile, RFs& aFsSession, CCnvCharacterSetConverter& aCnvCharacterSetConverter);
       
    25 		~CHtmlToCrtConvBuffer();
       
    26 
       
    27 	/**
       
    28 		@fn		TBool ReadCharacterL(TChar& aCharacter, TInt& aBufferPosition, TBool& aEndOfBuffer)		
       
    29 		Intended Usage	: gets next character from the file
       
    30 		@param	aCharacter the character which was read
       
    31 		@param	aBufferPosition	the current buffer position
       
    32 		@param	aEndOfBuffer	ETrue if end of buffer reached, else EFalse
       
    33 		@return	TBool ETrue if character read, else EFalse
       
    34 	 */
       
    35 		TBool ReadCharacterL(TChar& aCharacter, TInt& aBufferPosition, TBool& aEndOfBuffer);
       
    36 		void GetPartOfBufferL(TPtrC16& aPartOfBuffer, TInt aStartPosition, TInt aEndPosition) const;
       
    37 		void GetToEndOfBufferL(TPtrC16& aPartOfBuffer, TInt aStartPosition) const;
       
    38 	/**
       
    39 		@fn		GetSampleOfTextFromFileL(TDes8& aSample, TInt aLength, TInt aOffset)
       
    40 		Intended Usage	:	reads the specified number of characters from the file at a specified offset 
       
    41 		@param	aSample	descriptor into which characters are read
       
    42 		@param	aLength	number of characters to be read
       
    43 		@param	aOffset	offset from start of file
       
    44 		@return	void
       
    45 	 */
       
    46 		void GetSampleOfTextFromFileL(TDes8& aSample, TInt aLength, TInt aOffset);
       
    47 		void ResetL();
       
    48 
       
    49 	private:
       
    50 		CHtmlToCrtConvBuffer(CCnvCharacterSetConverter& aCnvCharacterSetConverter);
       
    51 		void ConstructL(const TDesC& aFile, RFs& aFsSession);
       
    52 	/**
       
    53 		@fn		TBool FillBufferL()
       
    54 		Intended Usage	:	used to read characters from the file into the buffer 
       
    55 		@return	TBool EFalse if no characters read from file, else Etrue
       
    56 	 */
       
    57 		TBool FillBufferL();
       
    58 		void DoConvertBufferL(TPtr8& aSourcePtr, TPtr16& aUnicodePtr, TInt& aLength, TBool& aEndOfFile);
       
    59 
       
    60 	private:
       
    61 		CCnvCharacterSetConverter& iCnvCharacterSetConverter;
       
    62 		TInt iState;
       
    63 		RFile iFile;
       
    64 		HBufC8* iSourceBuffer;
       
    65 		HBufC16* iUnicodeBuffer;
       
    66 		TInt iBufferPosition;
       
    67 	};