Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TextCodec Class Reference

A simple class for character sets conversion. More...

#include <textcodec.h>

List of all members.

Public Methods

virtual bool isAbleToConvert (Encodings::MIB mib)
 Is the codec able to convert specified encoding? More...

virtual void fillInMapArray (XmlEncoding *info, Encodings::MIB mib)
 Fill in the expat encoding structure. More...

virtual int convert (const char *s, Encodings::MIB mib)
 Convert given char to gven encoding. More...

virtual void release (Encodings::MIB mib)
 Release function called by expat. More...

virtual Encodings::MIB getMIB (const XmlChar *encoding) throw (ExaltUnknownEncodingException)
 Get the MIB of the encoding. More...

virtual bool knowsMIB (Encodings::MIB mib)
 Does the codec know the encoding? More...

virtual unsigned long suggestAlphabetBaseSize (Encodings::MIB mib) throw (ExaltUnknownEncodingException)
 Suggest suitable alphabet size for given encoding. More...

virtual void output (IODevice *device, XmlChar c, Encodings::MIB toEncoding) throw (ExaltEncodingException, ExaltIOException)
 Output a char converted to given encoding. More...

virtual void output (IODevice *device, const XmlChar *str, Encodings::MIB toEncoding) throw (ExaltEncodingException, ExaltIOException)
 Output a string converted to given encoding. More...

virtual void output (IODevice *device, const XmlChar *str, size_t length, Encodings::MIB toEncoding) throw (ExaltEncodingException, ExaltIOException)
 Output a string of given length converted to given encoding. More...


Detailed Description

A simple class for character sets conversion.

The functionality of the codec if rather basic, but it offers an unified interface for character sets conversions.

Definition at line 53 of file textcodec.h.


Member Function Documentation

int TextCodec::convert const char *    s,
Encodings::MIB    mib
[inline, virtual]
 

Convert given char to gven encoding.

Converts a char to given encoding.

Parameters:
s  Pointer to the character.
mib  The MIB of the encoding.
Returns:
The converted value of the character.

Definition at line 232 of file textcodec.cpp.

void TextCodec::fillInMapArray XmlEncoding *    info,
Encodings::MIB    mib
[virtual]
 

Fill in the expat encoding structure.

This method fills in the Expat's info structure (see the Expat documentation) according to the given MIB.

Parameters:
info  Pointer to the Expat info structure.
mib  The MIB of the encoding.

Definition at line 190 of file textcodec.cpp.

References EXPAT_MAP_SINGLE_BYTE_ENCODING_TO_UTF8, and XmlEncoding.

Referenced by XmlParser::unknownEncoding.

Encodings::MIB TextCodec::getMIB const XmlChar *    encoding throw (ExaltUnknownEncodingException) [virtual]
 

Get the MIB of the encoding.

Returns the MIB of the encoding that was specified by its name.

Parameters:
encoding  The name of the encoding.
Returns:
The MIB of the encoding.

Definition at line 296 of file textcodec.cpp.

References ENCODING_MIB, ERR, and XmlChar.

Referenced by XmlSimpleModel::manageEvent, XmlAdaptiveModel::manageEvent, and XmlParser::unknownEncoding.

bool TextCodec::isAbleToConvert Encodings::MIB    mib [virtual]
 

Is the codec able to convert specified encoding?

Parameters:
mib  The MIB of the encoding.
Return values:
TRUE  The text codec is able to convert to the encoding.
FALSE  The text codec is not able to convert to the encoding.

Definition at line 165 of file textcodec.cpp.

Referenced by XmlParser::unknownEncoding.

bool TextCodec::knowsMIB Encodings::MIB    mib [virtual]
 

Does the codec know the encoding?

This method tests whether the text codec knows given encoding.

Note:
If the text codec knows an the encoding, it doesn't mean that it is also able to covert to/from it!
Parameters:
mib  The MIB of the encoding.
Return values:
TRUE  The text codec knows the encoding.
FALSE  The text codec doesn't know the encoding.

Definition at line 271 of file textcodec.cpp.

References ENCODING_NAMES, Encodings::EncodingName::mib, and Encodings::EncodingName::name.

void TextCodec::output IODevice   device,
const XmlChar *    str,
size_t    length,
Encodings::MIB    toEncoding
throw (ExaltEncodingException, ExaltIOException) [inline, virtual]
 

Output a string of given length converted to given encoding.

Sends a string of specified length converted to given encoding to the output device.

Parameters:
device  Input device.
str  A string.
length  The length of the string.
toEncoding  Output encoding.

Definition at line 409 of file textcodec.cpp.

References ERR, and XmlChar.

void TextCodec::output IODevice   device,
const XmlChar *    str,
Encodings::MIB    toEncoding
throw (ExaltEncodingException, ExaltIOException) [inline, virtual]
 

Output a string converted to given encoding.

Sends a string converted to given encoding to the output device.

Parameters:
device  Input device.
str  A string.
toEncoding  Output encoding.

Definition at line 382 of file textcodec.cpp.

References ERR, and XmlChar.

void TextCodec::output IODevice   device,
XmlChar    c,
Encodings::MIB    toEncoding
throw (ExaltEncodingException, ExaltIOException) [inline, virtual]
 

Output a char converted to given encoding.

Sends a character converted to given encoding to the output device.

Parameters:
device  Input device.
c  A character.
toEncoding  Output encoding.

Definition at line 357 of file textcodec.cpp.

References ERR, and XmlChar.

void TextCodec::release Encodings::MIB    mib [inline, virtual]
 

Release function called by expat.

This function gets called by Expat after performing the conversion. Here it does nothing.

Parameters:
mib  The MIB of the encoding.

Definition at line 254 of file textcodec.cpp.

unsigned long TextCodec::suggestAlphabetBaseSize Encodings::MIB    mib throw (ExaltUnknownEncodingException) [inline, virtual]
 

Suggest suitable alphabet size for given encoding.

Parameters:
mib  The MIB of the encoding.
Returns:
The base size of the alphabet.

Definition at line 145 of file textcodec.cpp.

References DEFAULT_ALPHABET_BASE_SIZE, and ENCODING_SIZE.

Referenced by KYGrammar::appendToRootRule, XmlSimpleModel::manageEvent, and XmlAdaptiveModel::manageEvent.


The documentation for this class was generated from the following files:
Generated on Wed Feb 5 10:43:06 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002