TextEncoder Class Reference

Class that performs text character encoding. More...

List of all members.

Public Member Functions

virtual ~TextEncoder ()
 Destructor.
virtual int getBytesLen (const char *dec, int decLen)=0
 Gets the length of the encoded text (number of bytes).
virtual int getBytes (const char *dec, int decLen, char *enc, int encMaxLen)=0
 Gets the encoded text.

Static Public Member Functions

static int initialize ()
 Initializes the class.
static void finalize ()
 Finalizes the class.
static TextEncodercreate (const char *charset)
 Creates a TextEncoder instance.


Detailed Description

TextEncoder encodes Unicode into different character encodings.

For a discussion of text encoding and decoding in Hunny MIME++, please read the introductory section for TextDecoder.

See also:
TextDecoder

Member Function Documentation

TextEncoder * create ( const char *  charset  )  [static]

Creates a TextEncoder instance.

Parameters:
charset the character encoding identifier for the encoding
Returns:
a new TextEncoder instance

void finalize (  )  [static]

Finalizes the class.

You should not call this function. You may call mimepp::Finalize() just before your application exits, which calls TextEncoder::finalize() for you. However, unless your application checks for memory leaks, it is not necessary to call mimepp::Finalize().

int getBytes ( const char *  dec,
int  decLen,
char *  enc,
int  encMaxLen 
) [pure virtual]

Gets the encoded text.

This function encodes the decoded (UTF-8 Unicode) text in dec and writes the encoded text to the array that enc points to.

You may call getBytesLen() first to get the required array size for the encoded text.

Parameters:
dec pointer to the decoded text
decLen number of bytes in the decoded text
enc pointer to an array for the encoded text
encMaxLen the maximum number of bytes to write to the array
Returns:
number of bytes in the encoded text

int getBytesLen ( const char *  dec,
int  decLen 
) [pure virtual]

Gets the length of the encoded text (number of bytes).

You call this function first to find the length of the array required to contain the encoded text.

Parameters:
dec pointer to the decoded text
decLen number of bytes in the decoded text
Returns:
number of bytes in the encoded text

int initialize (  )  [static]

Initializes the class.

You should not call this function directly. Your application should call the mimepp::Initialize() function at start-up time, which calls TextEncoder::initialize() for you.

Copyright © 2001-2009 Hunny Software, Inc. All rights reserved.