UniQueryCharAttr: Difference between revisions
Appearance
Created page with "UniQueryCharAttr queries the attributes of a character. ==Syntax== int UniQueryCharAttr (AttrObject attr_object, UniChar uc ); ==Parameters== ; attr_object (AttrObject) ..." |
mNo edit summary |
||
Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
UniQueryCharAttr (attr_object, UniChar) | |||
==Parameters== | ==Parameters== | ||
; attr_object | ;attr_object (AttrObject): An attribute object created by [[UniCreateAttrObject]]. | ||
; uc | ;uc (UniChar): The Unicode character whose attributes will be queried. | ||
==Returns== | ==Returns== | ||
Return value | Return value (int) - returns | ||
; 1 : The result of the test is true (the code element has the attribute associated with the attribute object, attr_object). | ;1 : The result of the test is true (the code element has the attribute associated with the attribute object, attr_object). | ||
; 0 : The result of the test is false. | ;0 : The result of the test is false. | ||
==Remarks== | ==Remarks== | ||
UniQueryCharAttr determines whether the code element uc has the attributes specified by the attribute object argument, attr_object. | UniQueryCharAttr determines whether the code element uc has the attributes specified by the attribute object argument, attr_object. | ||
Line 59: | Line 58: | ||
return ULS_SUCCESS; | return ULS_SUCCESS; | ||
} | } | ||
</PRE> | </PRE> | ||
Line 74: | Line 63: | ||
* [[UniQueryAttr]] | * [[UniQueryAttr]] | ||
* [[UniQueryChar]] | * [[UniQueryChar]] | ||
* [[UniQueryCharType]] | * [[UniQueryCharType]] | ||
[[Category:Uni]] | [[Category:Uni]] |
Latest revision as of 10:59, 16 August 2017
UniQueryCharAttr queries the attributes of a character.
Syntax
UniQueryCharAttr (attr_object, UniChar)
Parameters
- attr_object (AttrObject)
- An attribute object created by UniCreateAttrObject.
- uc (UniChar)
- The Unicode character whose attributes will be queried.
Returns
Return value (int) - returns
- 1
- The result of the test is true (the code element has the attribute associated with the attribute object, attr_object).
- 0
- The result of the test is false.
Remarks
UniQueryCharAttr determines whether the code element uc has the attributes specified by the attribute object argument, attr_object.
Example
This example shows how to create and use a character attribute object.
#include <stdio.h> #include <unidef.h> int main(void) { LocaleObject locale_object = NULL; AttrObject attr_object = NULL; int result = 0; int rc = ULS_SUCCESS; UniChar uni_char = L'c'; /* Unicode lowercase Latin letter c */ /*****************************************************************/ /* 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; } /* Create an attribute object */ rc = UniCreateAttrObject(locale_object, (UniChar *)L"alpha xdigit", &attr_object); if (rc != ULS_SUCCESS) { printf("UniCreateAttrObject error: return code = %u\n", rc); return 1; } /* Make call to determine if character matches attributes */ result = UniQueryCharAttr(attr_object, uni_char); if (result) printf("UniChar character %04X matches attributes\n", uni_char); else printf("UniChar character %04X does not match attributes\n", uni_char); return ULS_SUCCESS; }