UniQueryAttr: Difference between revisions
No edit summary |
|||
Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
UniQueryAttr (attrName) | |||
==Parameters== | ==Parameters== | ||
; attrName | ;attrName (UniChar*): The name of a character attribute. | ||
==Returns== | ==Returns== | ||
Return value | Return value (ULONG) | ||
If the attribute name is known, the function returns the attribute value. Otherwise, 0 is returned. | If the attribute name is known, the function returns the attribute value. Otherwise, 0 is returned. | ||
==Remarks== | ==Remarks== | ||
This function provides the numeric value for the standard attributes such as alpha, graph, and number. In addition, this function provides the numeric value for other attributes such as hiragana, diacritic, halfwidth etc. The table below contains the valid attribute names. Valid names are all in lower case. | This function provides the numeric value for the standard attributes such as alpha, graph, and number. In addition, this function provides the numeric value for other attributes such as hiragana, diacritic, halfwidth etc. The table below contains the valid attribute names. Valid names are all in lower case. | ||
Line 20: | Line 19: | ||
Symbolic names beginning with "C1_" are provided as aliases for several POSIX attributes for Win32 compatibility. | Symbolic names beginning with "C1_" are provided as aliases for several POSIX attributes for Win32 compatibility. | ||
= | {|class="wikitable" | ||
|+Attribute Name and Description Table | |||
Attr Name | !Attr Name||Attribute Define||Description of Attribute | ||
alnum | |- | ||
alpha | |alnum||CT_ALNUM||Alphabetic and numeric characters | ||
C1_ALPHA | |- | ||
ascii | |alpha||CT_ALPHA<br />C1_ALPHA||Letters and linguistic marks | ||
blank | |- | ||
C1_BLANK | |ascii||CT_ASCII||Standard ASCII character | ||
cntrl | |- | ||
C1_CNTRL | |blank||CT_BLANK<br />C1_BLANK||Space and Tab | ||
diacritic | |- | ||
digit | |cntrl||CT_CNTRL<br />C1_CNTRL||Control and format characters | ||
C1_DIGIT | |- | ||
fullwidth | |diacritic||C3_DIACRITIC||Diacritic | ||
graph | |- | ||
halfwidth | |digit||CT_DIGIT<br />C1_DIGIT||Digits 0 through 9 | ||
hiragana | |- | ||
ideograph | |fullwidth||C3_FULLWIDTH||Full width variant | ||
kashida | |- | ||
katakana | |graph||CT_GRAPH||All except controls and space | ||
lower | |- | ||
C1_LOWER | |halfwidth||C3_HALFWIDTH||Half width variant | ||
nonspacing | |- | ||
nsdiacritic | |hiragana||C3_HIRAGANA||Hiragana character | ||
nsvowel | |- | ||
number | |ideograph||C3_IDEOGRAPH||Kanji/Han character | ||
print | |- | ||
punct | |kashida||C3_KASHIDA||Arabic tatweel (used to stretch characters) | ||
C1_PUNCT | |- | ||
space | |katakana||C3_KATAKANA||Katakana character | ||
C1_SPACE | |- | ||
symbol | |lower||CT_LOWER<br />C1_LOWER||Lower case alphabetic character | ||
upper | |- | ||
C1_UPPER | |nonspacing||C3_NONSPACING||Non-spacing mark | ||
vowelmark | |- | ||
xdigit | |nsdiacritic||C3_NSDIACRITIC||Non-spacing diacritic | ||
C1_XDIGIT | |- | ||
_apl | |nsvowel||C3_NSVOWEL||Non-spacing vowel | ||
_arabic | |- | ||
_arrow | |number||CT_NUMBER||Integers between 0 and 9 | ||
_bengali | |- | ||
_bopomofo | |print||CT_PRINT||Everything except control characters | ||
_box | |- | ||
_currency | |punct||CT_PUNCT<br />C1_PUNCT||Punctuation marks | ||
_cyrillic | |- | ||
_dash | |space||CT_SPACE<br />C1_SPACE||Whitespace and line ends | ||
_devanagari | |- | ||
_dingbat | |symbol||CT_SYMBOL||Symbol | ||
_fraction | |- | ||
_greek | |upper||CT_UPPER<br />C1_UPPER||Upper case alphabetic character | ||
_gujarati | |- | ||
_gurmukhi | |vowelmark||C3_VOWELMARK||Vowel mark | ||
_hanguel | |- | ||
_hebrew | |xdigit||CT_XDIGIT<br />C1_XDIGIT||Hexadecimal digits (0-9, a-f or A-F) | ||
_hiragana | |- | ||
_katakana | |_apl||CHS_APL||APL character | ||
_lao | |- | ||
_latin | |_arabic||CHS_ARABIC||Arabic character | ||
_linesep | |- | ||
_math | |_arrow||CHS_ARROW||Arrow character | ||
_punctstart | |- | ||
_punctend | |_bengali||CHS_BENGALI||Bengali character | ||
_tamil | |- | ||
_telegu | |_bopomofo||CHS_BOPOMOFO||Bopomofo character | ||
_thai | |- | ||
_userdef | |_box||CHS_BOX||Box or line drawing character | ||
#arabicnum | |- | ||
#blocksep | |_currency||CHS_CURRENCY||Currency Symbol | ||
#commonsep | |- | ||
#euronum | |_cyrillic||CHS_CYRILLIC||Cyrillic character | ||
#eurosep | |- | ||
#euroterm | |_dash||CHS_DASH||Dash character | ||
#left | |- | ||
#mirrored | |_devanagari||CHS_DEVANAGARI||Devanagari character | ||
#neutral | |- | ||
#right | |_dingbat||CHS_DINGBAT||Dingbat | ||
#whitespace | |- | ||
|_fraction||CHS_FRACTION||Fraction value | |||
|- | |||
|_greek||CHS_GREEK||Greek character | |||
|- | |||
|_gujarati||CHS_GUJARATI||Gujarati character | |||
|- | |||
|_gurmukhi||CHS_GURMUKHI||Gurmukhi character | |||
|- | |||
|_hanguel||CHS_HANGUEL||Hanguel character | |||
|- | |||
|_hebrew||CHS_HEBREW||Hebrew character | |||
|- | |||
|_hiragana||CHS_HIRAGANA||Hiragana character set | |||
|- | |||
|_katakana||CHS_KATAKANA||Katakana character set | |||
|- | |||
|_lao||CHS_LAO||Laotian character | |||
|- | |||
|_latin||CHS_LATIN||Latin character | |||
|- | |||
|_linesep||CHS_LINESEP||Line separator | |||
|- | |||
|_math||CHS_MATH||Math symbol | |||
|- | |||
|_punctstart||CHS_PUNCTSTART||Punctuation start | |||
|- | |||
|_punctend||CHS_PUNCTEND||Punctuation end | |||
|- | |||
|_tamil||CHS_TAMIL||Tamil character | |||
|- | |||
|_telegu||CHS_TELEGU||Telegu character | |||
|- | |||
|_thai||CHS_THAI||Thai character | |||
|- | |||
|_userdef||CHS_USERDEF||User defined character | |||
|- | |||
|#arabicnum||C2_ARABICNUMBER||Arabic numbers | |||
|- | |||
|#blocksep||C2_BLOCKSEPARATOR||Block separator | |||
|- | |||
|#commonsep||C2_COMMONSEPARATOR||Common separator | |||
|- | |||
|#euronum||C2_EUROPENUMBER||European number | |||
|- | |||
|#eurosep||C2_EUROPESEPARATOR||European separator | |||
|- | |||
|#euroterm||C2_EUROPETERMINATOR||European terminator | |||
|- | |||
|#left||C2_LEFTTORIGHT||Left to right text orientation | |||
|- | |||
|#mirrored||C2_MIRRORED||Symmetrical text orientation | |||
|- | |||
|#neutral||C2_OTHERNEUTRAL||Other neutral | |||
|- | |||
|#right||C2_RIGHTTOLEFT||Right to left text orientation | |||
|- | |||
|#whitespace||C2_WHITESPACE||Whitespace | |||
|} | |||
==Example== | ==Example== | ||
Line 139: | Line 195: | ||
} | } | ||
</PRE> | </PRE> | ||
==Related Functions== | ==Related Functions== |
Latest revision as of 23:10, 16 August 2017
UniQueryAttr returns the value associated with the attribute name supplied by the user.
Syntax
UniQueryAttr (attrName)
Parameters
- attrName (UniChar*)
- The name of a character attribute.
Returns
Return value (ULONG)
If the attribute name is known, the function returns the attribute value. Otherwise, 0 is returned.
Remarks
This function provides the numeric value for the standard attributes such as alpha, graph, and number. In addition, this function provides the numeric value for other attributes such as hiragana, diacritic, halfwidth etc. The table below contains the valid attribute names. Valid names are all in lower case.
Attributes whose names begin with a lower-case letter may be ORed together. Attribute names that have a leading _ or # character represent classes of characters; these attributes must be tested as individual attributes.
Symbolic names beginning with "C1_" are provided as aliases for several POSIX attributes for Win32 compatibility.
Attr Name | Attribute Define | Description of Attribute |
---|---|---|
alnum | CT_ALNUM | Alphabetic and numeric characters |
alpha | CT_ALPHA C1_ALPHA |
Letters and linguistic marks |
ascii | CT_ASCII | Standard ASCII character |
blank | CT_BLANK C1_BLANK |
Space and Tab |
cntrl | CT_CNTRL C1_CNTRL |
Control and format characters |
diacritic | C3_DIACRITIC | Diacritic |
digit | CT_DIGIT C1_DIGIT |
Digits 0 through 9 |
fullwidth | C3_FULLWIDTH | Full width variant |
graph | CT_GRAPH | All except controls and space |
halfwidth | C3_HALFWIDTH | Half width variant |
hiragana | C3_HIRAGANA | Hiragana character |
ideograph | C3_IDEOGRAPH | Kanji/Han character |
kashida | C3_KASHIDA | Arabic tatweel (used to stretch characters) |
katakana | C3_KATAKANA | Katakana character |
lower | CT_LOWER C1_LOWER |
Lower case alphabetic character |
nonspacing | C3_NONSPACING | Non-spacing mark |
nsdiacritic | C3_NSDIACRITIC | Non-spacing diacritic |
nsvowel | C3_NSVOWEL | Non-spacing vowel |
number | CT_NUMBER | Integers between 0 and 9 |
CT_PRINT | Everything except control characters | |
punct | CT_PUNCT C1_PUNCT |
Punctuation marks |
space | CT_SPACE C1_SPACE |
Whitespace and line ends |
symbol | CT_SYMBOL | Symbol |
upper | CT_UPPER C1_UPPER |
Upper case alphabetic character |
vowelmark | C3_VOWELMARK | Vowel mark |
xdigit | CT_XDIGIT C1_XDIGIT |
Hexadecimal digits (0-9, a-f or A-F) |
_apl | CHS_APL | APL character |
_arabic | CHS_ARABIC | Arabic character |
_arrow | CHS_ARROW | Arrow character |
_bengali | CHS_BENGALI | Bengali character |
_bopomofo | CHS_BOPOMOFO | Bopomofo character |
_box | CHS_BOX | Box or line drawing character |
_currency | CHS_CURRENCY | Currency Symbol |
_cyrillic | CHS_CYRILLIC | Cyrillic character |
_dash | CHS_DASH | Dash character |
_devanagari | CHS_DEVANAGARI | Devanagari character |
_dingbat | CHS_DINGBAT | Dingbat |
_fraction | CHS_FRACTION | Fraction value |
_greek | CHS_GREEK | Greek character |
_gujarati | CHS_GUJARATI | Gujarati character |
_gurmukhi | CHS_GURMUKHI | Gurmukhi character |
_hanguel | CHS_HANGUEL | Hanguel character |
_hebrew | CHS_HEBREW | Hebrew character |
_hiragana | CHS_HIRAGANA | Hiragana character set |
_katakana | CHS_KATAKANA | Katakana character set |
_lao | CHS_LAO | Laotian character |
_latin | CHS_LATIN | Latin character |
_linesep | CHS_LINESEP | Line separator |
_math | CHS_MATH | Math symbol |
_punctstart | CHS_PUNCTSTART | Punctuation start |
_punctend | CHS_PUNCTEND | Punctuation end |
_tamil | CHS_TAMIL | Tamil character |
_telegu | CHS_TELEGU | Telegu character |
_thai | CHS_THAI | Thai character |
_userdef | CHS_USERDEF | User defined character |
#arabicnum | C2_ARABICNUMBER | Arabic numbers |
#blocksep | C2_BLOCKSEPARATOR | Block separator |
#commonsep | C2_COMMONSEPARATOR | Common separator |
#euronum | C2_EUROPENUMBER | European number |
#eurosep | C2_EUROPESEPARATOR | European separator |
#euroterm | C2_EUROPETERMINATOR | European terminator |
#left | C2_LEFTTORIGHT | Left to right text orientation |
#mirrored | C2_MIRRORED | Symmetrical text orientation |
#neutral | C2_OTHERNEUTRAL | Other neutral |
#right | C2_RIGHTTOLEFT | Right to left text orientation |
#whitespace | C2_WHITESPACE | Whitespace |
Example
This example shows how to query character attribute values using the character attributes.
#include <stdio.h> #include <unidef.h> int main(void) { char name[33]; UniChar uname[33]; UniChar * up; char * cp; ulong rc; /* Ask the user for an attribute name */ printf("Enter attribute name:"); scanf("%s", &name); if (strlen(name) > 32) return 1; /* Convert name to unicode */ cp = name; up = uname; while (*cp) { *up++ = (UniChar)(*cp++); } *up = 0; /* Query the attribute and print the value */ rc = UniQueryAttr(tolower(uname)); if (rc == 0) { printf("UniQueryAttr error: return code = %u\n", rc); return 1; } else printf("%s attribute = %x\n", name, rc); return ULS_SUCCESS; }