Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::StrChar Struct Reference

#include <StrChar.h>

Static Public Member Functions

static constexpr bool IsAscii (wchar_t ch) noexcept
 
static constexpr bool IsPrint (wchar_t ch) noexcept
 
static bool IsAlNum (wchar_t ch) noexcept
 
static bool IsNL (wchar_t ch) noexcept
 
static bool IsSpace (wchar_t ch) noexcept
 
static bool IsSpaceX (wchar_t ch) noexcept
 
static bool IsDigit (wchar_t ch) noexcept
 
static bool IsUpperA (wchar_t ch) noexcept
 
static bool IsLowerA (wchar_t ch) noexcept
 
static bool IsAlphaA (wchar_t ch) noexcept
 
static bool IsUpperAXSet (wchar_t ch) noexcept
 
static bool IsLowerAXSet (wchar_t ch) noexcept
 
static bool IsAlphaUSet (wchar_t ch) noexcept
 
static bool IsUpperUSet (wchar_t ch) noexcept
 
static bool IsLowerUSet (wchar_t ch) noexcept
 
static bool IsUpperAX (wchar_t ch) noexcept
 
static bool IsLowerAX (wchar_t ch) noexcept
 
static bool IsUpper (wchar_t ch) noexcept
 
static bool IsLower (wchar_t ch) noexcept
 
static bool IsAlpha (wchar_t ch) noexcept
 
static bool IsCSymF (wchar_t ch) noexcept
 
static bool IsCSym (wchar_t ch) noexcept
 
static wchar_t ToUpperA (wchar_t ch) noexcept
 
static wchar_t ToUpperW (wchar_t ch) noexcept
 
static wchar_t ToLowerA (wchar_t ch) noexcept
 
static wchar_t ToLowerW (wchar_t ch) noexcept
 
static COMPARE_t CmpI (char a, char b) noexcept
 
static COMPARE_t CmpI (wchar_t a, wchar_t b) noexcept
 
static int Dec2U (wchar_t ch) noexcept
 
static bool __stdcall IsDigitF (wchar_t ch)
 
static bool __stdcall IsDigitX (wchar_t ch, RADIX_t uRadix=0x10)
 
static bool __stdcall IsVowel (wchar_t ch)
 
static char __stdcall U2Hex (UINT uVal)
 
static int __stdcall Hex2U (wchar_t ch)
 
static char __stdcall U2Radix (UINT uVal, RADIX_t uRadix=10)
 
static int __stdcall Radix2U (wchar_t ch, RADIX_t uRadix=10)
 

Static Public Attributes

static const char k_BEL = '\a'
 Audible bell = 7. More...
 
static const char k_BS = '\b'
 Backspace = 8. More...
 
static const char k_HT = '\t'
 Horizontal tab = 9. More...
 
static const char k_NL = '\n'
 New line, line feed = 0x0a = 10. More...
 
static const char k_VT = '\v'
 Vertical tab = 0x0b = 11. More...
 
static const char k_FF = '\f'
 Form feed, new page = 0x0c = 12. More...
 
static const char k_CR = '\r'
 Carriage return = 0x0d = 13. More...
 
static const char k_Space = ' '
 space = start of the visible ASCII set. 0x20 = 32 More...
 
static const char k_ASCII = 127
 Max for normal ASCII characters. More...
 
static const RADIX_t k_uRadixMin = 2
 binary More...
 
static const RADIX_t k_uRadixDef = 10
 base 10. More...
 
static const RADIX_t k_uRadixMax = 10 + 26
 numbers + letters. More...
 
static const char k_Vowels [5] = { 'a', 'e', 'i', 'o', 'u' }
 Does not include Y. AEIOU. More...
 
static const BYTE k_AXU = 0xC0
 extended ASCII Upper. NOT UTF8 More...
 
static const BYTE k_AXL = 0xE0
 extended ASCII Lower. NOT UTF8 More...
 

Friends

class StrCharTests
 

Detailed Description

Replace some of the std lib char functions because they can crash on chars outside range. POSIX linux and _WIN32 calls are not always the same. ASSUME ASCII char set, extended ASCII, UNICODE or UTF8

Member Function Documentation

◆ CmpI() [1/2]

static COMPARE_t Gray::StrChar::CmpI ( char  a,
char  b 
)
inlinestaticnoexcept

Compare 2 characters ignoring case. Are they the same ignoring case ?

Returns
0 = match.

◆ CmpI() [2/2]

static COMPARE_t Gray::StrChar::CmpI ( wchar_t  a,
wchar_t  b 
)
inlinestaticnoexcept

Compare 2 characters ignoring case. Are they the same ignoring case ?

Returns
0 = match.

◆ Dec2U()

static int Gray::StrChar::Dec2U ( wchar_t  ch)
inlinestaticnoexcept

Get decimal digit value.

◆ Hex2U()

int GRAYCALL Gray::StrChar::Hex2U ( wchar_t  ch)
static

same as Radix2U(ch,16) Get the value from the hex char -1 = invalid char.

◆ IsAlNum()

static bool Gray::StrChar::IsAlNum ( wchar_t  ch)
inlinestaticnoexcept

a-z, 0-9

◆ IsAlpha()

static bool Gray::StrChar::IsAlpha ( wchar_t  ch)
inlinestaticnoexcept

_isalpha() isalpha() for English/ASCII set. NOT numeric or other. _WIN32 IsCharAlpha()

◆ IsAlphaA()

static bool Gray::StrChar::IsAlphaA ( wchar_t  ch)
inlinestaticnoexcept

_isalpha() isalpha()

◆ IsAlphaUSet()

static bool Gray::StrChar::IsAlphaUSet ( wchar_t  ch)
inlinestaticnoexcept

_isalpha() UNICODE set

◆ IsAscii()

static constexpr bool Gray::StrChar::IsAscii ( wchar_t  ch)
inlinestaticconstexprnoexcept

like POSIX isascii()

◆ IsCSym()

static bool Gray::StrChar::IsCSym ( wchar_t  ch)
inlinestaticnoexcept

Would this be a valid 'c' symbolic name ? __iscsym or __iscsymf

◆ IsCSymF()

static bool Gray::StrChar::IsCSymF ( wchar_t  ch)
inlinestaticnoexcept

Would this be a valid 'c' symbolic name ? __iscsym or __iscsymf (first char)

◆ IsDigit()

static bool Gray::StrChar::IsDigit ( wchar_t  ch)
inlinestaticnoexcept

same as C isdigit()

◆ IsDigitF()

bool GRAYCALL Gray::StrChar::IsDigitF ( wchar_t  ch)
static

Float digit.

◆ IsDigitX()

bool GRAYCALL Gray::StrChar::IsDigitX ( wchar_t  ch,
RADIX_t  uRadix = 0x10 
)
static

is digit in uRadix range? or Hex digit (if uRadix=16). replaces isxdigit() and istxdigit()

◆ IsLower()

static bool Gray::StrChar::IsLower ( wchar_t  ch)
inlinestaticnoexcept

islower(ch) in UNICODE

◆ IsLowerA()

static bool Gray::StrChar::IsLowerA ( wchar_t  ch)
inlinestaticnoexcept

islower(ch) in base ASCII set

◆ IsLowerAX()

static bool Gray::StrChar::IsLowerAX ( wchar_t  ch)
inlinestaticnoexcept

islower(ch) in extended ASCII set.

◆ IsLowerAXSet()

static bool Gray::StrChar::IsLowerAXSet ( wchar_t  ch)
inlinestaticnoexcept

islower(ch) = 'à' 'ý' // extended ASCII. NOT UTF8

◆ IsLowerUSet()

static bool Gray::StrChar::IsLowerUSet ( wchar_t  ch)
inlinestaticnoexcept

Unicode set. odd if lower case.

◆ IsNL()

static bool Gray::StrChar::IsNL ( wchar_t  ch)
inlinestaticnoexcept

is newline.

◆ IsPrint()

static constexpr bool Gray::StrChar::IsPrint ( wchar_t  ch)
inlinestaticconstexprnoexcept

printable? k_ASCII is not printable = DEL.

◆ IsSpace()

static bool Gray::StrChar::IsSpace ( wchar_t  ch)
inlinestaticnoexcept

is a horizontal separator space. not newline.

◆ IsSpaceX()

static bool Gray::StrChar::IsSpaceX ( wchar_t  ch)
inlinestaticnoexcept

Is this any sort of spacer ? Horizontal or vertical space or new lines. almost same as C isspace() = "' ','\t','\n'" etc. but we also include "'\b'" https://en.wikipedia.org/wiki/Newline NEL: Next Line, U + 0085 LS : Line Separator, U + 2028 PS : Paragraph Separator, U + 2029

◆ IsUpper()

static bool Gray::StrChar::IsUpper ( wchar_t  ch)
inlinestaticnoexcept

isupper(ch) in UNICODE

◆ IsUpperA()

static bool Gray::StrChar::IsUpperA ( wchar_t  ch)
inlinestaticnoexcept

isupper(ch) in base ASCII set

◆ IsUpperAX()

static bool Gray::StrChar::IsUpperAX ( wchar_t  ch)
inlinestaticnoexcept

isupper(ch) in extended ASCII set.

◆ IsUpperAXSet()

static bool Gray::StrChar::IsUpperAXSet ( wchar_t  ch)
inlinestaticnoexcept

isupper(ch) = 'À' 'Ý' // extended ASCII. NOT UTF8

◆ IsUpperUSet()

static bool Gray::StrChar::IsUpperUSet ( wchar_t  ch)
inlinestaticnoexcept

Unicode set. even is upper case.

◆ IsVowel()

bool GRAYCALL Gray::StrChar::IsVowel ( wchar_t  ch)
static

◆ Radix2U()

int GRAYCALL Gray::StrChar::Radix2U ( wchar_t  ch,
RADIX_t  uRadix = 10 
)
static
Returns
the value from the uRadix char -1 = invalid char.

◆ ToLowerA()

static wchar_t Gray::StrChar::ToLowerA ( wchar_t  ch)
inlinestaticnoexcept

replace std::tolower() for ASCII // ch|0x20 sort of

◆ ToLowerW()

static wchar_t Gray::StrChar::ToLowerW ( wchar_t  ch)
inlinestaticnoexcept

std::tolower() for UNICODE

◆ ToUpperA()

static wchar_t Gray::StrChar::ToUpperA ( wchar_t  ch)
inlinestaticnoexcept

replace std::toupper() for ASCII

◆ ToUpperW()

static wchar_t Gray::StrChar::ToUpperW ( wchar_t  ch)
inlinestaticnoexcept

std::toupper() for UNICODE

◆ U2Hex()

char GRAYCALL Gray::StrChar::U2Hex ( UINT  uVal)
static

same as U2Radix(uVal,16) Convert a value to a single hex char. "0123456789ABCDEF"[uVal] Upper case. '?' = invalid value.

◆ U2Radix()

char GRAYCALL Gray::StrChar::U2Radix ( UINT  uVal,
RADIX_t  uRadix = 10 
)
static
Returns
a single uRadix char for a value. Upper case. '?' = invalid value.

Friends And Related Function Documentation

◆ StrCharTests

friend class StrCharTests
friend

Member Data Documentation

◆ k_ASCII

const char Gray::StrChar::k_ASCII = 127
static

Max for normal ASCII characters.

◆ k_AXL

const BYTE Gray::StrChar::k_AXL = 0xE0
static

extended ASCII Lower. NOT UTF8

◆ k_AXU

const BYTE Gray::StrChar::k_AXU = 0xC0
static

extended ASCII Upper. NOT UTF8

◆ k_BEL

const char Gray::StrChar::k_BEL = '\a'
static

Audible bell = 7.

◆ k_BS

const char Gray::StrChar::k_BS = '\b'
static

Backspace = 8.

◆ k_CR

const char Gray::StrChar::k_CR = '\r'
static

Carriage return = 0x0d = 13.

◆ k_FF

const char Gray::StrChar::k_FF = '\f'
static

Form feed, new page = 0x0c = 12.

◆ k_HT

const char Gray::StrChar::k_HT = '\t'
static

Horizontal tab = 9.

◆ k_NL

const char Gray::StrChar::k_NL = '\n'
static

New line, line feed = 0x0a = 10.

◆ k_Space

const char Gray::StrChar::k_Space = ' '
static

space = start of the visible ASCII set. 0x20 = 32

◆ k_uRadixDef

const RADIX_t Gray::StrChar::k_uRadixDef = 10
static

base 10.

◆ k_uRadixMax

const RADIX_t Gray::StrChar::k_uRadixMax = 10 + 26
static

numbers + letters.

◆ k_uRadixMin

const RADIX_t Gray::StrChar::k_uRadixMin = 2
static

binary

◆ k_Vowels

const char Gray::StrChar::k_Vowels = { 'a', 'e', 'i', 'o', 'u' }
static

Does not include Y. AEIOU.

◆ k_VT

const char Gray::StrChar::k_VT = '\v'
static

Vertical tab = 0x0b = 11.


The documentation for this struct was generated from the following files: