System CATUnicodeChar

Usage: you must use this class as is. You should never derive it.


public class CATUnicodeChar

Class to use for language meaningful character.
Role: CATUnicodeChar can be used whenever a character is needed, and that is either seen, entered, or manipulated by the end user. In this way, the client application is shielded from implementation details regarding language, locale, bytecoding of characters, and so forth. Client applications thus become portable since they can handle character strings expressed in any language.

When NLS support is not required, you can use instead the class from the System framework. It does support only ISO 646, so that to supress all the problems that arise with NLS complexity. You should never use the raw char type.

Note: Among the methods to manipulate instances of this class, you will find below some references to the Unicode and UTF-8 standards. See for precisions.

Note: You will find also below some references to the SBCS and MBCS acronym, see for precisions.

CAUTION: The methods manipulating the "char" type of the C language (or "char*", see ) should rarely be used. They may be used:

The best way to manipulate strings is to use the Unicode encoding, the "char" type of the C language has many limitations.
Suppose, for example, you call on Windows, and, during the execution, the given "char*" contains one byte, B1 in hexa, followed by the NULL byte which ends the string. Then, will behave the following way:


Constructor and Destructor Index


o CATUnicodeChar()
Constructs an empty Unicode character instance.
o CATUnicodeChar(char)
Constructs a CATUnicodeChar instance from a byte.
o CATUnicodeChar(CATUnicodeChar&)
Copy constructor.
o ~CATUnicodeChar()

Method Index


o BuildFromChar(char*)
Builds a CATUnicodeChar instance from a character in a localized encoding.
o BuildFromUC2Bytes(CATUC2Bytes&)
Builds a character from a CATUC2Bytes.
o ConvertToChar()
Converts the current character into a character in the thread locale localized encoding.
o ConvertToUC2Bytes()
Converts the current character into a CATUC2Bytes.
o IsAlnum()
Determines if the current character is an alphanumeric character.
o IsAlpha()
Determines if the current character is an alphabetic character.
o IsCntrl()
Determines if the current character is a control character.
o IsDigit()
Determines if the current character is a digit character.
o IsGraph()
Determines if the current character is a graphic character for printing.
o IsLower()
Determines if the current character is a lowercase character.
o IsPrint()
Determines if the current character is a print character.
o IsPunct()
Determines if the current character is a punctuation character.
o IsSpace()
Determines if the current character is a space character.
o IsUpper()
Determines if the current character is a uppercase character.
o IsXDigit()
Determines if the current character is a hexadecimal digit character.
o ToLower()
Converts the current character, supposed to be a upper case one to lower case.
o ToUpper()
Converts the current character, supposed to be a lower case one to upper case.
o operator !=(CATUnicodeChar&)
Inequality operator.
o operator >(CATUnicodeChar&)
Greater-than operator.
o operator >=(CATUnicodeChar&)
Greater-than or equal operator.
o operator <(CATUnicodeChar&)
Less-than operator.
o operator <=(CATUnicodeChar&)
Less-than or equal operator.
o operator ==(CATUnicodeChar&)
Equality operator.
o operator char()
Cast to char.
o operator=(char)
Assignment operator from a byte.
o operator=(char*)
Assignment operator from a character in a localized encoding.
o operator=(CATUnicodeChar&)
Assignment operator from a CATUnicodeChar instance.

Constructor and Destructor


o CATUnicodeChar
public CATUnicodeChar()
Constructs an empty Unicode character instance.
o CATUnicodeChar
public CATUnicodeChar( const iByte)
Constructs a CATUnicodeChar instance from a byte.
Role: Constructs a CATUnicodeChar instance from a byte, supposing the thread code page is a SBCS code page. If, in the thread code page, the given byte does not correspond to any character coded representation, the instance will be filled with the default character (QUESTION MARK).
CAUTION: This method, which manipulates the "char" type of the C language should rarely be used (see above).
Parameters:
iByte
The byte, corresponding to a coded representation in the thread code page.
o CATUnicodeChar
public CATUnicodeChar( const iChar)
Copy constructor.
Parameters:
iChar
The Unicode character to copy
o ~CATUnicodeChar
public ~CATUnicodeChar()

Methods


o BuildFromChar
public BuildFromChar( const iCodedRepresentation)
Builds a CATUnicodeChar instance from a character in a localized encoding.
Role: Builds a CATUnicodeChar instance from a character in a localized encoding. The character code page, which must be equal to the thread code page, may be either a SBCS or a MBCS code page. If, in the thread code page, the given byte(s) do(es) not correspond to any character coded representation, the instance will be filled with the default character (QUESTION MARK).
CAUTION: This method, which manipulates the "char*" type of the C language should rarely be used (see above).
Parameters:
iCodedRepresentation
Character in the thread locale localized encoding.
o BuildFromUC2Bytes
public BuildFromUC2Bytes( const iCharacter)
Builds a character from a CATUC2Bytes.
Parameters:
iCharacter
The CATUC2Bytes character.
o ConvertToChar
public ConvertToChar()
Converts the current character into a character in the thread locale localized encoding.
Role: Converts the current character into a character in the thread locale localized encoding. The character must belong the character set of the thread locale code page. If the character does not belong to the character set of the thread locale code page, the default character coded representation is returned.
CAUTION: This method, which manipulates the "char*" type of the C language should rarely be used (see above).
Returns:
Character in the thread locale localized encoding.
o ConvertToUC2Bytes
public ConvertToUC2Bytes()
Converts the current character into a CATUC2Bytes.
Returns:
The CATUC2Bytes character.
o IsAlnum
public IsAlnum()
Determines if the current character is an alphanumeric character.
Role: Determines if the current character is an alphanumeric character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is an alphanumeric character, or 0: No otherwise.
o IsAlpha
public IsAlpha()
Determines if the current character is an alphabetic character.
Role: Determines if the current character is an alphabetic character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is an alphabetic character, or 0: No otherwise.
o IsCntrl
public IsCntrl()
Determines if the current character is a control character.
Role: Determines if the current character is a control character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a control character, or 0: No otherwise.
o IsDigit
public IsDigit()
Determines if the current character is a digit character.
Role: Determines if the current character is a digit character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a digit character, or 0: No otherwise.
o IsGraph
public IsGraph()
Determines if the current character is a graphic character for printing.
Role: Determines if the current character is a graphic character for printing. A graphic character is a character which is neither the space character nor a control character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a graphic character for printing, or 0: No otherwise.
o IsLower
public IsLower()
Determines if the current character is a lowercase character.
Role: Determines if the current character is a lowercase character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a lowercase character, or 0: No otherwise.
o IsPrint
public IsPrint()
Determines if the current character is a print character.
Role: Determines if the current character is a print character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a print character, or 0: No otherwise.
o IsPunct
public IsPunct()
Determines if the current character is a punctuation character.
Role: Determines if the current character is a punctuation character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a punctuation character, or 0: No otherwise.
o IsSpace
public IsSpace()
Determines if the current character is a space character.
Role: Determines if the current character is a space character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a space character, or 0: No otherwise.
o IsUpper
public IsUpper()
Determines if the current character is a uppercase character.
Role: Determines if the current character is a uppercase character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a uppercase character, or 0: No otherwise.
o IsXDigit
public IsXDigit()
Determines if the current character is a hexadecimal digit character.
Role: Determines if the current character is a hexadecimal digit character. This service takes into account the current locale.
Returns:
boolean
Legal values: 1: Yes if the current character is a hexadecimal digit character, or 0: No otherwise.
o ToLower
public ToLower()
Converts the current character, supposed to be a upper case one to lower case.
o ToUpper
public ToUpper()
Converts the current character, supposed to be a lower case one to upper case.
o operator !=
public operator !=( const iCharacter)
Inequality operator.
Parameters:
iCharacter
The character to compare to the current one
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator >
public operator >( const iCharacter)
Greater-than operator. For the comparison, the current locale is taken into account.
Parameters:
iCharacter
The character to compare to the current one
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator >=
public operator >=( const iCharacter)
Greater-than or equal operator. For the comparison, the current locale is taken into account.
Parameters:
iCharacter
The character to compare to the current one
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator <
public operator <( const iCharacter)
Less-than operator. For the comparison, the current locale is taken into account. This service calls the C strcoll service, which, for the comparison, compares collation weights computed for each character.
Parameters:
iCharacter
The character to compare to the current one
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator <=
public operator <=( const iCharacter)
Less-than or equal operator. For the comparison, the current locale is taken into account.
Parameters:
iCharacter
The character to compare to the current one
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator ==
public operator ==( const iCharacter)
Equality operator.
Parameters:
iCharacter
The character to compare to the current one
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator char
public operator char()
Cast to char.
Returns:
The character
o operator=
public operator=( const iByte)
Assignment operator from a byte.
Role: This operator assigns a byte to the current instance. This operator supposes: If, in the thread code page,the given byte does not correspond to any character coded representation, the instance will be filled with the default character (QUESTION MARK).
CAUTION: This method, which manipulates the "char" type of the C language should rarely be used (see above).
Parameters:
iByte
The byte, corresponding to a coded representation in the thread code page.
o operator=
public operator=( const iCodedRepresentation)
Assignment operator from a character in a localized encoding.
Role: Assigns a coded representation, supposed to belong to the thread code page, to the current instance. If, in the thread code page, the given byte(s) do(es) not correspond to any character coded representation, the instance will be filled with the default character (QUESTION MARK).
CAUTION: This method, which manipulates the "char*" type of the C language should rarely be used (see above).
Parameters:
iCodedRepresentation
Character in the thread locale localized encoding.
o operator=
public operator=( const iCharacter)
Assignment operator from a CATUnicodeChar instance.
Parameters:
iCharacter
The provided character

This object is included in the file: CATUnicodeChar.h
If needed, your Imakefile.mk should include the module: CATSysTS

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.