## 9.0.0.1 - (In Progress) | ## 9.0.0.1 - (In Progress) | ||||
* Add `iswblank` compatibility. | |||||
* Add `iswblank` and `iswxdigit` compatibility. | |||||
## 9.0.0 - 2016-12-28 | ## 9.0.0 - 2016-12-28 | ||||
The following character classification functions are provided: | The following character classification functions are provided: | ||||
| C API | C++ API | | |||||
|---------------|----------------| | |||||
| `ucd_isalnum` | `ucd::isalnum` | | |||||
| `ucd_isalpha` | `ucd::isalpha` | | |||||
| `ucd_isblank` | `ucd::isblank` | | |||||
| `ucd_iscntrl` | `ucd::iscntrl` | | |||||
| `ucd_isdigit` | `ucd::isdigit` | | |||||
| `ucd_isgraph` | `ucd::isgraph` | | |||||
| `ucd_islower` | `ucd::islower` | | |||||
| `ucd_isprint` | `ucd::isprint` | | |||||
| `ucd_ispunct` | `ucd::ispunct` | | |||||
| `ucd_isspace` | `ucd::isspace` | | |||||
| `ucd_isupper` | `ucd::isupper` | | |||||
__NOTE:__ An equivalent for `isxdigit` is not provided. | |||||
| C API | C++ API | | |||||
|----------------|-----------------| | |||||
| `ucd_isalnum` | `ucd::isalnum` | | |||||
| `ucd_isalpha` | `ucd::isalpha` | | |||||
| `ucd_isblank` | `ucd::isblank` | | |||||
| `ucd_iscntrl` | `ucd::iscntrl` | | |||||
| `ucd_isdigit` | `ucd::isdigit` | | |||||
| `ucd_isgraph` | `ucd::isgraph` | | |||||
| `ucd_islower` | `ucd::islower` | | |||||
| `ucd_isprint` | `ucd::isprint` | | |||||
| `ucd_ispunct` | `ucd::ispunct` | | |||||
| `ucd_isspace` | `ucd::isspace` | | |||||
| `ucd_isupper` | `ucd::isupper` | | |||||
| `ucd_isxdigit` | `ucd::isxdigit` | | |||||
## Build Dependencies | ## Build Dependencies | ||||
{ | { | ||||
return ucd_lookup_category(c) == UCD_CATEGORY_Lu; | return ucd_lookup_category(c) == UCD_CATEGORY_Lu; | ||||
} | } | ||||
int ucd_isxdigit(codepoint_t c) | |||||
{ | |||||
return (c >= 0x30 && c <= 0x39) // [0-9] | |||||
|| (c >= 0x41 && c <= 0x46) // [A-Z] | |||||
|| (c >= 0x61 && c <= 0x66); // [a-z] | |||||
} |
*/ | */ | ||||
int ucd_isupper(codepoint_t c); | int ucd_isupper(codepoint_t c); | ||||
/** @brief Is the codepoint in the 'xdigit' class? | |||||
* | |||||
* @param c The Unicode codepoint to check. | |||||
* @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise. | |||||
*/ | |||||
int ucd_isxdigit(codepoint_t c); | |||||
/** @brief Convert the Unicode codepoint to upper-case. | /** @brief Convert the Unicode codepoint to upper-case. | ||||
* | * | ||||
* This function only uses the simple case mapping present in the | * This function only uses the simple case mapping present in the | ||||
return ucd_isupper(c); | return ucd_isupper(c); | ||||
} | } | ||||
/** @brief Is the codepoint in the 'xdigit' class? | |||||
* | |||||
* @param c The Unicode codepoint to check. | |||||
* @return Non-zero if the codepoint is in the 'xdigit' class, zero otherwise. | |||||
*/ | |||||
inline int isxdigit(codepoint_t c) | |||||
{ | |||||
return ucd_isxdigit(c); | |||||
} | |||||
/** @brief Convert the Unicode codepoint to upper-case. | /** @brief Convert the Unicode codepoint to upper-case. | ||||
* | * | ||||
* This function only uses the simple case mapping present in the | * This function only uses the simple case mapping present in the |
case 'u': // upper case | case 'u': // upper case | ||||
fputc(iswupper(c) ? '1' : '0', out); | fputc(iswupper(c) ? '1' : '0', out); | ||||
break; | break; | ||||
case 'x': // xdigit | |||||
fputc(iswxdigit(c) ? '1' : '0', out); | |||||
break; | |||||
} | } | ||||
} | } | ||||
case 'u': // upper case | case 'u': // upper case | ||||
fputc(ucd_isupper(c) ? '1' : '0', out); | fputc(ucd_isupper(c) ? '1' : '0', out); | ||||
break; | break; | ||||
case 'x': // xdigit | |||||
fputc(ucd_isxdigit(c) ? '1' : '0', out); | |||||
break; | |||||
} | } | ||||
} | } | ||||
case 'u': // upper case | case 'u': // upper case | ||||
fputc(ucd::isupper(c) ? '1' : '0', out); | fputc(ucd::isupper(c) ? '1' : '0', out); | ||||
break; | break; | ||||
case 'x': // xdigit | |||||
fputc(ucd::isxdigit(c) ? '1' : '0', out); | |||||
break; | |||||
} | } | ||||
} | } | ||||