Jump to content

UniQueryCntrl: Difference between revisions

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


==Syntax==
==Syntax==
  int UniQueryCntrl (const LocaleObject locale_object, UniChar uc)  
  UniQueryCntrl (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 : If the result of the test is true, the function returns 1. Otherwise, 0 is returned.  
;Return Value (int) - returns : 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 24: Line 23:
#include <unidef.h>
#include <unidef.h>
int main(void) {
int main(void) {
LocaleObject locale_object = NULL;
  LocaleObject locale_object = NULL;
int          result = 0;
  int          result = 0;
int          rc = ULS_SUCCESS;
  int          rc = ULS_SUCCESS;
UniChar      uni_char = 0x000A;    /* Unicode newline character */
  UniChar      uni_char = 0x000A;    /* Unicode newline character */
         /*****************************************************************/
         /*****************************************************************/
         /* Assumes LANG environment variable set to a valid locale name, */
         /* Assumes LANG environment variable set to a valid locale name, */
Line 48: Line 47:
}  
}  
</PRE>
</PRE>
===Format===
<PRE>
#include <unidef.h>


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

Latest revision as of 22:50, 16 August 2017

UniQueryCntrl queries character attributes.

Syntax

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

return ULS_SUCCESS;
} 

Related Functions