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 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  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 enum ucd_property_
  309. {
  310. UCD_PROPERTY_WHITE_SPACE = 0x00000001, /**< @brief White_Space PropList */
  311. UCD_PROPERTY_NO_BREAK = 0x00000002, /**< @brief <noBreak> DispositionType (enabled check only) */
  312. UCD_PROPERTY_BIDI_CONTROL = 0x00000004, /**< @brief Bidi_Control PropList */
  313. UCD_PROPERTY_JOIN_CONTROL = 0x00000008, /**< @brief Join_Control PropList */
  314. UCD_PROPERTY_DASH = 0x00000010, /**< @brief Dash PropList */
  315. UCD_PROPERTY_HYPHEN = 0x00000020, /**< @brief Hyphen PropList */
  316. UCD_PROPERTY_QUOTATION_MARK = 0x00000040, /**< @brief Quotation_Mark PropList */
  317. UCD_PROPERTY_TERMINAL_PUNCTUATION = 0x00000080, /**< @brief Terminal_Punctuation PropList */
  318. } ucd_property;
  319. /** @brief Return the properties of the specified codepoint.
  320. *
  321. * @param c The Unicode codepoint to lookup.
  322. * @param category The General Category of the codepoint.
  323. * @return The properties associated with the codepoint.
  324. */
  325. ucd_property ucd_properties(codepoint_t c, ucd_category category);
  326. /** @brief Is the codepoint in the 'alnum' class?
  327. *
  328. * @param c The Unicode codepoint to check.
  329. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  330. */
  331. int ucd_isalnum(codepoint_t c);
  332. /** @brief Is the codepoint in the 'alpha' class?
  333. *
  334. * @param c The Unicode codepoint to check.
  335. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  336. */
  337. int ucd_isalpha(codepoint_t c);
  338. /** @brief Is the codepoint in the 'blank' class?
  339. *
  340. * @param c The Unicode codepoint to check.
  341. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  342. */
  343. int ucd_isblank(codepoint_t c);
  344. /** @brief Is the codepoint in the 'cntrl' class?
  345. *
  346. * @param c The Unicode codepoint to check.
  347. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  348. */
  349. int ucd_iscntrl(codepoint_t c);
  350. /** @brief Is the codepoint in the 'digit' class?
  351. *
  352. * @param c The Unicode codepoint to check.
  353. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  354. */
  355. int ucd_isdigit(codepoint_t c);
  356. /** @brief Is the codepoint in the 'graph' class?
  357. *
  358. * @param c The Unicode codepoint to check.
  359. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  360. */
  361. int ucd_isgraph(codepoint_t c);
  362. /** @brief Is the codepoint in the 'lower' class?
  363. *
  364. * @param c The Unicode codepoint to check.
  365. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  366. */
  367. int ucd_islower(codepoint_t c);
  368. /** @brief Is the codepoint in the 'print' class?
  369. *
  370. * @param c The Unicode codepoint to check.
  371. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  372. */
  373. int ucd_isprint(codepoint_t c);
  374. /** @brief Is the codepoint in the 'punct' class?
  375. *
  376. * @param c The Unicode codepoint to check.
  377. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  378. */
  379. int ucd_ispunct(codepoint_t c);
  380. /** @brief Is the codepoint in the 'space' class?
  381. *
  382. * @param c The Unicode codepoint to check.
  383. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  384. */
  385. int ucd_isspace(codepoint_t c);
  386. /** @brief Is the codepoint in the 'upper' class?
  387. *
  388. * @param c The Unicode codepoint to check.
  389. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  390. */
  391. int ucd_isupper(codepoint_t c);
  392. /** @brief Is the codepoint in the 'xdigit' class?
  393. *
  394. * @param c The Unicode codepoint to check.
  395. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  396. */
  397. int ucd_isxdigit(codepoint_t c);
  398. /** @brief Convert the Unicode codepoint to upper-case.
  399. *
  400. * This function only uses the simple case mapping present in the
  401. * UnicodeData file. The data in SpecialCasing requires Unicode
  402. * codepoints to be mapped to multiple codepoints.
  403. *
  404. * @param c The Unicode codepoint to convert.
  405. * @return The upper-case Unicode codepoint for this codepoint, or
  406. * this codepoint if there is no upper-case codepoint.
  407. */
  408. codepoint_t ucd_toupper(codepoint_t c);
  409. /** @brief Convert the Unicode codepoint to lower-case.
  410. *
  411. * This function only uses the simple case mapping present in the
  412. * UnicodeData file. The data in SpecialCasing requires Unicode
  413. * codepoints to be mapped to multiple codepoints.
  414. *
  415. * @param c The Unicode codepoint to convert.
  416. * @return The lower-case Unicode codepoint for this codepoint, or
  417. * this codepoint if there is no upper-case codepoint.
  418. */
  419. codepoint_t ucd_tolower(codepoint_t c);
  420. /** @brief Convert the Unicode codepoint to title-case.
  421. *
  422. * This function only uses the simple case mapping present in the
  423. * UnicodeData file. The data in SpecialCasing requires Unicode
  424. * codepoints to be mapped to multiple codepoints.
  425. *
  426. * @param c The Unicode codepoint to convert.
  427. * @return The title-case Unicode codepoint for this codepoint, or
  428. * this codepoint if there is no upper-case codepoint.
  429. */
  430. codepoint_t ucd_totitle(codepoint_t c);
  431. #ifdef __cplusplus
  432. }
  433. /** @brief Unicode Character Database
  434. */
  435. namespace ucd
  436. {
  437. /** @brief Represents a Unicode codepoint.
  438. */
  439. using ::codepoint_t;
  440. /** @brief Unicode General Category Groups
  441. * @see http://www.unicode.org/reports/tr44/
  442. */
  443. enum category_group
  444. {
  445. C = UCD_CATEGORY_GROUP_C, /**< @brief Other */
  446. I = UCD_CATEGORY_GROUP_I, /**< @brief Invalid */
  447. L = UCD_CATEGORY_GROUP_L, /**< @brief Letter */
  448. M = UCD_CATEGORY_GROUP_M, /**< @brief Mark */
  449. N = UCD_CATEGORY_GROUP_N, /**< @brief Number */
  450. P = UCD_CATEGORY_GROUP_P, /**< @brief Punctuation */
  451. S = UCD_CATEGORY_GROUP_S, /**< @brief Symbol */
  452. Z = UCD_CATEGORY_GROUP_Z, /**< @brief Separator */
  453. };
  454. /** @brief Get a string representation of the category_group enumeration value.
  455. *
  456. * @param c The value to get the string representation for.
  457. *
  458. * @return The string representation, or "-" if the value is not recognized.
  459. */
  460. inline const char *get_category_group_string(category_group c)
  461. {
  462. return ucd_get_category_group_string((ucd_category_group)c);
  463. }
  464. /** @brief Unicode General Category Values
  465. * @see http://www.unicode.org/reports/tr44/
  466. */
  467. enum category
  468. {
  469. Cc = UCD_CATEGORY_Cc, /**< @brief Control Character */
  470. Cf = UCD_CATEGORY_Cf, /**< @brief Format Control Character */
  471. Cn = UCD_CATEGORY_Cn, /**< @brief Unassigned */
  472. Co = UCD_CATEGORY_Co, /**< @brief Private Use */
  473. Cs = UCD_CATEGORY_Cs, /**< @brief Surrogate Code Point */
  474. Ii = UCD_CATEGORY_Ii, /**< @brief Invalid Unicode Codepoint */
  475. Ll = UCD_CATEGORY_Ll, /**< @brief Lower Case Letter */
  476. Lm = UCD_CATEGORY_Lm, /**< @brief Letter Modifier */
  477. Lo = UCD_CATEGORY_Lo, /**< @brief Other Letter */
  478. Lt = UCD_CATEGORY_Lt, /**< @brief Title Case Letter */
  479. Lu = UCD_CATEGORY_Lu, /**< @brief Upper Case Letter */
  480. Mc = UCD_CATEGORY_Mc, /**< @brief Spacing Mark */
  481. Me = UCD_CATEGORY_Me, /**< @brief Enclosing Mark */
  482. Mn = UCD_CATEGORY_Mn, /**< @brief Non-Spacing Mark */
  483. Nd = UCD_CATEGORY_Nd, /**< @brief Decimal Digit */
  484. Nl = UCD_CATEGORY_Nl, /**< @brief Letter-Like Number */
  485. No = UCD_CATEGORY_No, /**< @brief Other Number */
  486. Pc = UCD_CATEGORY_Pc, /**< @brief Connector */
  487. Pd = UCD_CATEGORY_Pd, /**< @brief Dash/Hyphen */
  488. Pe = UCD_CATEGORY_Pe, /**< @brief Close Punctuation Mark */
  489. Pf = UCD_CATEGORY_Pf, /**< @brief Final Quotation Mark */
  490. Pi = UCD_CATEGORY_Pi, /**< @brief Initial Quotation Mark */
  491. Po = UCD_CATEGORY_Po, /**< @brief Other */
  492. Ps = UCD_CATEGORY_Ps, /**< @brief Open Punctuation Mark */
  493. Sc = UCD_CATEGORY_Sc, /**< @brief Currency Symbol */
  494. Sk = UCD_CATEGORY_Sk, /**< @brief Modifier Symbol */
  495. Sm = UCD_CATEGORY_Sm, /**< @brief Math Symbol */
  496. So = UCD_CATEGORY_So, /**< @brief Other Symbol */
  497. Zl = UCD_CATEGORY_Zl, /**< @brief Line Separator */
  498. Zp = UCD_CATEGORY_Zp, /**< @brief Paragraph Separator */
  499. Zs = UCD_CATEGORY_Zs, /**< @brief Space Separator */
  500. };
  501. /** @brief Get a string representation of the category enumeration value.
  502. *
  503. * @param c The value to get the string representation for.
  504. *
  505. * @return The string representation, or "--" if the value is not recognized.
  506. */
  507. inline const char *get_category_string(category c)
  508. {
  509. return ucd_get_category_string((ucd_category)c);
  510. }
  511. /** @brief Lookup the General Category Group for a General Category.
  512. *
  513. * @param c The General Category to lookup.
  514. * @return The General Category Group of the General Category.
  515. */
  516. inline category_group lookup_category_group(category c)
  517. {
  518. return (category_group)ucd_get_category_group_for_category((ucd_category)c);
  519. }
  520. /** @brief Lookup the General Category Group for a Unicode codepoint.
  521. *
  522. * @param c The Unicode codepoint to lookup.
  523. * @return The General Category Group of the Unicode codepoint.
  524. */
  525. inline category_group lookup_category_group(codepoint_t c)
  526. {
  527. return (category_group)ucd_lookup_category_group(c);
  528. }
  529. /** @brief Lookup the General Category for a Unicode codepoint.
  530. *
  531. * @param c The Unicode codepoint to lookup.
  532. * @return The General Category of the Unicode codepoint.
  533. */
  534. inline category lookup_category(codepoint_t c)
  535. {
  536. return (category)ucd_lookup_category(c);
  537. }
  538. /** @brief Unicode Script
  539. * @see http://www.iana.org/assignments/language-subtag-registry
  540. * @see http://www.unicode.org/iso15924/iso15924-codes.html
  541. */
  542. enum script
  543. {
  544. Adlm = UCD_SCRIPT_Adlm, /**< @brief Adlam Script */
  545. Afak = UCD_SCRIPT_Afak, /**< @brief Afaka Script */
  546. Aghb = UCD_SCRIPT_Aghb, /**< @brief Caucasian Albanian Script */
  547. Ahom = UCD_SCRIPT_Ahom, /**< @brief Tai Ahom Script */
  548. Arab = UCD_SCRIPT_Arab, /**< @brief Arabic Script */
  549. Armi = UCD_SCRIPT_Armi, /**< @brief Imperial Aramaic Script */
  550. Armn = UCD_SCRIPT_Armn, /**< @brief Armenian Script */
  551. Avst = UCD_SCRIPT_Avst, /**< @brief Avestan Script */
  552. Bali = UCD_SCRIPT_Bali, /**< @brief Balinese Script */
  553. Bamu = UCD_SCRIPT_Bamu, /**< @brief Bamum Script */
  554. Bass = UCD_SCRIPT_Bass, /**< @brief Bassa Vah Script */
  555. Batk = UCD_SCRIPT_Batk, /**< @brief Batak Script */
  556. Beng = UCD_SCRIPT_Beng, /**< @brief Bengali Script */
  557. Bhks = UCD_SCRIPT_Bhks, /**< @brief Bhaiksuki Script */
  558. Blis = UCD_SCRIPT_Blis, /**< @brief Blissymbols Script */
  559. Bopo = UCD_SCRIPT_Bopo, /**< @brief Bopomofo Script */
  560. Brah = UCD_SCRIPT_Brah, /**< @brief Brahmi Script */
  561. Brai = UCD_SCRIPT_Brai, /**< @brief Braille Script */
  562. Bugi = UCD_SCRIPT_Bugi, /**< @brief Buginese Script */
  563. Buhd = UCD_SCRIPT_Buhd, /**< @brief Buhid Script */
  564. Cakm = UCD_SCRIPT_Cakm, /**< @brief Chakma Script */
  565. Cans = UCD_SCRIPT_Cans, /**< @brief Unified Canadian Aboriginal Syllabics */
  566. Cari = UCD_SCRIPT_Cari, /**< @brief Carian Script */
  567. Cham = UCD_SCRIPT_Cham, /**< @brief Cham Script */
  568. Cher = UCD_SCRIPT_Cher, /**< @brief Cherokee Script */
  569. Cirt = UCD_SCRIPT_Cirt, /**< @brief Cirth Script */
  570. Copt = UCD_SCRIPT_Copt, /**< @brief Coptic Script */
  571. Cprt = UCD_SCRIPT_Cprt, /**< @brief Cypriot Script */
  572. Cyrl = UCD_SCRIPT_Cyrl, /**< @brief Cyrillic Script */
  573. Cyrs = UCD_SCRIPT_Cyrs, /**< @brief Cyrillic (Old Church Slavonic variant) Script */
  574. Deva = UCD_SCRIPT_Deva, /**< @brief Devanagari Script */
  575. Dsrt = UCD_SCRIPT_Dsrt, /**< @brief Deseret Script */
  576. Dupl = UCD_SCRIPT_Dupl, /**< @brief Duployan Shorthand Script */
  577. Egyd = UCD_SCRIPT_Egyd, /**< @brief Egyptian Demotic Script */
  578. Egyh = UCD_SCRIPT_Egyh, /**< @brief Egyptian Hieratic Script */
  579. Egyp = UCD_SCRIPT_Egyp, /**< @brief Egyptian Hiegoglyphs */
  580. Elba = UCD_SCRIPT_Elba, /**< @brief Elbasan Script */
  581. Ethi = UCD_SCRIPT_Ethi, /**< @brief Ethiopic Script */
  582. Geok = UCD_SCRIPT_Geok, /**< @brief Khutsuri Script */
  583. Geor = UCD_SCRIPT_Geor, /**< @brief Geirgian Script */
  584. Glag = UCD_SCRIPT_Glag, /**< @brief Glagolitic Script */
  585. Goth = UCD_SCRIPT_Goth, /**< @brief Gothic Script */
  586. Gran = UCD_SCRIPT_Gran, /**< @brief Grantha Script */
  587. Grek = UCD_SCRIPT_Grek, /**< @brief Greek Script */
  588. Gujr = UCD_SCRIPT_Gujr, /**< @brief Gujarati Script */
  589. Guru = UCD_SCRIPT_Guru, /**< @brief Gurmukhi Script */
  590. Hang = UCD_SCRIPT_Hang, /**< @brief Hangul Script */
  591. Hani = UCD_SCRIPT_Hani, /**< @brief Han (Hanzi, Kanji, Hanja) Script */
  592. Hano = UCD_SCRIPT_Hano, /**< @brief Hanunoo Script */
  593. Hans = UCD_SCRIPT_Hans, /**< @brief Han (Simplified) Script */
  594. Hant = UCD_SCRIPT_Hant, /**< @brief Han (Traditional) Script */
  595. Hatr = UCD_SCRIPT_Hatr, /**< @brief Hatran Script */
  596. Hebr = UCD_SCRIPT_Hebr, /**< @brief Hebrew Script */
  597. Hira = UCD_SCRIPT_Hira, /**< @brief Hiragana Script */
  598. Hluw = UCD_SCRIPT_Hluw, /**< @brief Anatolian Hieroglyphs */
  599. Hmng = UCD_SCRIPT_Hmng, /**< @brief Pahawh Hmong Script */
  600. Hrkt = UCD_SCRIPT_Hrkt, /**< @brief Japanese Syllabaries */
  601. Hung = UCD_SCRIPT_Hung, /**< @brief Old Hungarian Script */
  602. Inds = UCD_SCRIPT_Inds, /**< @brief Indus Script */
  603. Ital = UCD_SCRIPT_Ital, /**< @brief Old Italic Script */
  604. Java = UCD_SCRIPT_Java, /**< @brief Javanese Script */
  605. Jpan = UCD_SCRIPT_Jpan, /**< @brief Japanese (Han + Hiragana + Katakana) Scripts */
  606. Jurc = UCD_SCRIPT_Jurc, /**< @brief Jurchen Script */
  607. Kali = UCD_SCRIPT_Kali, /**< @brief Kayah Li Script */
  608. Kana = UCD_SCRIPT_Kana, /**< @brief Katakana Script */
  609. Khar = UCD_SCRIPT_Khar, /**< @brief Kharoshthi Script */
  610. Khmr = UCD_SCRIPT_Khmr, /**< @brief Khmer Script */
  611. Khoj = UCD_SCRIPT_Khoj, /**< @brief Khojki Script */
  612. Knda = UCD_SCRIPT_Knda, /**< @brief Kannada Script */
  613. Kore = UCD_SCRIPT_Kore, /**< @brief Korean (Hangul + Han) Scripts */
  614. Kpel = UCD_SCRIPT_Kpel, /**< @brief Kpelle Script */
  615. Kthi = UCD_SCRIPT_Kthi, /**< @brief Kaithi Script */
  616. Lana = UCD_SCRIPT_Lana, /**< @brief Tai Tham Script */
  617. Laoo = UCD_SCRIPT_Laoo, /**< @brief Lao Script */
  618. Latf = UCD_SCRIPT_Latf, /**< @brief Latin Script (Fractur Variant) */
  619. Latg = UCD_SCRIPT_Latg, /**< @brief Latin Script (Gaelic Variant) */
  620. Latn = UCD_SCRIPT_Latn, /**< @brief Latin Script */
  621. Lepc = UCD_SCRIPT_Lepc, /**< @brief Lepcha Script */
  622. Limb = UCD_SCRIPT_Limb, /**< @brief Limbu Script */
  623. Lina = UCD_SCRIPT_Lina, /**< @brief Linear A Script */
  624. Linb = UCD_SCRIPT_Linb, /**< @brief Linear B Script */
  625. Lisu = UCD_SCRIPT_Lisu, /**< @brief Lisu Script */
  626. Loma = UCD_SCRIPT_Loma, /**< @brief Loma Script */
  627. Lyci = UCD_SCRIPT_Lyci, /**< @brief Lycian Script */
  628. Lydi = UCD_SCRIPT_Lydi, /**< @brief Lydian Script */
  629. Mahj = UCD_SCRIPT_Mahj, /**< @brief Mahajani Script */
  630. Mand = UCD_SCRIPT_Mand, /**< @brief Mandaic Script */
  631. Mani = UCD_SCRIPT_Mani, /**< @brief Manichaean Script */
  632. Marc = UCD_SCRIPT_Marc, /**< @brief Marchen Script */
  633. Maya = UCD_SCRIPT_Maya, /**< @brief Mayan Hieroglyphs */
  634. Mend = UCD_SCRIPT_Mend, /**< @brief Mende Kikakui Script */
  635. Merc = UCD_SCRIPT_Merc, /**< @brief Meroitic Cursive Script */
  636. Mero = UCD_SCRIPT_Mero, /**< @brief Meroitic Hieroglyphs */
  637. Mlym = UCD_SCRIPT_Mlym, /**< @brief Malayalam Script */
  638. Modi = UCD_SCRIPT_Modi, /**< @brief Modi Script */
  639. Mong = UCD_SCRIPT_Mong, /**< @brief Mongolian Script */
  640. Moon = UCD_SCRIPT_Moon, /**< @brief Moon Script */
  641. Mroo = UCD_SCRIPT_Mroo, /**< @brief Mro Script */
  642. Mtei = UCD_SCRIPT_Mtei, /**< @brief Meitei Mayek Script */
  643. Mult = UCD_SCRIPT_Mult, /**< @brief Multani Script */
  644. Mymr = UCD_SCRIPT_Mymr, /**< @brief Myanmar (Burmese) Script */
  645. Narb = UCD_SCRIPT_Narb, /**< @brief Old North Arabian Script */
  646. Nbat = UCD_SCRIPT_Nbat, /**< @brief Nabataean Script */
  647. Newa = UCD_SCRIPT_Newa, /**< @brief Newa Script */
  648. Nkgb = UCD_SCRIPT_Nkgb, /**< @brief Nakhi Geba Script */
  649. Nkoo = UCD_SCRIPT_Nkoo, /**< @brief N'Ko Script */
  650. Nshu = UCD_SCRIPT_Nshu, /**< @brief Nushu Script */
  651. Ogam = UCD_SCRIPT_Ogam, /**< @brief Ogham Script */
  652. Olck = UCD_SCRIPT_Olck, /**< @brief Ol Chiki Script */
  653. Orkh = UCD_SCRIPT_Orkh, /**< @brief Old Turkic Script */
  654. Orya = UCD_SCRIPT_Orya, /**< @brief Oriya Script */
  655. Osge = UCD_SCRIPT_Osge, /**< @brief Osage Script */
  656. Osma = UCD_SCRIPT_Osma, /**< @brief Osmanya Script */
  657. Palm = UCD_SCRIPT_Palm, /**< @brief Palmyrene Script */
  658. Pauc = UCD_SCRIPT_Pauc, /**< @brief Pau Cin Hau Script */
  659. Perm = UCD_SCRIPT_Perm, /**< @brief Old Permic */
  660. Phag = UCD_SCRIPT_Phag, /**< @brief Phags-Pa Script */
  661. Phli = UCD_SCRIPT_Phli, /**< @brief Inscriptional Pahlavi Script */
  662. Phlp = UCD_SCRIPT_Phlp, /**< @brief Psalter Pahlavi Script */
  663. Phlv = UCD_SCRIPT_Phlv, /**< @brief Book Pahlavi Script */
  664. Phnx = UCD_SCRIPT_Phnx, /**< @brief Phoenician Script */
  665. Plrd = UCD_SCRIPT_Plrd, /**< @brief Miao Script */
  666. Prti = UCD_SCRIPT_Prti, /**< @brief Inscriptional Parthian Script */
  667. Qaak = UCD_SCRIPT_Qaak, /**< @brief Klingon Script (Private Use) */
  668. Rjng = UCD_SCRIPT_Rjng, /**< @brief Rejang Script */
  669. Roro = UCD_SCRIPT_Roro, /**< @brief Rongorongo Script */
  670. Runr = UCD_SCRIPT_Runr, /**< @brief Runic Script */
  671. Samr = UCD_SCRIPT_Samr, /**< @brief Samaritan Script */
  672. Sara = UCD_SCRIPT_Sara, /**< @brief Sarati Script */
  673. Sarb = UCD_SCRIPT_Sarb, /**< @brief Old South Arabian Script */
  674. Saur = UCD_SCRIPT_Saur, /**< @brief Saurashtra Script */
  675. Sgnw = UCD_SCRIPT_Sgnw, /**< @brief Sign Writing */
  676. Shaw = UCD_SCRIPT_Shaw, /**< @brief Shavian Script */
  677. Shrd = UCD_SCRIPT_Shrd, /**< @brief Sharada Script */
  678. Sidd = UCD_SCRIPT_Sidd, /**< @brief Siddham Script */
  679. Sind = UCD_SCRIPT_Sind, /**< @brief Sindhi Script */
  680. Sinh = UCD_SCRIPT_Sinh, /**< @brief Sinhala Script */
  681. Sora = UCD_SCRIPT_Sora, /**< @brief Sora Sompeng Script */
  682. Sund = UCD_SCRIPT_Sund, /**< @brief Sundanese Script */
  683. Sylo = UCD_SCRIPT_Sylo, /**< @brief Syloti Nagri Script */
  684. Syrc = UCD_SCRIPT_Syrc, /**< @brief Syriac Script */
  685. Syre = UCD_SCRIPT_Syre, /**< @brief Syriac Script (Estrangelo Variant) */
  686. Syrj = UCD_SCRIPT_Syrj, /**< @brief Syriac Script (Western Variant) */
  687. Syrn = UCD_SCRIPT_Syrn, /**< @brief Syriac Script (Eastern Variant) */
  688. Tagb = UCD_SCRIPT_Tagb, /**< @brief Tagbanwa Script */
  689. Takr = UCD_SCRIPT_Takr, /**< @brief Takri Script */
  690. Tale = UCD_SCRIPT_Tale, /**< @brief Tai Le Script */
  691. Talu = UCD_SCRIPT_Talu, /**< @brief New Tai Lue Script */
  692. Taml = UCD_SCRIPT_Taml, /**< @brief Tamil Script */
  693. Tang = UCD_SCRIPT_Tang, /**< @brief Tangut Script */
  694. Tavt = UCD_SCRIPT_Tavt, /**< @brief Tai Viet Script */
  695. Telu = UCD_SCRIPT_Telu, /**< @brief Telugu Script */
  696. Teng = UCD_SCRIPT_Teng, /**< @brief Tengwar Script */
  697. Tfng = UCD_SCRIPT_Tfng, /**< @brief Tifinagh Script */
  698. Tglg = UCD_SCRIPT_Tglg, /**< @brief Tagalog Script */
  699. Thaa = UCD_SCRIPT_Thaa, /**< @brief Thaana Script */
  700. Thai = UCD_SCRIPT_Thai, /**< @brief Thai Script */
  701. Tibt = UCD_SCRIPT_Tibt, /**< @brief Tibetan Script */
  702. Tirh = UCD_SCRIPT_Tirh, /**< @brief Tirhuta Script */
  703. Ugar = UCD_SCRIPT_Ugar, /**< @brief Ugaritic Script */
  704. Vaii = UCD_SCRIPT_Vaii, /**< @brief Vai Script */
  705. Visp = UCD_SCRIPT_Visp, /**< @brief Visible Speech Script */
  706. Wara = UCD_SCRIPT_Wara, /**< @brief Warang Citi Script */
  707. Wole = UCD_SCRIPT_Wole, /**< @brief Woleai Script */
  708. Xpeo = UCD_SCRIPT_Xpeo, /**< @brief Old Persian Script */
  709. Xsux = UCD_SCRIPT_Xsux, /**< @brief Cuneiform Script */
  710. Yiii = UCD_SCRIPT_Yiii, /**< @brief Yi Script */
  711. Zinh = UCD_SCRIPT_Zinh, /**< @brief Inherited Script */
  712. Zmth = UCD_SCRIPT_Zmth, /**< @brief Mathematical Notation */
  713. Zsym = UCD_SCRIPT_Zsym, /**< @brief Symbols */
  714. Zxxx = UCD_SCRIPT_Zxxx, /**< @brief Unwritten Documents */
  715. Zyyy = UCD_SCRIPT_Zyyy, /**< @brief Undetermined Script */
  716. Zzzz = UCD_SCRIPT_Zzzz, /**< @brief Uncoded Script */
  717. };
  718. /** @brief Get a string representation of the script enumeration value.
  719. *
  720. * @param s The value to get the string representation for.
  721. *
  722. * @return The string representation, or "----" if the value is not recognized.
  723. */
  724. inline const char *get_script_string(script s)
  725. {
  726. return ucd_get_script_string((ucd_script)s);
  727. }
  728. /** @brief Lookup the Script for a Unicode codepoint.
  729. *
  730. * @param c The Unicode codepoint to lookup.
  731. * @return The Script of the Unicode codepoint.
  732. */
  733. inline script lookup_script(codepoint_t c)
  734. {
  735. return (script)ucd_lookup_script(c);
  736. }
  737. /** @brief Properties
  738. */
  739. enum property
  740. {
  741. White_Space = UCD_PROPERTY_WHITE_SPACE, /**< @brief White_Space PropList */
  742. noBreak = UCD_PROPERTY_NO_BREAK, /**< @brief <noBreak> DispositionType (enabled check only) */
  743. Bidi_Control = UCD_PROPERTY_BIDI_CONTROL, /**< @brief Bidi_Control PropList */
  744. Join_Control = UCD_PROPERTY_JOIN_CONTROL, /**< @brief Join_Control PropList */
  745. Dash = UCD_PROPERTY_DASH, /**< @brief Dash PropList */
  746. Hyphen = UCD_PROPERTY_HYPHEN, /**< @brief Hyphen PropList */
  747. Quotation_Mark = UCD_PROPERTY_QUOTATION_MARK, /**< @brief Quotation_Mark PropList */
  748. Terminal_Punctuation = UCD_PROPERTY_TERMINAL_PUNCTUATION, /**< @brief Terminal_Punctuation PropList */
  749. };
  750. /** @brief Return the properties of the specified codepoint.
  751. *
  752. * @param c The Unicode codepoint to lookup.
  753. * @param cat The General Category of the codepoint.
  754. * @return The properties associated with the codepoint.
  755. */
  756. inline property properties(codepoint_t c, category cat)
  757. {
  758. return (property)ucd_properties(c, (ucd_category)cat);
  759. }
  760. /** @brief Is the codepoint in the 'alnum' class?
  761. *
  762. * @param c The Unicode codepoint to check.
  763. * @return Non-zero if the codepoint is in the 'alnum' class, zero otherwise.
  764. */
  765. inline int isalnum(codepoint_t c)
  766. {
  767. return ucd_isalnum(c);
  768. }
  769. /** @brief Is the codepoint in the 'alpha' class?
  770. *
  771. * @param c The Unicode codepoint to check.
  772. * @return Non-zero if the codepoint is in the 'alpha' class, zero otherwise.
  773. */
  774. inline int isalpha(codepoint_t c)
  775. {
  776. return ucd_isalpha(c);
  777. }
  778. /** @brief Is the codepoint in the 'blank' class?
  779. *
  780. * @param c The Unicode codepoint to check.
  781. * @return Non-zero if the codepoint is in the 'blank' class, zero otherwise.
  782. */
  783. inline int isblank(codepoint_t c)
  784. {
  785. return ucd_isblank(c);
  786. }
  787. /** @brief Is the codepoint in the 'cntrl' class?
  788. *
  789. * @param c The Unicode codepoint to check.
  790. * @return Non-zero if the codepoint is in the 'cntrl' class, zero otherwise.
  791. */
  792. inline int iscntrl(codepoint_t c)
  793. {
  794. return ucd_iscntrl(c);
  795. }
  796. /** @brief Is the codepoint in the 'digit' class?
  797. *
  798. * @param c The Unicode codepoint to check.
  799. * @return Non-zero if the codepoint is in the 'digit' class, zero otherwise.
  800. */
  801. inline int isdigit(codepoint_t c)
  802. {
  803. return ucd_isdigit(c);
  804. }
  805. /** @brief Is the codepoint in the 'graph' class?
  806. *
  807. * @param c The Unicode codepoint to check.
  808. * @return Non-zero if the codepoint is in the 'graph' class, zero otherwise.
  809. */
  810. inline int isgraph(codepoint_t c)
  811. {
  812. return ucd_isgraph(c);
  813. }
  814. /** @brief Is the codepoint in the 'lower' class?
  815. *
  816. * @param c The Unicode codepoint to check.
  817. * @return Non-zero if the codepoint is in the 'lower' class, zero otherwise.
  818. */
  819. inline int islower(codepoint_t c)
  820. {
  821. return ucd_islower(c);
  822. }
  823. /** @brief Is the codepoint in the 'print' class?
  824. *
  825. * @param c The Unicode codepoint to check.
  826. * @return Non-zero if the codepoint is in the 'print' class, zero otherwise.
  827. */
  828. inline int isprint(codepoint_t c)
  829. {
  830. return ucd_isprint(c);
  831. }
  832. /** @brief Is the codepoint in the 'punct' class?
  833. *
  834. * @param c The Unicode codepoint to check.
  835. * @return Non-zero if the codepoint is in the 'punct' class, zero otherwise.
  836. */
  837. inline int ispunct(codepoint_t c)
  838. {
  839. return ucd_ispunct(c);
  840. }
  841. /** @brief Is the codepoint in the 'space' class?
  842. *
  843. * @param c The Unicode codepoint to check.
  844. * @return Non-zero if the codepoint is in the 'space' class, zero otherwise.
  845. */
  846. inline int isspace(codepoint_t c)
  847. {
  848. return ucd_isspace(c);
  849. }
  850. /** @brief Is the codepoint in the 'upper' class?
  851. *
  852. * @param c The Unicode codepoint to check.
  853. * @return Non-zero if the codepoint is in the 'upper' class, zero otherwise.
  854. */
  855. inline int isupper(codepoint_t c)
  856. {
  857. return ucd_isupper(c);
  858. }
  859. /** @brief Is the codepoint in the 'xdigit' class?
  860. *
  861. * @param c The Unicode codepoint to check.
  862. * @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise.
  863. */
  864. inline int isxdigit(codepoint_t c)
  865. {
  866. return ucd_isxdigit(c);
  867. }
  868. /** @brief Convert the Unicode codepoint to upper-case.
  869. *
  870. * This function only uses the simple case mapping present in the
  871. * UnicodeData file. The data in SpecialCasing requires Unicode
  872. * codepoints to be mapped to multiple codepoints.
  873. *
  874. * @param c The Unicode codepoint to convert.
  875. * @return The upper-case Unicode codepoint for this codepoint, or
  876. * this codepoint if there is no upper-case codepoint.
  877. */
  878. inline codepoint_t toupper(codepoint_t c)
  879. {
  880. return ucd_toupper(c);
  881. }
  882. /** @brief Convert the Unicode codepoint to lower-case.
  883. *
  884. * This function only uses the simple case mapping present in the
  885. * UnicodeData file. The data in SpecialCasing requires Unicode
  886. * codepoints to be mapped to multiple codepoints.
  887. *
  888. * @param c The Unicode codepoint to convert.
  889. * @return The lower-case Unicode codepoint for this codepoint, or
  890. * this codepoint if there is no upper-case codepoint.
  891. */
  892. inline codepoint_t tolower(codepoint_t c)
  893. {
  894. return ucd_tolower(c);
  895. }
  896. /** @brief Convert the Unicode codepoint to title-case.
  897. *
  898. * This function only uses the simple case mapping present in the
  899. * UnicodeData file. The data in SpecialCasing requires Unicode
  900. * codepoints to be mapped to multiple codepoints.
  901. *
  902. * @param c The Unicode codepoint to convert.
  903. * @return The title-case Unicode codepoint for this codepoint, or
  904. * this codepoint if there is no upper-case codepoint.
  905. */
  906. inline codepoint_t totitle(codepoint_t c)
  907. {
  908. return ucd_totitle(c);
  909. }
  910. }
  911. #endif
  912. #endif