core: add a type to store unicode characters, as well as functions to query them
This commit is contained in:
1193
core/encoding.c
Normal file
1193
core/encoding.c
Normal file
File diff suppressed because it is too large
Load Diff
31
core/include/blue/core/encoding.h
Normal file
31
core/include/blue/core/encoding.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef BLUE_CORE_ENCODING_H_
|
||||
#define BLUE_CORE_ENCODING_H_
|
||||
|
||||
#include <blue/core/misc.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define B_WCHAR_INVALID ((b_wchar) - 1)
|
||||
|
||||
typedef int32_t b_wchar;
|
||||
|
||||
BLUE_API bool b_wchar_is_alpha(b_wchar c);
|
||||
BLUE_API bool b_wchar_is_number(b_wchar c);
|
||||
static inline bool b_wchar_is_bin_digit(b_wchar c)
|
||||
{
|
||||
return c >= '0' && c <= '1';
|
||||
}
|
||||
static inline bool b_wchar_is_oct_digit(b_wchar c)
|
||||
{
|
||||
return c >= '0' && c <= '7';
|
||||
}
|
||||
BLUE_API bool b_wchar_is_hex_digit(b_wchar c);
|
||||
BLUE_API bool b_wchar_is_space(b_wchar c);
|
||||
static inline bool b_wchar_is_alnum(b_wchar c)
|
||||
{
|
||||
return b_wchar_is_alpha(c) || b_wchar_is_number(c);
|
||||
}
|
||||
|
||||
BLUE_API bool b_wchar_is_punct(b_wchar c);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user