18 #elif defined(__linux__)
47 static const char k_BEL =
'\a';
48 static const char k_BS =
'\b';
49 static const char k_HT =
'\t';
50 static const char k_NL =
'\n';
51 static const char k_VT =
'\v';
52 static const char k_FF =
'\f';
53 static const char k_CR =
'\r';
57 static const char k_Space =
' ';
58 static const char k_ASCII = 127;
62 static const RADIX_t k_uRadixMax = 10 + 26;
64 static const char k_Vowels[5];
66 static constexpr
bool IsAscii(
wchar_t ch) noexcept
69 return ((
unsigned)ch) <= k_ASCII;
72 static constexpr
bool IsPrint(
wchar_t ch) noexcept
75 return ch >= k_Space && ch < k_ASCII;
77 static inline bool IsAlNum(
wchar_t ch) noexcept
80 return IsAlphaA(ch) || IsDigit(ch);
84 static inline bool IsNL(
wchar_t ch) noexcept
87 return ch == k_NL || ch == k_CR;
89 static inline bool IsSpace(
wchar_t ch) noexcept
92 return ch == k_HT || ch == k_Space;
94 static inline bool IsSpaceX(
wchar_t ch) noexcept
103 return ch == k_Space || (ch >= k_BS && ch <= k_CR);
106 static inline bool IsDigit(
wchar_t ch) noexcept
109 return ch >=
'0' && ch <=
'9';
114 return ch >=
'A' && ch <=
'Z';
119 return ch >=
'a' && ch <=
'z';
124 return IsUpperA(ch) || IsLowerA(ch);
127 static const BYTE k_AXU = 0xC0;
128 static const BYTE k_AXL = 0xE0;
134 return ((
unsigned)ch) >= k_AXU && ((unsigned)ch) <= 0xDF;
139 return ((
unsigned)ch) >= k_AXL && ((unsigned)ch) <= 0xFF;
145 return ((
unsigned)ch) >= 0x100 && ((unsigned)ch) <= 0x1FF;
150 return IsAlphaUSet(ch) && (ch & 1) == 0;
155 return IsAlphaUSet(ch) && (ch & 1) == 1;
161 return IsUpperA(ch) || IsUpperAXSet(ch);
166 return IsLowerA(ch) || IsLowerAXSet(ch);
169 static inline bool IsUpper(
wchar_t ch) noexcept
176 return IsUpperAXSet(ch) || IsUpperUSet(ch);
178 static inline bool IsLower(
wchar_t ch) noexcept
185 return IsLowerAXSet(ch) || IsLowerUSet(ch);
188 static inline bool IsAlpha(
wchar_t ch) noexcept
192 return IsLowerAX(ch) || IsUpperAX(ch) || IsAlphaUSet(ch);
194 static inline bool IsCSymF(
wchar_t ch) noexcept
198 return IsAlphaA(ch) || ch ==
'_';
200 static inline bool IsCSym(
wchar_t ch) noexcept
204 return IsAlphaA(ch) || ch ==
'_' || IsDigit(ch);
207 static inline wchar_t ToUpperA(
wchar_t ch) noexcept
211 return ((ch)-
'a') +
'A';
214 static inline wchar_t ToUpperW(
wchar_t ch) noexcept
220 return ((ch)-
'a') +
'A';
224 if (IsLowerAXSet(ch))
225 return ((ch)-k_AXL) + k_AXU;
227 return (
wchar_t)(ch + 1);
231 static inline wchar_t ToLowerA(
wchar_t ch) noexcept
235 return ((ch)-
'A') +
'a';
238 static inline wchar_t ToLowerW(
wchar_t ch) noexcept
244 return ((ch)-
'A') +
'a';
248 if (IsUpperAXSet(ch))
249 return ((ch)-k_AXU) + k_AXL;
250 else if (IsUpperUSet(ch))
251 return (
wchar_t)(ch - 1);
263 wchar_t ch1 = ToLowerA(a);
264 wchar_t ch2 = ToLowerA(b);
275 wchar_t ch1 = ToLowerW(a);
276 wchar_t ch2 = ToLowerW(b);
280 static inline int Dec2U(
wchar_t ch) noexcept
287 static bool GRAYCALL IsDigitF(
wchar_t ch);
289 static bool GRAYCALL IsVowel(
wchar_t ch);
290 static char GRAYCALL U2Hex(UINT uVal);
291 static int GRAYCALL Hex2U(
wchar_t ch);
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
int COMPARE_t
result of compare. 0=same, 1=a>b, -1=a<b
Definition: cValT.h:17
WORD RADIX_t
Base for convert of numbers to strings. e.g. 10 base vs 16 base hex numbers.
Definition: StrChar.h:27
CODEPAGE_t
Definition: StrChar.h:33
@ CP_UTF8
UTF-8 translation.
Definition: StrChar.h:36
@ CP_OEMCP
default to OEM code page
Definition: StrChar.h:35
@ CP_ACP
default to ANSI code page. All the _WIN32 A suffix functions.
Definition: StrChar.h:34
static wchar_t ToUpperA(wchar_t ch) noexcept
Definition: StrChar.h:207
static wchar_t ToUpperW(wchar_t ch) noexcept
Definition: StrChar.h:214
static bool IsCSym(wchar_t ch) noexcept
Definition: StrChar.h:200
static bool IsUpper(wchar_t ch) noexcept
Definition: StrChar.h:169
static COMPARE_t CmpI(char a, char b) noexcept
Definition: StrChar.h:256
static bool IsLowerUSet(wchar_t ch) noexcept
Definition: StrChar.h:152
static bool IsCSymF(wchar_t ch) noexcept
Definition: StrChar.h:194
static bool IsAlpha(wchar_t ch) noexcept
Definition: StrChar.h:188
static bool IsNL(wchar_t ch) noexcept
Definition: StrChar.h:84
static COMPARE_t CmpI(wchar_t a, wchar_t b) noexcept
Definition: StrChar.h:268
static bool IsLowerA(wchar_t ch) noexcept
Definition: StrChar.h:116
static bool IsSpace(wchar_t ch) noexcept
Definition: StrChar.h:89
static constexpr bool IsAscii(wchar_t ch) noexcept
Definition: StrChar.h:66
static int Dec2U(wchar_t ch) noexcept
Definition: StrChar.h:280
static bool IsAlphaA(wchar_t ch) noexcept
Definition: StrChar.h:121
static constexpr bool IsPrint(wchar_t ch) noexcept
Definition: StrChar.h:72
static bool IsDigit(wchar_t ch) noexcept
Definition: StrChar.h:106
static bool IsLowerAXSet(wchar_t ch) noexcept
Definition: StrChar.h:136
static bool IsLower(wchar_t ch) noexcept
Definition: StrChar.h:178
static bool IsUpperAX(wchar_t ch) noexcept
Definition: StrChar.h:158
static bool IsAlNum(wchar_t ch) noexcept
Definition: StrChar.h:77
static wchar_t ToLowerA(wchar_t ch) noexcept
Definition: StrChar.h:231
static bool IsLowerAX(wchar_t ch) noexcept
Definition: StrChar.h:163
static bool IsUpperAXSet(wchar_t ch) noexcept
Definition: StrChar.h:131
static bool IsSpaceX(wchar_t ch) noexcept
Definition: StrChar.h:94
static bool IsAlphaUSet(wchar_t ch) noexcept
Definition: StrChar.h:142
static bool IsUpperA(wchar_t ch) noexcept
Definition: StrChar.h:111
static bool IsUpperUSet(wchar_t ch) noexcept
Definition: StrChar.h:147
static wchar_t ToLowerW(wchar_t ch) noexcept
Definition: StrChar.h:238