Jump to content

UniQueryGraph: Difference between revisions

From EDM2
Created page with "UniQueryGraph queries character attributes. ==Syntax== int UniQueryGraph (const LocaleObject locale_object, UniChar uc) ==Parameters== ; locale_object (const LocaleObject..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 2: Line 2:


==Syntax==
==Syntax==
  int UniQueryGraph (const LocaleObject locale_object, UniChar uc)  
  UniQueryGraph (locale_object, uc)


==Parameters==
==Parameters==
; locale_object (const LocaleObject) : A locale object created by UniCreateLocaleObject or NULL.  
;locale_object (const [[LocaleObject]]):A locale object created by [[UniCreateLocaleObject]] or NULL.
;uc ([[UniChar]]) : The UniChar character to query.
; uc (UniChar) : The UniChar character to query.  


==Returns==
==Returns==
Return Value (int) - returns  
Return Value (int) - returns
   
 
If the result of the test is true, the function returns 1. Otherwise, 0 is returned.  
If the result of the test is true, the function returns 1. Otherwise, 0 is returned.


==Remarks==
==Remarks==
This function provides the functionality of UniCreateAttrObject, UniQueryCharAttr, and UniFreeAttrObject as an atomic operation for the invariant attributes.
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.
The locale may be specified as NULL to indicate default Unicode character attributes.
Line 50: Line 49:
}  
}  
</PRE>
</PRE>
===Format===
<PRE>
#include <unidef.h>


int UniQueryGraph
    (const LocaleObject locale_object, UniChar uc)
</PRE>
==Related Functions==
==Related Functions==
* [[UniQueryAttr]]
* [[UniQueryAttr]]

Latest revision as of 10:56, 16 August 2017

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