TUnicodeCompressor Class Reference

class TUnicodeCompressor : public TUnicodeCompressionState

A class to hold functions to compress text using the Standard Compression Scheme for Unicode.

A note on error handling and leaving.

Although all the public functions except the constructor can leave, it is possible to guarantee success: that is, guarantee that a call will not leave, and that compression will be completed. To do this, (i) supply a MUnicodeSource object with a non-leaving ReadUnicodeValueL function, such as a TMemoryUnicodeSource ; (ii) write output to a RWriteStream with a non-leaving WriteL function, or to a buffer that you already know to be big enough, which can be found out using CompressedSizeL.

This guarantee of success is particularly useful when compressing from one memory buffer to another.

Inherits from

Nested Classes and Structures

Public Member Functions
TUnicodeCompressor ()
IMPORT_C void CompressL ( RWriteStream &, MUnicodeSource &, TInt , TInt , TInt *, TInt *)
IMPORT_C void CompressL ( TUint8 *, MUnicodeSource &, TInt , TInt , TInt *, TInt *)
IMPORT_C TInt CompressedSizeL ( MUnicodeSource &, TInt )
IMPORT_C TInt FlushL ( RWriteStream &, TInt , TInt &)
IMPORT_C TInt FlushL ( TUint8 *, TInt , TInt &)
Private Member Functions
void DoCompressL ( RWriteStream *, TUint8 *, MUnicodeSource *, TInt , TInt , TInt *, TInt *)
void FlushInputBufferL ()
void FlushOutputBufferL ()
void SelectTreatment ( TInt )
void WriteByte ( TUint )
void WriteCharacter (const TAction &)
void WriteCharacterFromBuffer ()
void WriteRunL ()
void WriteSCharacter (const TAction &)
void WriteUCharacter ( TUint16 )
Inherited Functions
TUnicodeCompressionState::DynamicWindowBase(TInt)
TUnicodeCompressionState::DynamicWindowOffsetIndex(TUint16)
TUnicodeCompressionState::EncodeAsIs(TUint16)
TUnicodeCompressionState::Panic(TPanic)
TUnicodeCompressionState::Reset()
TUnicodeCompressionState::StaticWindowIndex(TUint16)
TUnicodeCompressionState::TUnicodeCompressionState()
Private Member Enumerations
enum anonymous { EMaxInputBufferSize  = 4, EMaxOutputBufferSize  = EMaxInputBufferSize * 3 }
Inherited Enumerations
TUnicodeCompressionState:@47
TUnicodeCompressionState:TPanic
Private Attributes
TInt iDynamicWindowIndex
MUnicodeSource * iInput
TAction iInputBuffer
TInt iInputBufferSize
TInt iInputBufferStart
TUint8 iOutputBuffer
TInt iOutputBufferSize
TInt iOutputBufferStart
TUint8 * iOutputPointer
RWriteStream * iOutputStream
Inherited Attributes
TUnicodeCompressionState::iActiveWindowBase
TUnicodeCompressionState::iCompressedBytes
TUnicodeCompressionState::iDynamicWindow
TUnicodeCompressionState::iDynamicWindowDefault
TUnicodeCompressionState::iMaxCompressedBytes
TUnicodeCompressionState::iMaxUnicodeWords
TUnicodeCompressionState::iSpecialBase
TUnicodeCompressionState::iStaticWindow
TUnicodeCompressionState::iUnicodeMode
TUnicodeCompressionState::iUnicodeWords

Constructor & Destructor Documentation

TUnicodeCompressor()

IMPORT_C TUnicodeCompressor ( )

Member Functions Documentation

CompressL(RWriteStream &, MUnicodeSource &, TInt, TInt, TInt *, TInt *)

IMPORT_C void CompressL ( RWriteStream & aOutput,
MUnicodeSource & aInput,
TInt aMaxOutputBytes =  KMaxTInt ,
TInt aMaxInputWords =  KMaxTInt ,
TInt * aOutputBytes = NULL,
TInt * aInputWords = NULL
)

Parameters

RWriteStream & aOutput
MUnicodeSource & aInput
TInt aMaxOutputBytes =  KMaxTInt
TInt aMaxInputWords =  KMaxTInt
TInt * aOutputBytes = NULL
TInt * aInputWords = NULL

CompressL(TUint8 *, MUnicodeSource &, TInt, TInt, TInt *, TInt *)

IMPORT_C void CompressL ( TUint8 * aOutput,
MUnicodeSource & aInput,
TInt aMaxOutputBytes =  KMaxTInt ,
TInt aMaxInputWords =  KMaxTInt ,
TInt * aOutputBytes = NULL,
TInt * aInputWords = NULL
)

Parameters

TUint8 * aOutput
MUnicodeSource & aInput
TInt aMaxOutputBytes =  KMaxTInt
TInt aMaxInputWords =  KMaxTInt
TInt * aOutputBytes = NULL
TInt * aInputWords = NULL

CompressedSizeL(MUnicodeSource &, TInt)

IMPORT_C TInt CompressedSizeL ( MUnicodeSource & aInput,
TInt aInputWords
) [static]

Parameters

MUnicodeSource & aInput
TInt aInputWords

DoCompressL(RWriteStream *, TUint8 *, MUnicodeSource *, TInt, TInt, TInt *, TInt *)

void DoCompressL ( RWriteStream * aOutputStream,
TUint8 * aOutputPointer,
MUnicodeSource * aInput,
TInt aMaxCompressedBytes,
TInt aMaxUnicodeWords,
TInt * aCompressedBytes,
TInt * aUnicodeWords
) [private]

Parameters

RWriteStream * aOutputStream
TUint8 * aOutputPointer
MUnicodeSource * aInput
TInt aMaxCompressedBytes
TInt aMaxUnicodeWords
TInt * aCompressedBytes
TInt * aUnicodeWords

FlushInputBufferL()

void FlushInputBufferL ( ) [private]

FlushL(RWriteStream &, TInt, TInt &)

IMPORT_C TInt FlushL ( RWriteStream & aOutput,
TInt aMaxOutputBytes,
TInt & aOutputBytes
)

Parameters

RWriteStream & aOutput
TInt aMaxOutputBytes
TInt & aOutputBytes

FlushL(TUint8 *, TInt, TInt &)

IMPORT_C TInt FlushL ( TUint8 * aOutput,
TInt aMaxOutputBytes,
TInt & aOutputBytes
)

Parameters

TUint8 * aOutput
TInt aMaxOutputBytes
TInt & aOutputBytes

FlushOutputBufferL()

void FlushOutputBufferL ( ) [private]

SelectTreatment(TInt)

void SelectTreatment ( TInt aTreatment ) [private]

Parameters

TInt aTreatment

WriteByte(TUint)

void WriteByte ( TUint aByte ) [private]

Parameters

TUint aByte

WriteCharacter(const TAction &)

void WriteCharacter ( const TAction & aAction ) [private]

Parameters

const TAction & aAction

WriteCharacterFromBuffer()

void WriteCharacterFromBuffer ( ) [private]

WriteRunL()

void WriteRunL ( ) [private]

WriteSCharacter(const TAction &)

void WriteSCharacter ( const TAction & aAction ) [private]

Parameters

const TAction & aAction

WriteUCharacter(TUint16)

void WriteUCharacter ( TUint16 aCode ) [private]

Parameters

TUint16 aCode

Member Enumerations Documentation

Enum anonymous

Enumerators

EMaxInputBufferSize = 4
EMaxOutputBufferSize = EMaxInputBufferSize * 3

Member Data Documentation

TInt iDynamicWindowIndex

TInt iDynamicWindowIndex [private]

MUnicodeSource * iInput

MUnicodeSource * iInput [private]

TAction iInputBuffer

TAction iInputBuffer [private]

TInt iInputBufferSize

TInt iInputBufferSize [private]

TInt iInputBufferStart

TInt iInputBufferStart [private]

TUint8 iOutputBuffer

TUint8 iOutputBuffer [private]

TInt iOutputBufferSize

TInt iOutputBufferSize [private]

TInt iOutputBufferStart

TInt iOutputBufferStart [private]

TUint8 * iOutputPointer

TUint8 * iOutputPointer [private]

RWriteStream * iOutputStream

RWriteStream * iOutputStream [private]