secureswitools/swisistools/source/rscparser/dictionarycompression.h
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 // Copyright (c) 2010 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 // dictionarycompression.h
       
    15 //
       
    16 /** 
       
    17 * @file dictionarycompression.h
       
    18 *
       
    19 * @internalComponent
       
    20 * @released
       
    21 */
       
    22 #if !defined(__DICTIONARYCOMPRESSION_H__)
       
    23 #define __DICTIONARYCOMPRESSION_H__
       
    24 
       
    25 #include <string>
       
    26 #include "commontypes.h"
       
    27 #include <cassert>
       
    28 
       
    29 /**
       
    30 This class implements a stream of bits (least significant bit first) as used by the code reading dictionary-compressed resource-files
       
    31 @internalComponent
       
    32 */
       
    33 class RDictionaryCompressionBitStream
       
    34 	{
       
    35 public:
       
    36 	RDictionaryCompressionBitStream();
       
    37 	void OpenL(
       
    38 		TInt aNumberOfBitsUsedForDictionaryTokens,
       
    39 		TInt aOffsetToFirstBit,
       
    40 		TInt aOffsetOnePastLastBit,
       
    41 		TBool aTransferringOwnershipOfBuffer,
       
    42 		TUint8* aBuffer);
       
    43 	void Close();
       
    44 	TBool EndOfStreamL() const;
       
    45 	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
       
    46  	void ReadL(Ptr8 aBufferToAppendTo,TBool aCalypsoFileFormat); // can only be called if IndexOfDictionaryEntry returned a negative value
       
    47 private:
       
    48 	TBool CurrentBitIsOn() const; // does not increment the current bit-position
       
    49 	TUint ReadIntegerL(TInt aNumberOfBits); // increments the current bit-position
       
    50 private:
       
    51 	TInt iNumberOfBitsUsedForDictionaryTokens;
       
    52 	TInt iOffsetToFirstBit;
       
    53 	TInt iOffsetToCurrentBit;
       
    54 	TInt iOffsetOnePastLastBit;
       
    55 	TBool iOwnsBitBuffer;
       
    56 	TUint8* iBuffer;
       
    57 	};
       
    58 
       
    59 #endif
       
    60