20 #ifndef INCLUDE_UNICODE_CHAR_H_
21 #define INCLUDE_UNICODE_CHAR_H_
36 using UChar = int32_t;
40 Cc, Cf, Co, Cs, Ll, Lm, Lo, Lt, Lu, Mc,
41 Me, Mn, Nd, Nl, No, Pc, Pd, Pe, Pf, Pi,
42 Po, Ps, Sc, Sk, Sm, So, Zl, Zp, Zs
51 std::ostream& operator<<(std::ostream&, GeneralCategory);
53 std::ostream& operator<<(std::ostream&, BaseGeneralCategory);
55 enum class BidirectionalCategory {
56 AL, AN, B, BN, CS, EN, ES, ET, FSI, L,
57 LRE, LRI, LRO, NSM, ON, PDF, PDI, R, RLE, RLI,
62 std::ostream&
operator<<(std::ostream&, BidirectionalCategory);
66 NO_MAPPING, CANONICAL, CIRCLE, COMPAT, FINAL, FONT, FRACTION, INITIAL, ISOLATED, MEDIAL,
67 NARROW, NOBREAK, SMALL, SQUARE, SUB, SUPER, VERTICAL, WIDE
71 std::ostream& operator<<(std::ostream&, DecompositionMappingTag);
74 GeneralCategory getGeneralCategory(UChar code);
76 BaseGeneralCategory getBaseGeneralCategory(UChar code);
79 int32_t getCanonicalCombiningClass(UChar code);
82 BidirectionalCategory getBidirectionalCategory(UChar code);
85 DecompositionMappingTag getDecompositionMappingTag(UChar code);
87 std::vector<UChar> getDecompositionMapping(UChar code);
89 void getDecompositionMapping(UChar code, UChar buffer[]);
95 int32_t getDecimalDigitValue(UChar code);
100 int32_t getDigitValue(UChar code);
105 double getNumericValue(UChar code);
110 std::pair<int64_t, int64_t> getNumericFraction(UChar code);
113 bool isMirrored(UChar code);
120 UChar getUpperCase(UChar code);
126 UChar getLowerCase(UChar code);
132 UChar getTitleCase(UChar code);
135 std::string toUTF8(UChar code);
137 std::string toUTF8(
const std::vector<UChar> codes);
139 UChar fromUTF8Char(
const std::string& str);
141 std::vector<UChar> fromUTF8(
const std::string& str);
144 std::u16string toUTF16(
const std::vector<UChar> codes);
146 std::vector<UChar> fromUTF16(
const std::u16string& str);
150 #endif // INCLUDE_UNICODE_CHAR_H_