UniQueryGraph

From EDM2
Jump to: navigation, search

UniQueryGraph queries character attributes.

Syntax

UniQueryGraph (locale_object, uc)

Parameters

locale_object (const LocaleObject)
A locale object created by UniCreateLocaleObject or NULL.
uc (UniChar
The UniChar character to query.

Returns

Return Value (int) - returns

If the result of the test is true, the function returns 1. Otherwise, 0 is returned.

Remarks

This function provides the functionality of UniCreateAttrObject, UniQueryCharAttr, and UniFreeAttrObject as an atomic operation for the invariant attributes.

The locale may be specified as NULL to indicate default Unicode character attributes.

Example

This example shows how to query character attributes.

#include <stdio.h>

#include <unidef.h>
int main(void) {
LocaleObject locale_object = NULL;
int          result = 0;
int          rc = ULS_SUCCESS;
UniChar      uni_char = L'S';    /* Unicode Latin uppercase letter S */
         /*****************************************************************/
         /* Assumes LANG environment variable set to a valid locale name, */
         /* such as fr_FR                                                 */
         /*****************************************************************/
         rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
                                   (UniChar *)L"", &locale_object);
         if (rc != ULS_SUCCESS) {
           printf("UniCreateLocaleObject error: return code = %u\n", rc);
           return 1;
         }
         /* Query character attribute */
         result = UniQueryGraph(locale_object, uni_char);
         if (result)
           printf("UniChar character %04X is a graphic character\n", uni_char);
         else
           printf("UniChar character %04X is not a graphic character\n", uni_char);

return ULS_SUCCESS;
} 

Related Functions