namespace GC { enum GC: uint16_t { Cc = encode_gc("Cc"), // Other: Control Cf = encode_gc("Cf"), // Other: Format Cn = encode_gc("Cn"), // Other: Unassigned Co = encode_gc("Co"), // Other: Private use Cs = encode_gc("Cs"), // Other: Surrogate Ll = encode_gc("Ll"), // Letter: Lowercase letter Lm = encode_gc("Lm"), // Letter: Modifier letter Lo = encode_gc("Lo"), // Letter: Other letter Lt = encode_gc("Lt"), // Letter: Titlecase letter Lu = encode_gc("Lu"), // Letter: Uppercase letter Mc = encode_gc("Mc"), // Mark: Spacing mark Me = encode_gc("Me"), // Mark: Enclosing mark Mn = encode_gc("Mn"), // Mark: Nonspacing mark Nd = encode_gc("Nd"), // Number: Decimal number Nl = encode_gc("Nl"), // Number: Letter number No = encode_gc("No"), // Number: Other number Pc = encode_gc("Pc"), // Punctuation: Connector punctuation Pd = encode_gc("Pd"), // Punctuation: Dash punctuation Pe = encode_gc("Pe"), // Punctuation: Close punctuation Pf = encode_gc("Pf"), // Punctuation: Final punctuation Pi = encode_gc("Pi"), // Punctuation: Initial punctuation Po = encode_gc("Po"), // Punctuation: Other punctuation Ps = encode_gc("Ps"), // Punctuation: Open punctuation Sc = encode_gc("Sc"), // Symbol: Currency symbol Sk = encode_gc("Sk"), // Symbol: Modifier symbol Sm = encode_gc("Sm"), // Symbol: Math symbol So = encode_gc("So"), // Symbol: Other symbol Zl = encode_gc("Zl"), // Separator: Line separator Zp = encode_gc("Zp"), // Separator: Paragraph separator Zs = encode_gc("Zs"), // Separator: Space separator }; inline std::ostream& operator<<(std::ostream& o, GC cat) { return o << decode_gc(cat); } }
inline uint16_t encode_gc(const u8string& cat) noexcept { return encode_gc(cat.data()); }
inline GC encode_gc(const Ustring& cat) noexcept { return encode_gc(cat.data()); }
constexpr uint16_t encode_gc(const char* cat) noexcept { return cat && *cat ? encode_gc(cat[0], cat[1]) : 0; }
constexpr GC encode_gc(const char* cat) noexcept { return cat && *cat ? encode_gc(cat[0], cat[1]) : GC(); }