Add an iswblank compatibility API.

This commit is contained in:
Reece H. Dunn
2017-02-11 17:37:42 +00:00
parent d10f63b710
commit d585c77804
7 changed files with 45 additions and 1 deletions
+13
View File
@@ -53,6 +53,19 @@ int ucd_isalpha(codepoint_t c)
}
}
int ucd_isblank(codepoint_t c)
{
switch (ucd_lookup_category(c))
{
case UCD_CATEGORY_Zs:
return 1;
case UCD_CATEGORY_Cc:
return c == 0x09; // U+0009 : CHARACTER TABULATION
default:
return 0;
}
}
int ucd_iscntrl(codepoint_t c)
{
return ucd_lookup_category(c) == UCD_CATEGORY_Cc;
+17
View File
@@ -339,6 +339,13 @@ int ucd_isalnum(codepoint_t c);
*/
int ucd_isalpha(codepoint_t c);
/** @brief Is the codepoint a tab or Unicode whitespace character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a whitespace character, zero otherwise.
*/
int ucd_isblank(codepoint_t c);
/** @brief Is the codepoint a control character?
*
* @param c The Unicode codepoint to check.
@@ -776,6 +783,16 @@ namespace ucd
return ucd_isalpha(c);
}
/** @brief Is the codepoint a tab or Unicode whitespace character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a whitespace character, zero otherwise.
*/
inline int isblank(codepoint_t c)
{
return ucd_isblank(c);
}
/** @brief Is the codepoint a control character?
*
* @param c The Unicode codepoint to check.