UniQueryCharType
Appearance
UniQueryCharType is used to query the type of the character.
Syntax
UNICTYPE * UniQueryCharType (UniChar uc)
Parameters
- uc (UniChar)
- The Unicode character whose type will be queried.
Returns
A pointer to a structure of type UNICTYPE is returned from this call.
Remarks
UniQueryCharType is designed to provide information to support both the XPG/4 character type as well as the Win32 GetCharType type. Where the function is similar, this API is designed to be a superset of the Win32 function so that the Win32 functions can be supported by masking off bits in the returned data structure. GetCharType is similar to the C library "is" functions.
The UNICTYPE structure contains character set information, information regarding Bidirectional attributes, information regarding XPG/4 attributes and information on extended attributes.
Example
This example shows how to query a character type.
#include <stdio.h>
#include <unidef.h>
int main(void) {
UNICTYPE * uct;
UniChar uni_char = 0x3456; /* Some random Unicode character */
/* Query the character type */
uct = UniQueryCharType(uni_char);
/* Examine the returned structure to determine information about
* the character. For example, what is its BiDi orientation and
* is the character Arabic or Hebrew?
*/
if (uct->bidi==C2_RIGHTTOLEFT)
printf("Character is presented right to left\n");
else
printf("Character is presented left to right\n");
if (uct->charset==CHS_ARABIC)
printf("Character is Arabic\n");
else if (uct->charset==CHS_HEBREW)
printf("Character is Hebrew\n");
else
printf("Character is not Arabic or Hebrew\n");
return ULS_SUCCESS;
}
Format
#include <unidef.h>
UNICTYPE * UniQueryCharType (
UniChar uc /* I - Character to query */
)