Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_TextEncoder Class Reference
[TextHandling]

Base class used with the CP_String class to provide conversion between Unicode and ASCII encodings. More...

Inheritance diagram for CP_TextEncoder:

CP_NoCopy CP_MacRomanTextEncoder CP_US_ASCIITextEncoder CP_UTF8TextEncoder CP_WindowsLatin1TextEncoder List of all members.

Getters

virtual UInt32 GetDestLength (const char *inSrcChars, UInt32 inSrcLength) const
virtual UInt32 GetDestLength (const CPUniChar *inSrcChars, UInt32 inSrcLength) const
virtual UInt32 GetEncodingType () const

Public Member Functions

Constructor / Destructor
 CP_TextEncoder (UInt32 inTextFormat, bool inUseCompositeChars=false)
 Constructor.
virtual ~CP_TextEncoder ()
 Destructor.
Cloning
virtual CP_TextEncoderClone () const =0

Protected Attributes

UInt32 fTextFormat
bool fUseCompositeCharacters
UInt32 fConvertToUTF16Flags
UInt32 fConvertFromUTF16Flags
const CPUniCharfEncoding
TextToUnicodeInfo fTextToUnicodeInfo
UnicodeToTextInfo fUnicodeToTextInfo

Detailed Description


Constructor & Destructor Documentation

CP_TextEncoder::CP_TextEncoder UInt32  inTextFormat,
bool  inUseCompositeChars = false
 

Constructor.

Parameters:
inTextFormat The format the incoming text is in.
inuseCompositeChars Flag used to indicate if composite characters are to be used in the conversion.
Exceptions:
none 

CP_TextEncoder::~CP_TextEncoder  )  [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

virtual CP_TextEncoder* CP_TextEncoder::Clone  )  const [pure virtual]
 

Implemented in CP_MacRomanTextEncoder, CP_WindowsLatin1TextEncoder, CP_US_ASCIITextEncoder, and CP_UTF8TextEncoder.

UInt32 CP_TextEncoder::ToUTF16 const char *  inSrcChars,
UInt32  inSrcLength,
CPUniChar inDestChars,
UInt32  inDestLength
const [virtual]
 

Converts the passed in string to UTF16 encoding.

Parameters:
inSrcChars The string to be converted.
inSrcLength Number of characters in source string to use.
inDestChars CPUniChar buffer to receive the result.
inDestLength Length of the buffer to place the results in. This is the maximum number of characters that will be copied. If the buffer is to SInt16 for the conversion, some characters will be lost.
Exceptions:
none 
Returns:
UInt32 The length of the converted string.

Reimplemented in CP_UTF8TextEncoder.

UInt32 CP_TextEncoder::FromUTF16 const CPUniChar inSrcChars,
UInt32  inSrcLength,
char *  inDestChars,
UInt32  inDestLength
const [virtual]
 

Converts the passed in string from UTF16 encoding to the encoders type.

Parameters:
inSrcChars The UTF16 string to be converted.
inSrcLength Number of characters in source string to use.
inDestChars char buffer to receive the result.
inDestLength Length of the buffer to place the results in. This is the maximum number of characters that will be copied. If the buffer is to SInt16 for the conversion, some characters will be lost.
Exceptions:
none 
Returns:
UInt32 The length of the converted string.

Reimplemented in CP_UTF8TextEncoder.

void CP_TextEncoder::SetConvertToUTF16Flags UInt32  inFlags = 0  ) 
 

Sets up the flags and various data members based on the passed in flags which are used to determine features and how errors are handled in the conversion.

Parameters:
inFlags Flags used to determine how the conversion takes place, and error handling.
Exceptions:
none 
Returns:
void

void CP_TextEncoder::SetConvertFromUTF16Flags UInt32  inFlags = 0  ) 
 

Sets up the flags and various data members based on the passed in flags which are used to determine features and how errors are handled in the conversion.

Parameters:
inFlags Flags used to determine how the conversion takes place, and error handling.
Exceptions:
none 
Returns:
void

UInt32 CP_TextEncoder::GetDestLength const char *  inSrcChars,
UInt32  inSrcLength
const [virtual]
 

Returns the approximate length that the converted passed in string will occupy. You can use this before converting the text to get an approximate size of the converted text to know how much memory to allocate for the buffer to hold the converted text. The returned length is only an approximation, as no actual conversion takes place.

Parameters:
inSrcChars Character string containing the characters to be converted.
inSrcLength The number of characters from the source buffer to convert.
Exceptions:
none 
Returns:
UInt32 The approximate length of the conversion.

Reimplemented in CP_UTF8TextEncoder.

UInt32 CP_TextEncoder::GetDestLength const CPUniChar inSrcChars,
UInt32  inSrcLength
const [virtual]
 

Returns the approximate length that the converted passed in string will occupy. You can use this before converting the text to get an approximate size of the converted text to know how much memory to allocate for the buffer to hold the converted text. The returned length is only an approximation, as no actual conversion takes place.

Parameters:
inSrcChars CPUniChar * string containing the characters to be converted.
inSrcLength The number of characters from the source buffer to convert.
Exceptions:
none 
Returns:
UInt32 The approximate length of the conversion.

virtual UInt32 CP_TextEncoder::GetEncodingType  )  const [virtual]
 

Reimplemented in CP_MacRomanTextEncoder, CP_WindowsLatin1TextEncoder, CP_US_ASCIITextEncoder, and CP_UTF8TextEncoder.

const CPUniChar* CP_TextEncoder::GetEncoding  )  const
 

Return the name of this encoder as a CPUniChar * string.

bool CP_TextEncoder::HasTextEncodingConverter  )  const [protected]
 

MacOS - Returns true if the MacOS system has a copy of the Text Encoding Converter installed.

Exceptions:
none 
Returns:
bool The Text Encoding Converter is installed.

SInt32 CP_TextEncoder::GetTECVersion  )  const [protected]
 

MacOS - Returns the version of the TextEncoding Converter installed on the MacOS.

Exceptions:
none 
Returns:
SInt32 The Text Encoding Converter installed.


Member Data Documentation

UInt32 CP_TextEncoder::fTextFormat [protected]
 

bool CP_TextEncoder::fUseCompositeCharacters [protected]
 

Format of the text.

UInt32 CP_TextEncoder::fConvertToUTF16Flags [protected]
 

Flag to indicate if we are using composite characters.

UInt32 CP_TextEncoder::fConvertFromUTF16Flags [protected]
 

Flag used in converting to UTF16.

const CPUniChar* CP_TextEncoder::fEncoding [protected]
 

Flag used in converting from UTF16.

TextToUnicodeInfo CP_TextEncoder::fTextToUnicodeInfo [mutable, protected]
 

The encoding being used, expressed as a CPUniChar *string.

UnicodeToTextInfo CP_TextEncoder::fUnicodeToTextInfo [mutable, protected]
 

TextToUnicode info structure used on the Mac.


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:22:13 2005 for CPLAT_MacOS by  doxygen 1.4.0