lowlevellibsandfws/apputils/inc/BADICTIONARYCOMPRESSION.H
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 #if !defined(__E32STD_H__)
       
    17 #include <e32std.h>
       
    18 #endif
       
    19 
       
    20 #if !defined(__BADICTIONARYCOMPRESSION_H__)
       
    21 #define __BADICTIONARYCOMPRESSION_H__
       
    22 
       
    23 #include "BaAssert.h"
       
    24 
       
    25 /**
       
    26 This class implements a stream of bits (least significant bit first) as used by the code reading dictionary-compressed resource-files
       
    27 @internalComponent
       
    28 */
       
    29 class RDictionaryCompressionBitStream
       
    30 	{
       
    31 public:
       
    32 	RDictionaryCompressionBitStream();
       
    33 	void OpenL(
       
    34 		TInt aNumberOfBitsUsedForDictionaryTokens,
       
    35 		TInt aOffsetToFirstBit,
       
    36 		TInt aOffsetOnePastLastBit,
       
    37 		TBool aTransferringOwnershipOfBuffer,
       
    38 		TUint8* aBuffer,
       
    39 		const TBaAssert& aAssertObj);
       
    40 	void Close();
       
    41 	TBool EndOfStreamL() const;
       
    42 	TInt IndexOfDictionaryEntryL(); // increments the current bit-position if it returns a value >=0; returns a negative value if the next thing in the stream is plain data rather than the index of a dictionary entry
       
    43  	void ReadL(TDes8& aBufferToAppendTo,TBool aCalypsoFileFormat); // can only be called if IndexOfDictionaryEntry returned a negative value
       
    44 private:
       
    45 	TBool CurrentBitIsOn() const; // does not increment the current bit-position
       
    46 	TUint ReadIntegerL(TInt aNumberOfBits); // increments the current bit-position
       
    47 private:
       
    48 	TInt iNumberOfBitsUsedForDictionaryTokens;
       
    49 	TInt iOffsetToFirstBit;
       
    50 	TInt iOffsetToCurrentBit;
       
    51 	TInt iOffsetOnePastLastBit;
       
    52 	TBool iOwnsBitBuffer;
       
    53 	TUint8* iBuffer;
       
    54 	TBaAssert iAssertObj;
       
    55 	};
       
    56 
       
    57 #endif
       
    58