mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-23 09:48:56 +00:00
LibUnicode: Add a helper to determine if a code point is printable
This commit is contained in:
parent
14c3bff5da
commit
1bbe8309d4
Notes:
github-actions[bot]
2024-10-22 10:50:00 +00:00
Author: https://github.com/trflynn89
Commit: 1bbe8309d4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1906
Reviewed-by: https://github.com/gmta ✅
2 changed files with 6 additions and 0 deletions
|
@ -108,6 +108,11 @@ bool code_point_has_general_category(u32 code_point, GeneralCategory general_cat
|
||||||
return u_charType(icu_code_point) == icu_general_category;
|
return u_charType(icu_code_point) == icu_general_category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool code_point_is_printable(u32 code_point)
|
||||||
|
{
|
||||||
|
return static_cast<bool>(u_isprint(static_cast<UChar32>(code_point)));
|
||||||
|
}
|
||||||
|
|
||||||
bool code_point_has_control_general_category(u32 code_point)
|
bool code_point_has_control_general_category(u32 code_point)
|
||||||
{
|
{
|
||||||
return code_point_has_general_category(code_point, U_CONTROL_CHAR);
|
return code_point_has_general_category(code_point, U_CONTROL_CHAR);
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace Unicode {
|
||||||
Optional<GeneralCategory> general_category_from_string(StringView);
|
Optional<GeneralCategory> general_category_from_string(StringView);
|
||||||
bool code_point_has_general_category(u32 code_point, GeneralCategory general_category);
|
bool code_point_has_general_category(u32 code_point, GeneralCategory general_category);
|
||||||
|
|
||||||
|
bool code_point_is_printable(u32 code_point);
|
||||||
bool code_point_has_control_general_category(u32 code_point);
|
bool code_point_has_control_general_category(u32 code_point);
|
||||||
bool code_point_has_letter_general_category(u32 code_point);
|
bool code_point_has_letter_general_category(u32 code_point);
|
||||||
bool code_point_has_number_general_category(u32 code_point);
|
bool code_point_has_number_general_category(u32 code_point);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue