Jump to content

UniQueryPrint

From EDM2
Revision as of 14:22, 3 November 2023 by Martini (talk | contribs) (Created page with "UniQueryPrint queries a Unicode character's printable-character (print) attribute. ==Syntax== UniQueryPrint (const LocaleObject locale_object, UniChar uc) ==Parameters== ;lo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UniQueryPrint queries a Unicode character's printable-character (print) attribute.

Syntax

UniQueryPrint (const LocaleObject locale_object, UniChar uc)

Parameters

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

Returns

Return value (int)
returns
0
The result of the test is false.
1
The result of the test is true.

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

Format call.

#include <unidef.h>

int UniQueryPrint (
    const LocaleObject locale_object,    /* I  - Locale object      */
    UniChar            uc                /* I  - Character to query */
)

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'd';    /* Unicode lowercase Latin letter d */

     /*****************************************************************/
     /* 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 = UniQueryPrint(locale_object, uni_char);
     if (result)
       printf("UniChar character %04X is a printable character\n", uni_char);
     else
       printf("UniChar character %04X is not a printable character\n", uni_char);

    return ULS_SUCCESS;
} 

Related Functions