Add support for looking up the general category group for a codepoint.

This commit is contained in:
Reece H. Dunn
2012-12-22 01:09:49 +00:00
parent 2282735a4c
commit ff7a5e0209
3 changed files with 69 additions and 18 deletions
+21
View File
@@ -3280,3 +3280,24 @@ ucd::category ucd::lookup_category(codepoint_t c)
if (c <= 0x10FFFF) return Cn; // 10FFFE..10FFFF : Plane 16 Private Use
return Ci;
}
ucd::category_group ucd::lookup_category_group(codepoint_t c)
{
switch (lookup_category(c))
{
case Cc: case Cf: case Ci: case Cn: case Co: case Cs: case Zc:
return C;
case Ll: case Lm: case Lo: case Lt: case Lu:
return L;
case Mc: case Me: case Mn:
return M;
case Nd: case Nl: case No:
return N;
case Pc: case Pd: case Pe: case Pf: case Pi: case Po: case Ps:
return P;
case Sc: case Sk: case Sm: case So:
return S;
case Zl: case Zp: case Zs:
return Z;
}
}