eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ucd.h 44KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. /* Unicode Character Database API
  2. *
  3. * Copyright (C) 2012-2017 Reece H. Dunn
  4. *
  5. * This file is part of ucd-tools.
  6. *
  7. * ucd-tools is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * ucd-tools is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef UNICODE_CHARACTER_DATA_H
  21. #define UNICODE_CHARACTER_DATA_H
  22. #include <stdint.h>
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. /** @brief Represents a Unicode codepoint.
  28. */
  29. typedef uint32_t codepoint_t;
  30. /** @brief Unicode General Category Groups
  31. * @see http://www.unicode.org/reports/tr44/
  32. */
  33. typedef enum ucd_category_group_
  34. {
  35. UCD_CATEGORY_GROUP_C, /**< @brief Other */
  36. UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
  37. UCD_CATEGORY_GROUP_L, /**< @brief Letter */
  38. UCD_CATEGORY_GROUP_M, /**< @brief Mark */
  39. UCD_CATEGORY_GROUP_N, /**< @brief Number */
  40. UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
  41. UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
  42. UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
  43. } ucd_category_group;
  44. /** @brief Get a string representation of the category_group enumeration value.
  45. *
  46. * @param c The value to get the string representation for.
  47. *
  48. * @return The string representation, or "-" if the value is not recognized.
  49. */
  50. const char *ucd_get_category_group_string(ucd_category_group c);
  51. /** @brief Unicode General Category Values
  52. * @see http://www.unicode.org/reports/tr44/
  53. */
  54. typedef enum ucd_category_
  55. {
  56. UCD_CATEGORY_Cc, /**< @brief Control Character */
  57. UCD_CATEGORY_Cf, /**< @brief Format Control Character */
  58. UCD_CATEGORY_Cn, /**< @brief Unassigned */
  59. UCD_CATEGORY_Co, /**< @brief Private Use */
  60. UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
  61. UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
  62. UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
  63. UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
  64. UCD_CATEGORY_Lo, /**< @brief Other Letter */
  65. UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
  66. UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
  67. UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
  68. UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
  69. UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
  70. UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
  71. UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
  72. UCD_CATEGORY_No, /**< @brief Other Number */
  73. UCD_CATEGORY_Pc, /**< @brief Connector */
  74. UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
  75. UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
  76. UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
  77. UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
  78. UCD_CATEGORY_Po, /**< @brief Other */
  79. UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
  80. UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
  81. UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
  82. UCD_CATEGORY_Sm, /**< @brief Math Symbol */
  83. UCD_CATEGORY_So, /**< @brief Other Symbol */
  84. UCD_CATEGORY_Zl, /**< @brief Line Separator */
  85. UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
  86. UCD_CATEGORY_Zs, /**< @brief Space Separator */
  87. } ucd_category;
  88. /** @brief Get a string representation of the category enumeration value.
  89. *
  90. * @param c The value to get the string representation for.
  91. *
  92. * @return The string representation, or "--" if the value is not recognized.
  93. */
  94. const char *ucd_get_category_string(ucd_category c);
  95. /** @brief Lookup the General Category Group for a General Category.
  96. *
  97. * @param c The General Category to lookup.
  98. * @return The General Category Group of the General Category.
  99. */
  100. ucd_category_group ucd_get_category_group_for_category(ucd_category c);
  101. /** @brief Lookup the General Category Group for a Unicode codepoint.
  102. *
  103. * @param c The Unicode codepoint to lookup.
  104. * @return The General Category Group of the Unicode codepoint.
  105. */
  106. ucd_category_group ucd_lookup_category_group(codepoint_t c);
  107. /** @brief Lookup the General Category for a Unicode codepoint.
  108. *
  109. * @param c The Unicode codepoint to lookup.
  110. * @return The General Category of the Unicode codepoint.
  111. */
  112. ucd_category ucd_lookup_category(codepoint_t c);
  113. /** @brief Unicode Script
  114. * @see http://www.iana.org/assignments/language-subtag-registry
  115. * @see http://www.unicode.org/iso15924/iso15924-codes.html
  116. */
  117. typedef enum ucd_script_
  118. {
  119. UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
  120. UCD_SCRIPT_Afak, /**< @brief Afaka Script */
  121. UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
  122. UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
  123. UCD_SCRIPT_Arab, /**< @brief Arabic Script */
  124. UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
  125. UCD_SCRIPT_Armn, /**< @brief Armenian Script */
  126. UCD_SCRIPT_Avst, /**< @brief Avestan Script */
  127. UCD_SCRIPT_Bali, /**< @brief Balinese Script */
  128. UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
  129. UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
  130. UCD_SCRIPT_Batk, /**< @brief Batak Script */
  131. UCD_SCRIPT_Beng, /**< @brief Bengali Script */
  132. UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
  133. UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
  134. UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
  135. UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
  136. UCD_SCRIPT_Brai, /**< @brief Braille Script */
  137. UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
  138. UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
  139. UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
  140. UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
  141. UCD_SCRIPT_Cari, /**< @brief Carian Script */
  142. UCD_SCRIPT_Cham, /**< @brief Cham Script */
  143. UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
  144. UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
  145. UCD_SCRIPT_Copt, /**< @brief Coptic Script */
  146. UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
  147. UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
  148. UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
  149. UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
  150. UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
  151. UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
  152. UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
  153. UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
  154. UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
  155. UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
  156. UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
  157. UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
  158. UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
  159. UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
  160. UCD_SCRIPT_Goth, /**< @brief Gothic Script */
  161. UCD_SCRIPT_Gran, /**< @brief Grantha Script */
  162. UCD_SCRIPT_Grek, /**< @brief Greek Script */
  163. UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
  164. UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
  165. UCD_SCRIPT_Hang, /**< @brief Hangul Script */
  166. UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
  167. UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
  168. UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
  169. UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
  170. UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
  171. UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
  172. UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
  173. UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
  174. UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
  175. UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
  176. UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
  177. UCD_SCRIPT_Inds, /**< @brief Indus Script */
  178. UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
  179. UCD_SCRIPT_Java, /**< @brief Javanese Script */
  180. UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
  181. UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
  182. UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
  183. UCD_SCRIPT_Kana, /**< @brief Katakana Script */
  184. UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
  185. UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
  186. UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
  187. UCD_SCRIPT_Knda, /**< @brief Kannada Script */
  188. UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
  189. UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
  190. UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
  191. UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
  192. UCD_SCRIPT_Laoo, /**< @brief Lao Script */
  193. UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
  194. UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
  195. UCD_SCRIPT_Latn, /**< @brief Latin Script */
  196. UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
  197. UCD_SCRIPT_Limb, /**< @brief Limbu Script */
  198. UCD_SCRIPT_Lina, /**< @brief Linear A Script */
  199. UCD_SCRIPT_Linb, /**< @brief Linear B Script */
  200. UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
  201. UCD_SCRIPT_Loma, /**< @brief Loma Script */
  202. UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
  203. UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
  204. UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
  205. UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
  206. UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
  207. UCD_SCRIPT_Marc, /**< @brief Marchen Script */
  208. UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
  209. UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
  210. UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
  211. UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
  212. UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
  213. UCD_SCRIPT_Modi, /**< @brief Modi Script */
  214. UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
  215. UCD_SCRIPT_Moon, /**< @brief Moon Script */
  216. UCD_SCRIPT_Mroo, /**< @brief Mro Script */
  217. UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
  218. UCD_SCRIPT_Mult, /**< @brief Multani Script */
  219. UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
  220. UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
  221. UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
  222. UCD_SCRIPT_Newa, /**< @brief Newa Script */
  223. UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
  224. UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
  225. UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
  226. UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
  227. UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
  228. UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
  229. UCD_SCRIPT_Orya, /**< @brief Oriya Script */
  230. UCD_SCRIPT_Osge, /**< @brief Osage Script */
  231. UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
  232. UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
  233. UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
  234. UCD_SCRIPT_Perm, /**< @brief Old Permic */
  235. UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
  236. UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
  237. UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
  238. UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
  239. UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
  240. UCD_SCRIPT_Plrd, /**< @brief Miao Script */
  241. UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
  242. UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
  243. UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
  244. UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
  245. UCD_SCRIPT_Runr, /**< @brief Runic Script */
  246. UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
  247. UCD_SCRIPT_Sara, /**< @brief Sarati Script */
  248. UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
  249. UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
  250. UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
  251. UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
  252. UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
  253. UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
  254. UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
  255. UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
  256. UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
  257. UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
  258. UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
  259. UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
  260. UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
  261. UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
  262. UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
  263. UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
  264. UCD_SCRIPT_Takr, /**< @brief Takri Script */
  265. UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
  266. UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
  267. UCD_SCRIPT_Taml, /**< @brief Tamil Script */
  268. UCD_SCRIPT_Tang, /**< @brief Tangut Script */
  269. UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
  270. UCD_SCRIPT_Telu, /**< @brief Telugu Script */
  271. UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
  272. UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
  273. UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
  274. UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
  275. UCD_SCRIPT_Thai, /**< @brief Thai Script */
  276. UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
  277. UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
  278. UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
  279. UCD_SCRIPT_Vaii, /**< @brief Vai Script */
  280. UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
  281. UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
  282. UCD_SCRIPT_Wole, /**< @brief Woleai Script */
  283. UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
  284. UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
  285. UCD_SCRIPT_Yiii, /**< @brief Yi Script */
  286. UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
  287. UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
  288. UCD_SCRIPT_Zsym, /**< @brief Symbols */
  289. UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
  290. UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
  291. UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
  292. } ucd_script;
  293. /** @brief Get a string representation of the script enumeration value.
  294. *
  295. * @param s The value to get the string representation for.
  296. *
  297. * @return The string representation, or "----" if the value is not recognized.
  298. */
  299. const char *ucd_get_script_string(ucd_script s);
  300. /** @brief Lookup the Script for a Unicode codepoint.
  301. *
  302. * @param c The Unicode codepoint to lookup.
  303. * @return The Script of the Unicode codepoint.
  304. */
  305. ucd_script ucd_lookup_script(codepoint_t c);
  306. /** @brief Properties
  307. */
  308. typedef uint64_t ucd_property;
  309. enum
  310. {
  311. UCD_PROPERTY_WHITE_SPACE = 0x0000000000000001ull, /**< @brief White_Space */
  312. UCD_PROPERTY_BIDI_CONTROL = 0x0000000000000002ull, /**< @brief Bidi_Control */
  313. UCD_PROPERTY_JOIN_CONTROL = 0x0000000000000004ull, /**< @brief Join_Control */
  314. UCD_PROPERTY_DASH = 0x0000000000000008ull, /**< @brief Dash */
  315. UCD_PROPERTY_HYPHEN = 0x0000000000000010ull, /**< @brief Hyphen */
  316. UCD_PROPERTY_QUOTATION_MARK = 0x0000000000000020ull, /**< @brief Quotation_Mark */
  317. UCD_PROPERTY_TERMINAL_PUNCTUATION = 0x0000000000000040ull, /**< @brief Terminal_Punctuation */
  318. UCD_PROPERTY_OTHER_MATH = 0x0000000000000080ull, /**< @brief Other_Math */
  319. UCD_PROPERTY_HEX_DIGIT = 0x0000000000000100ull, /**< @brief Hex_Digit */
  320. UCD_PROPERTY_ASCII_HEX_DIGIT = 0x0000000000000200ull, /**< @brief ASCII_Hex_Digit */
  321. UCD_PROPERTY_OTHER_ALPHABETIC = 0x0000000000000400ull, /**< @brief Other_Alphabetic */
  322. UCD_PROPERTY_IDEOGRAPHIC = 0x0000000000000800ull, /**< @brief Ideographic */
  323. UCD_PROPERTY_DIACRITIC = 0x0000000000001000ull, /**< @brief Diacritic */
  324. UCD_PROPERTY_EXTENDER = 0x0000000000002000ull, /**< @brief Extender */
  325. UCD_PROPERTY_OTHER_LOWERCASE = 0x0000000000004000ull, /**< @brief Other_Lowercase */
  326. UCD_PROPERTY_OTHER_UPPERCASE = 0x0000000000008000ull, /**< @brief Other_Uppercase */
  327. UCD_PROPERTY_NONCHARACTER_CODE_POINT = 0x0000000000010000ull, /**< @brief Noncharacter_Code_Point */
  328. UCD_PROPERTY_OTHER_GRAPHEME_EXTEND = 0x0000000000020000ull, /**< @brief Other_Grapheme_Extend */
  329. UCD_PROPERTY_IDS_BINARY_OPERATOR = 0x0000000000040000ull, /**< @brief IDS_Binary_Operator */
  330. UCD_PROPERTY_IDS_TRINARY_OPERATOR = 0x0000000000080000ull, /**< @brief IDS_Trinary_Operator */
  331. UCD_PROPERTY_RADICAL = 0x0000000000100000ull, /**< @brief Radical */
  332. UCD_PROPERTY_UNIFIED_IDEOGRAPH = 0x0000000000200000ull, /**< @brief Unified_Ideograph */
  333. UCD_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT = 0x0000000000400000ull, /**< @brief Other_Default_Ignorable_Code_Point */
  334. UCD_PROPERTY_DEPRECATED = 0x0000000000800000ull, /**< @brief Deprecated */
  335. UCD_PROPERTY_SOFT_DOTTED = 0x0000000001000000ull, /**< @brief Soft_Dotted */
  336. UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION = 0x0000000002000000ull, /**< @brief Logical_Order_Exception */
  337. UCD_PROPERTY_OTHER_ID_START = 0x0000000004000000ull, /**< @brief Other_ID_Start */
  338. UCD_PROPERTY_OTHER_ID_CONTINUE = 0x0000000008000000ull, /**< @brief Other_ID_Continue */
  339. UCD_PROPERTY_SENTENCE_TERMINAL = 0x0000000010000000ull, /**< @brief Sentence_Terminal */
  340. UCD_PROPERTY_VARIATION_SELECTOR = 0x0000000020000000ull, /**< @brief Variation_Selector */
  341. UCD_PROPERTY_PATTERN_WHITE_SPACE = 0x0000000040000000ull, /**< @brief Pattern_White_Space */
  342. UCD_PROPERTY_PATTERN_SYNTAX = 0x0000000080000000ull, /**< @brief Pattern_Syntax */
  343. UCD_PROPERTY_PREPENDED_CONCATENATION_MARK = 0x0000000100000000ull, /**< @brief Prepended_Concatenation_Mark */
  344. };
  345. /** @brief Return the properties of the specified codepoint.
  346. *
  347. * @param c The Unicode codepoint to lookup.
  348. * @param category The General Category of the codepoint.
  349. * @return The properties associated with the codepoint.
  350. */
  351. ucd_property ucd_properties(codepoint_t c, ucd_category category);
  352. /** @brief Is the codepoint in the 'alnum' class?
  353. *
  354. * @param c The Unicode codepoint to check.
  355. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  356. */
  357. int ucd_isalnum(codepoint_t c);
  358. /** @brief Is the codepoint in the 'alpha' class?
  359. *
  360. * @param c The Unicode codepoint to check.
  361. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  362. */
  363. int ucd_isalpha(codepoint_t c);
  364. /** @brief Is the codepoint in the 'blank' class?
  365. *
  366. * @param c The Unicode codepoint to check.
  367. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  368. */
  369. int ucd_isblank(codepoint_t c);
  370. /** @brief Is the codepoint in the 'cntrl' class?
  371. *
  372. * @param c The Unicode codepoint to check.
  373. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  374. */
  375. int ucd_iscntrl(codepoint_t c);
  376. /** @brief Is the codepoint in the 'digit' class?
  377. *
  378. * @param c The Unicode codepoint to check.
  379. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  380. */
  381. int ucd_isdigit(codepoint_t c);
  382. /** @brief Is the codepoint in the 'graph' class?
  383. *
  384. * @param c The Unicode codepoint to check.
  385. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  386. */
  387. int ucd_isgraph(codepoint_t c);
  388. /** @brief Is the codepoint in the 'lower' class?
  389. *
  390. * @param c The Unicode codepoint to check.
  391. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  392. */
  393. int ucd_islower(codepoint_t c);
  394. /** @brief Is the codepoint in the 'print' class?
  395. *
  396. * @param c The Unicode codepoint to check.
  397. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  398. */
  399. int ucd_isprint(codepoint_t c);
  400. /** @brief Is the codepoint in the 'punct' class?
  401. *
  402. * @param c The Unicode codepoint to check.
  403. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  404. */
  405. int ucd_ispunct(codepoint_t c);
  406. /** @brief Is the codepoint in the 'space' class?
  407. *
  408. * @param c The Unicode codepoint to check.
  409. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  410. */
  411. int ucd_isspace(codepoint_t c);
  412. /** @brief Is the codepoint in the 'upper' class?
  413. *
  414. * @param c The Unicode codepoint to check.
  415. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  416. */
  417. int ucd_isupper(codepoint_t c);
  418. /** @brief Is the codepoint in the 'xdigit' class?
  419. *
  420. * @param c The Unicode codepoint to check.
  421. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  422. */
  423. int ucd_isxdigit(codepoint_t c);
  424. /** @brief Convert the Unicode codepoint to upper-case.
  425. *
  426. * This function only uses the simple case mapping present in the
  427. * UnicodeData file. The data in SpecialCasing requires Unicode
  428. * codepoints to be mapped to multiple codepoints.
  429. *
  430. * @param c The Unicode codepoint to convert.
  431. * @return The upper-case Unicode codepoint for this codepoint, or
  432. * this codepoint if there is no upper-case codepoint.
  433. */
  434. codepoint_t ucd_toupper(codepoint_t c);
  435. /** @brief Convert the Unicode codepoint to lower-case.
  436. *
  437. * This function only uses the simple case mapping present in the
  438. * UnicodeData file. The data in SpecialCasing requires Unicode
  439. * codepoints to be mapped to multiple codepoints.
  440. *
  441. * @param c The Unicode codepoint to convert.
  442. * @return The lower-case Unicode codepoint for this codepoint, or
  443. * this codepoint if there is no upper-case codepoint.
  444. */
  445. codepoint_t ucd_tolower(codepoint_t c);
  446. /** @brief Convert the Unicode codepoint to title-case.
  447. *
  448. * This function only uses the simple case mapping present in the
  449. * UnicodeData file. The data in SpecialCasing requires Unicode
  450. * codepoints to be mapped to multiple codepoints.
  451. *
  452. * @param c The Unicode codepoint to convert.
  453. * @return The title-case Unicode codepoint for this codepoint, or
  454. * this codepoint if there is no upper-case codepoint.
  455. */
  456. codepoint_t ucd_totitle(codepoint_t c);
  457. #ifdef __cplusplus
  458. }
  459. /** @brief Unicode Character Database
  460. */
  461. namespace ucd
  462. {
  463. /** @brief Represents a Unicode codepoint.
  464. */
  465. using ::codepoint_t;
  466. /** @brief Unicode General Category Groups
  467. * @see http://www.unicode.org/reports/tr44/
  468. */
  469. enum category_group
  470. {
  471. C = UCD_CATEGORY_GROUP_C, /**< @brief Other */
  472. I = UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
  473. L = UCD_CATEGORY_GROUP_L, /**< @brief Letter */
  474. M = UCD_CATEGORY_GROUP_M, /**< @brief Mark */
  475. N = UCD_CATEGORY_GROUP_N, /**< @brief Number */
  476. P = UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
  477. S = UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
  478. Z = UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
  479. };
  480. /** @brief Get a string representation of the category_group enumeration value.
  481. *
  482. * @param c The value to get the string representation for.
  483. *
  484. * @return The string representation, or "-" if the value is not recognized.
  485. */
  486. inline const char *get_category_group_string(category_group c)
  487. {
  488. return ucd_get_category_group_string((ucd_category_group)c);
  489. }
  490. /** @brief Unicode General Category Values
  491. * @see http://www.unicode.org/reports/tr44/
  492. */
  493. enum category
  494. {
  495. Cc = UCD_CATEGORY_Cc, /**< @brief Control Character */
  496. Cf = UCD_CATEGORY_Cf, /**< @brief Format Control Character */
  497. Cn = UCD_CATEGORY_Cn, /**< @brief Unassigned */
  498. Co = UCD_CATEGORY_Co, /**< @brief Private Use */
  499. Cs = UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
  500. Ii = UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
  501. Ll = UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
  502. Lm = UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
  503. Lo = UCD_CATEGORY_Lo, /**< @brief Other Letter */
  504. Lt = UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
  505. Lu = UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
  506. Mc = UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
  507. Me = UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
  508. Mn = UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
  509. Nd = UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
  510. Nl = UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
  511. No = UCD_CATEGORY_No, /**< @brief Other Number */
  512. Pc = UCD_CATEGORY_Pc, /**< @brief Connector */
  513. Pd = UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
  514. Pe = UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
  515. Pf = UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
  516. Pi = UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
  517. Po = UCD_CATEGORY_Po, /**< @brief Other */
  518. Ps = UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
  519. Sc = UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
  520. Sk = UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
  521. Sm = UCD_CATEGORY_Sm, /**< @brief Math Symbol */
  522. So = UCD_CATEGORY_So, /**< @brief Other Symbol */
  523. Zl = UCD_CATEGORY_Zl, /**< @brief Line Separator */
  524. Zp = UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
  525. Zs = UCD_CATEGORY_Zs, /**< @brief Space Separator */
  526. };
  527. /** @brief Get a string representation of the category enumeration value.
  528. *
  529. * @param c The value to get the string representation for.
  530. *
  531. * @return The string representation, or "--" if the value is not recognized.
  532. */
  533. inline const char *get_category_string(category c)
  534. {
  535. return ucd_get_category_string((ucd_category)c);
  536. }
  537. /** @brief Lookup the General Category Group for a General Category.
  538. *
  539. * @param c The General Category to lookup.
  540. * @return The General Category Group of the General Category.
  541. */
  542. inline category_group lookup_category_group(category c)
  543. {
  544. return (category_group)ucd_get_category_group_for_category((ucd_category)c);
  545. }
  546. /** @brief Lookup the General Category Group for a Unicode codepoint.
  547. *
  548. * @param c The Unicode codepoint to lookup.
  549. * @return The General Category Group of the Unicode codepoint.
  550. */
  551. inline category_group lookup_category_group(codepoint_t c)
  552. {
  553. return (category_group)ucd_lookup_category_group(c);
  554. }
  555. /** @brief Lookup the General Category for a Unicode codepoint.
  556. *
  557. * @param c The Unicode codepoint to lookup.
  558. * @return The General Category of the Unicode codepoint.
  559. */
  560. inline category lookup_category(codepoint_t c)
  561. {
  562. return (category)ucd_lookup_category(c);
  563. }
  564. /** @brief Unicode Script
  565. * @see http://www.iana.org/assignments/language-subtag-registry
  566. * @see http://www.unicode.org/iso15924/iso15924-codes.html
  567. */
  568. enum script
  569. {
  570. Adlm = UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
  571. Afak = UCD_SCRIPT_Afak, /**< @brief Afaka Script */
  572. Aghb = UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
  573. Ahom = UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
  574. Arab = UCD_SCRIPT_Arab, /**< @brief Arabic Script */
  575. Armi = UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
  576. Armn = UCD_SCRIPT_Armn, /**< @brief Armenian Script */
  577. Avst = UCD_SCRIPT_Avst, /**< @brief Avestan Script */
  578. Bali = UCD_SCRIPT_Bali, /**< @brief Balinese Script */
  579. Bamu = UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
  580. Bass = UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
  581. Batk = UCD_SCRIPT_Batk, /**< @brief Batak Script */
  582. Beng = UCD_SCRIPT_Beng, /**< @brief Bengali Script */
  583. Bhks = UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
  584. Blis = UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
  585. Bopo = UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
  586. Brah = UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
  587. Brai = UCD_SCRIPT_Brai, /**< @brief Braille Script */
  588. Bugi = UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
  589. Buhd = UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
  590. Cakm = UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
  591. Cans = UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
  592. Cari = UCD_SCRIPT_Cari, /**< @brief Carian Script */
  593. Cham = UCD_SCRIPT_Cham, /**< @brief Cham Script */
  594. Cher = UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
  595. Cirt = UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
  596. Copt = UCD_SCRIPT_Copt, /**< @brief Coptic Script */
  597. Cprt = UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
  598. Cyrl = UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
  599. Cyrs = UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
  600. Deva = UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
  601. Dsrt = UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
  602. Dupl = UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
  603. Egyd = UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
  604. Egyh = UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
  605. Egyp = UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
  606. Elba = UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
  607. Ethi = UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
  608. Geok = UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
  609. Geor = UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
  610. Glag = UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
  611. Goth = UCD_SCRIPT_Goth, /**< @brief Gothic Script */
  612. Gran = UCD_SCRIPT_Gran, /**< @brief Grantha Script */
  613. Grek = UCD_SCRIPT_Grek, /**< @brief Greek Script */
  614. Gujr = UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
  615. Guru = UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
  616. Hang = UCD_SCRIPT_Hang, /**< @brief Hangul Script */
  617. Hani = UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
  618. Hano = UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
  619. Hans = UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
  620. Hant = UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
  621. Hatr = UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
  622. Hebr = UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
  623. Hira = UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
  624. Hluw = UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
  625. Hmng = UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
  626. Hrkt = UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
  627. Hung = UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
  628. Inds = UCD_SCRIPT_Inds, /**< @brief Indus Script */
  629. Ital = UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
  630. Java = UCD_SCRIPT_Java, /**< @brief Javanese Script */
  631. Jpan = UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
  632. Jurc = UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
  633. Kali = UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
  634. Kana = UCD_SCRIPT_Kana, /**< @brief Katakana Script */
  635. Khar = UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
  636. Khmr = UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
  637. Khoj = UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
  638. Knda = UCD_SCRIPT_Knda, /**< @brief Kannada Script */
  639. Kore = UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
  640. Kpel = UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
  641. Kthi = UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
  642. Lana = UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
  643. Laoo = UCD_SCRIPT_Laoo, /**< @brief Lao Script */
  644. Latf = UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
  645. Latg = UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
  646. Latn = UCD_SCRIPT_Latn, /**< @brief Latin Script */
  647. Lepc = UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
  648. Limb = UCD_SCRIPT_Limb, /**< @brief Limbu Script */
  649. Lina = UCD_SCRIPT_Lina, /**< @brief Linear A Script */
  650. Linb = UCD_SCRIPT_Linb, /**< @brief Linear B Script */
  651. Lisu = UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
  652. Loma = UCD_SCRIPT_Loma, /**< @brief Loma Script */
  653. Lyci = UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
  654. Lydi = UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
  655. Mahj = UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
  656. Mand = UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
  657. Mani = UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
  658. Marc = UCD_SCRIPT_Marc, /**< @brief Marchen Script */
  659. Maya = UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
  660. Mend = UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
  661. Merc = UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
  662. Mero = UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
  663. Mlym = UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
  664. Modi = UCD_SCRIPT_Modi, /**< @brief Modi Script */
  665. Mong = UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
  666. Moon = UCD_SCRIPT_Moon, /**< @brief Moon Script */
  667. Mroo = UCD_SCRIPT_Mroo, /**< @brief Mro Script */
  668. Mtei = UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
  669. Mult = UCD_SCRIPT_Mult, /**< @brief Multani Script */
  670. Mymr = UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
  671. Narb = UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
  672. Nbat = UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
  673. Newa = UCD_SCRIPT_Newa, /**< @brief Newa Script */
  674. Nkgb = UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
  675. Nkoo = UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
  676. Nshu = UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
  677. Ogam = UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
  678. Olck = UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
  679. Orkh = UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
  680. Orya = UCD_SCRIPT_Orya, /**< @brief Oriya Script */
  681. Osge = UCD_SCRIPT_Osge, /**< @brief Osage Script */
  682. Osma = UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
  683. Palm = UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
  684. Pauc = UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
  685. Perm = UCD_SCRIPT_Perm, /**< @brief Old Permic */
  686. Phag = UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
  687. Phli = UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
  688. Phlp = UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
  689. Phlv = UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
  690. Phnx = UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
  691. Plrd = UCD_SCRIPT_Plrd, /**< @brief Miao Script */
  692. Prti = UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
  693. Qaak = UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
  694. Rjng = UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
  695. Roro = UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
  696. Runr = UCD_SCRIPT_Runr, /**< @brief Runic Script */
  697. Samr = UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
  698. Sara = UCD_SCRIPT_Sara, /**< @brief Sarati Script */
  699. Sarb = UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
  700. Saur = UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
  701. Sgnw = UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
  702. Shaw = UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
  703. Shrd = UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
  704. Sidd = UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
  705. Sind = UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
  706. Sinh = UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
  707. Sora = UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
  708. Sund = UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
  709. Sylo = UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
  710. Syrc = UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
  711. Syre = UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
  712. Syrj = UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
  713. Syrn = UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
  714. Tagb = UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
  715. Takr = UCD_SCRIPT_Takr, /**< @brief Takri Script */
  716. Tale = UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
  717. Talu = UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
  718. Taml = UCD_SCRIPT_Taml, /**< @brief Tamil Script */
  719. Tang = UCD_SCRIPT_Tang, /**< @brief Tangut Script */
  720. Tavt = UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
  721. Telu = UCD_SCRIPT_Telu, /**< @brief Telugu Script */
  722. Teng = UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
  723. Tfng = UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
  724. Tglg = UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
  725. Thaa = UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
  726. Thai = UCD_SCRIPT_Thai, /**< @brief Thai Script */
  727. Tibt = UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
  728. Tirh = UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
  729. Ugar = UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
  730. Vaii = UCD_SCRIPT_Vaii, /**< @brief Vai Script */
  731. Visp = UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
  732. Wara = UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
  733. Wole = UCD_SCRIPT_Wole, /**< @brief Woleai Script */
  734. Xpeo = UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
  735. Xsux = UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
  736. Yiii = UCD_SCRIPT_Yiii, /**< @brief Yi Script */
  737. Zinh = UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
  738. Zmth = UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
  739. Zsym = UCD_SCRIPT_Zsym, /**< @brief Symbols */
  740. Zxxx = UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
  741. Zyyy = UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
  742. Zzzz = UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
  743. };
  744. /** @brief Get a string representation of the script enumeration value.
  745. *
  746. * @param s The value to get the string representation for.
  747. *
  748. * @return The string representation, or "----" if the value is not recognized.
  749. */
  750. inline const char *get_script_string(script s)
  751. {
  752. return ucd_get_script_string((ucd_script)s);
  753. }
  754. /** @brief Lookup the Script for a Unicode codepoint.
  755. *
  756. * @param c The Unicode codepoint to lookup.
  757. * @return The Script of the Unicode codepoint.
  758. */
  759. inline script lookup_script(codepoint_t c)
  760. {
  761. return (script)ucd_lookup_script(c);
  762. }
  763. /** @brief Properties
  764. */
  765. typedef ucd_property property;
  766. enum
  767. {
  768. White_Space = UCD_PROPERTY_WHITE_SPACE, /**< @brief White_Space */
  769. Bidi_Control = UCD_PROPERTY_BIDI_CONTROL, /**< @brief Bidi_Control */
  770. Join_Control = UCD_PROPERTY_JOIN_CONTROL, /**< @brief Join_Control */
  771. Dash = UCD_PROPERTY_DASH, /**< @brief Dash */
  772. Hyphen = UCD_PROPERTY_HYPHEN, /**< @brief Hyphen */
  773. Quotation_Mark = UCD_PROPERTY_QUOTATION_MARK, /**< @brief Quotation_Mark */
  774. Terminal_Punctuation = UCD_PROPERTY_TERMINAL_PUNCTUATION, /**< @brief Terminal_Punctuation */
  775. Other_Math = UCD_PROPERTY_OTHER_MATH, /**< @brief Other_Math */
  776. Hex_Digit = UCD_PROPERTY_HEX_DIGIT, /**< @brief Hex_Digit */
  777. ASCII_Hex_Digit = UCD_PROPERTY_ASCII_HEX_DIGIT, /**< @brief ASCII_Hex_Digit */
  778. Other_Alphabetic = UCD_PROPERTY_OTHER_ALPHABETIC, /**< @brief Other_Alphabetic */
  779. Ideographic = UCD_PROPERTY_IDEOGRAPHIC, /**< @brief Ideographic */
  780. Diacritic = UCD_PROPERTY_DIACRITIC, /**< @brief Diacritic */
  781. Extender = UCD_PROPERTY_EXTENDER, /**< @brief Extender */
  782. Other_Lowercase = UCD_PROPERTY_OTHER_LOWERCASE, /**< @brief Other_Lowercase */
  783. Other_Uppercase = UCD_PROPERTY_OTHER_UPPERCASE, /**< @brief Other_Uppercase */
  784. Noncharacter_Code_Point = UCD_PROPERTY_NONCHARACTER_CODE_POINT, /**< @brief Noncharacter_Code_Point */
  785. Other_Grapheme_Extend = UCD_PROPERTY_OTHER_GRAPHEME_EXTEND, /**< @brief Other_Grapheme_Extend */
  786. IDS_Binary_Operator = UCD_PROPERTY_IDS_BINARY_OPERATOR, /**< @brief IDS_Binary_Operator */
  787. IDS_Trinary_Operator = UCD_PROPERTY_IDS_TRINARY_OPERATOR, /**< @brief IDS_Trinary_Operator */
  788. Radical = UCD_PROPERTY_RADICAL, /**< @brief Radical */
  789. Unified_Ideograph = UCD_PROPERTY_UNIFIED_IDEOGRAPH, /**< @brief Unified_Ideograph */
  790. Other_Default_Ignorable_Code_Point = UCD_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT, /**< @brief Other_Default_Ignorable_Code_Point */
  791. Deprecated = UCD_PROPERTY_DEPRECATED, /**< @brief Deprecated */
  792. Soft_Dotted = UCD_PROPERTY_SOFT_DOTTED, /**< @brief Soft_Dotted */
  793. Logical_Order_Exception = UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION, /**< @brief Logical_Order_Exception */
  794. Other_ID_Start = UCD_PROPERTY_OTHER_ID_START, /**< @brief Other_ID_Start */
  795. Other_ID_Continue = UCD_PROPERTY_OTHER_ID_CONTINUE, /**< @brief Other_ID_Continue */
  796. Sentence_Terminal = UCD_PROPERTY_SENTENCE_TERMINAL, /**< @brief Sentence_Terminal */
  797. Variation_Selector = UCD_PROPERTY_VARIATION_SELECTOR, /**< @brief Variation_Selector */
  798. Pattern_White_Space = UCD_PROPERTY_PATTERN_WHITE_SPACE, /**< @brief Pattern_White_Space */
  799. Pattern_Syntax = UCD_PROPERTY_PATTERN_SYNTAX, /**< @brief Pattern_Syntax */
  800. Prepended_Concatenation_Mark = UCD_PROPERTY_PREPENDED_CONCATENATION_MARK, /**< @brief Prepended_Concatenation_Mark */
  801. };
  802. /** @brief Return the properties of the specified codepoint.
  803. *
  804. * @param c The Unicode codepoint to lookup.
  805. * @param cat The General Category of the codepoint.
  806. * @return The properties associated with the codepoint.
  807. */
  808. inline property properties(codepoint_t c, category cat)
  809. {
  810. return (property)ucd_properties(c, (ucd_category)cat);
  811. }
  812. /** @brief Is the codepoint in the 'alnum' class?
  813. *
  814. * @param c The Unicode codepoint to check.
  815. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  816. */
  817. inline int isalnum(codepoint_t c)
  818. {
  819. return ucd_isalnum(c);
  820. }
  821. /** @brief Is the codepoint in the 'alpha' class?
  822. *
  823. * @param c The Unicode codepoint to check.
  824. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  825. */
  826. inline int isalpha(codepoint_t c)
  827. {
  828. return ucd_isalpha(c);
  829. }
  830. /** @brief Is the codepoint in the 'blank' class?
  831. *
  832. * @param c The Unicode codepoint to check.
  833. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  834. */
  835. inline int isblank(codepoint_t c)
  836. {
  837. return ucd_isblank(c);
  838. }
  839. /** @brief Is the codepoint in the 'cntrl' class?
  840. *
  841. * @param c The Unicode codepoint to check.
  842. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  843. */
  844. inline int iscntrl(codepoint_t c)
  845. {
  846. return ucd_iscntrl(c);
  847. }
  848. /** @brief Is the codepoint in the 'digit' class?
  849. *
  850. * @param c The Unicode codepoint to check.
  851. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  852. */
  853. inline int isdigit(codepoint_t c)
  854. {
  855. return ucd_isdigit(c);
  856. }
  857. /** @brief Is the codepoint in the 'graph' class?
  858. *
  859. * @param c The Unicode codepoint to check.
  860. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  861. */
  862. inline int isgraph(codepoint_t c)
  863. {
  864. return ucd_isgraph(c);
  865. }
  866. /** @brief Is the codepoint in the 'lower' class?
  867. *
  868. * @param c The Unicode codepoint to check.
  869. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  870. */
  871. inline int islower(codepoint_t c)
  872. {
  873. return ucd_islower(c);
  874. }
  875. /** @brief Is the codepoint in the 'print' class?
  876. *
  877. * @param c The Unicode codepoint to check.
  878. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  879. */
  880. inline int isprint(codepoint_t c)
  881. {
  882. return ucd_isprint(c);
  883. }
  884. /** @brief Is the codepoint in the 'punct' class?
  885. *
  886. * @param c The Unicode codepoint to check.
  887. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  888. */
  889. inline int ispunct(codepoint_t c)
  890. {
  891. return ucd_ispunct(c);
  892. }
  893. /** @brief Is the codepoint in the 'space' class?
  894. *
  895. * @param c The Unicode codepoint to check.
  896. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  897. */
  898. inline int isspace(codepoint_t c)
  899. {
  900. return ucd_isspace(c);
  901. }
  902. /** @brief Is the codepoint in the 'upper' class?
  903. *
  904. * @param c The Unicode codepoint to check.
  905. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  906. */
  907. inline int isupper(codepoint_t c)
  908. {
  909. return ucd_isupper(c);
  910. }
  911. /** @brief Is the codepoint in the 'xdigit' class?
  912. *
  913. * @param c The Unicode codepoint to check.
  914. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  915. */
  916. inline int isxdigit(codepoint_t c)
  917. {
  918. return ucd_isxdigit(c);
  919. }
  920. /** @brief Convert the Unicode codepoint to upper-case.
  921. *
  922. * This function only uses the simple case mapping present in the
  923. * UnicodeData file. The data in SpecialCasing requires Unicode
  924. * codepoints to be mapped to multiple codepoints.
  925. *
  926. * @param c The Unicode codepoint to convert.
  927. * @return The upper-case Unicode codepoint for this codepoint, or
  928. * this codepoint if there is no upper-case codepoint.
  929. */
  930. inline codepoint_t toupper(codepoint_t c)
  931. {
  932. return ucd_toupper(c);
  933. }
  934. /** @brief Convert the Unicode codepoint to lower-case.
  935. *
  936. * This function only uses the simple case mapping present in the
  937. * UnicodeData file. The data in SpecialCasing requires Unicode
  938. * codepoints to be mapped to multiple codepoints.
  939. *
  940. * @param c The Unicode codepoint to convert.
  941. * @return The lower-case Unicode codepoint for this codepoint, or
  942. * this codepoint if there is no upper-case codepoint.
  943. */
  944. inline codepoint_t tolower(codepoint_t c)
  945. {
  946. return ucd_tolower(c);
  947. }
  948. /** @brief Convert the Unicode codepoint to title-case.
  949. *
  950. * This function only uses the simple case mapping present in the
  951. * UnicodeData file. The data in SpecialCasing requires Unicode
  952. * codepoints to be mapped to multiple codepoints.
  953. *
  954. * @param c The Unicode codepoint to convert.
  955. * @return The title-case Unicode codepoint for this codepoint, or
  956. * this codepoint if there is no upper-case codepoint.
  957. */
  958. inline codepoint_t totitle(codepoint_t c)
  959. {
  960. return ucd_totitle(c);
  961. }
  962. }
  963. #endif
  964. #endif