All Frameworks Class Hierarchy This Framework Previous Next Indexes
System Class CATUnicodeChar
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 CATChar 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
CATUnicodeString for precisions.
Note: You will find also below some references to the SBCS and MBCS acronym, see
CATUnicodeString for precisions.
CAUTION: The methods manipulating the "char" type of the C language (or "char*", see
CATUnicodeChar.BuildFromChar ) should rarely be used. They may be used:
- combined with the use of Unix MOTIF services
- to display debug traces on the stdout
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
CATUnicodeChar.BuildFromChar 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,
CATUnicodeChar.BuildFromChar will behave the following way:
- if the General\"Settings for the current user" field in the "Control Panel"\"Regional Options" window is set to
English, the built CATUnicodeChar will contain the "PLUS-MINUS SIGN" character
- if it set on Japanese, the built CATUnicodeChar will contain the "HALFWIDTH KATAKANA LETTER A" character:
the B1 code belongs to the range of one-byte code representations
- if it set on Korean, the built CATUnicodeChar will contain the "QUESTION MARK" character, which is the default
character. Actually, the B1 code belongs to the range of two-bytes code representations
Constructor and Destructor Index
- o
CATUnicodeChar()
- Constructs an empty Unicode character instance.
- o
CATUnicodeChar(CATUnicodeChar&)
- Copy constructor.
- o
CATUnicodeChar(char)
- Constructs a CATUnicodeChar instance from a byte.
- 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=(CATUnicodeChar&)
- Assignment operator from a CATUnicodeChar instance.
- o
operator=(char)
- Assignment operator from a byte.
- o
operator=(char*)
- Assignment operator from a character in a localized encoding.
Constructor and Destructor
o CATUnicodeChar
-
Constructs an empty Unicode character instance.
o CATUnicodeChar
-
Copy constructor.
- Parameters:
-
- iChar
- The Unicode character to copy
o CATUnicodeChar
public CATUnicodeChar( | const char | 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
-
Methods
o BuildFromChar
public int BuildFromChar( | const char* | 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 void BuildFromUC2Bytes( | const CATUC2Bytes& | iCharacter) |
-
Builds a character from a CATUC2Bytes.
- Parameters:
-
- iCharacter
- The CATUC2Bytes character.
o ConvertToChar
public const char * ConvertToChar( | )const |
-
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
-
Converts the current character into a CATUC2Bytes.
- Returns:
- The CATUC2Bytes character.
o IsAlnum
public int IsAlnum( | )const |
-
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 int IsAlpha( | )const |
-
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 int IsCntrl( | )const |
-
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 int IsDigit( | )const |
-
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 int IsGraph( | )const |
-
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 int IsLower( | )const |
-
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 int IsPrint( | )const |
-
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 int IsPunct( | )const |
-
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 int IsSpace( | )const |
-
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 int IsUpper( | )const |
-
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 int IsXDigit( | )const |
-
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
-
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 !=
-
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 >
-
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 >=
-
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 <
-
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 <=
-
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 ==
-
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( | )const |
-
Cast to char.
- Returns:
- The character
o operator=
-
Assignment operator from a CATUnicodeChar instance.
- Parameters:
-
- iCharacter
- The provided character
o operator=
-
Assignment operator from a byte.
Role: This operator assigns a byte to the current instance. This operator supposes:
- the thread code page is a SBCS code page
- iByte corresponds to a coded representation in the thread 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 operator=
-
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.
This object is included in the file: CATUnicodeChar.h
If needed, your Imakefile.mk should include the module: JS0GROUP