Add ctype-style APIs that are compatible with wctype.h.

This commit is contained in:
Reece H. Dunn
2012-12-22 00:56:39 +00:00
parent a416b4090c
commit 2282735a4c
3 changed files with 198 additions and 1 deletions
+80
View File
@@ -96,6 +96,86 @@ namespace ucd
* @return The General Category of the Unicode codepoint.
*/
category lookup_category(codepoint_t c);
/** @name ctype-style APIs
* @brief These functions provide wctype compatible functions using the UCD data.
*/
//@{
/** @brief Is the codepoint an alpha-numeric character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a letter or number, zero otherwise.
*/
int isalnum(codepoint_t c);
/** @brief Is the codepoint a letter?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a letter, zero otherwise.
*/
int isalpha(codepoint_t c);
/** @brief Is the codepoint a control character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a control character, zero otherwise.
*/
int iscntrl(codepoint_t c);
/** @brief Is the codepoint a numeric character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a number, zero otherwise.
*/
int isdigit(codepoint_t c);
/** @brief Does the codepoint have a displayable glyph?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint has a displayable glyph, zero otherwise.
*/
int isgraph(codepoint_t c);
/** @brief Is the codepoint a lower-case letter?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a lower-case letter, zero otherwise.
*/
int islower(codepoint_t c);
/** @brief Is the codepoint a printable character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a printable character, zero otherwise.
*/
int isprint(codepoint_t c);
/** @brief Is the codepoint a punctuation character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a punctuation character, zero otherwise.
*/
int ispunct(codepoint_t c);
/** @brief Is the codepoint a whitespace character?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is a whitespace character, zero otherwise.
*/
int isspace(codepoint_t c);
/** @brief Is the codepoint an upper-case letter?
*
* @param c The Unicode codepoint to check.
* @return Non-zero if the codepoint is an upper-case letter, zero otherwise.
*/
int isupper(codepoint_t c);
//@}
}
#endif