MT Core (C++)
Core library for replacing C++ standard in project usage
|
ASCII-related methods for parsing and character classification Split into its own namespace to allow for clear differentiation from any unicode-related methods. More...
Classes | |
struct | UnescapeError |
Error when unescaping characters fails. More... | |
Enumerations | |
enum class | AsciiNumericParseError { AsciiNumericParseError::INVALID_SLICE , AsciiNumericParseError::INVALID_SIGN , AsciiNumericParseError::INVALID_INPUT , AsciiNumericParseError::OVERFLOW_DETECTED } |
Errors when parsing ASCII strings as numbers. More... | |
Functions | |
bool | is_digit (const char c) |
Checks if a character is an ASCII digit (0-9) | |
bool | is_hex (const char c) |
Checks if a character is an ASCII hex digit (0-9, a-f, A-F) | |
bool | is_hex_str (Slice< const char > str) |
Checks if a string is composed of only hex characters Will return false if string is empty. | |
bool | is_int_str (Slice< const char > str) |
Checks if a string is composed of only integer characters Will return false if string is empty. | |
bool | is_pos_int_str (Slice< const char > str) |
Checks if a string is composed of only positive integer characters Will return false if string is empty. | |
template<typename Out = i32> | |
Result< Out, AsciiNumericParseError > | hex_to_int (const Slice< const char > &parse) |
Tries to parse an ASCII hex string into an integer Will return an error if the parsed string does not fit. | |
template<typename Out = i32> | |
Result< Out, AsciiNumericParseError > | base10_to_int (const Slice< const char > &parse) |
Tries to parse an ASCII numeric string into an integer Will return an error if the parsed string does not fit. | |
Result< char, UnescapeError > | unescape_char (Slice< const char > str, char escapeChar='\\') |
Unescapes the first (potentially) escaped character in a character sequence If the sequence is empty, will return an error. | |
template<typename Writer> | |
Result< size_t, std::variant< typename Writer::ErrType, UnescapeError > > | write_unescaped (Writer &writer, Slice< const char > str, char escapeChar='\\') |
Writes unescaped ASCII characters to a stream Note: This does NOT support writing Unicode escape codes at this time (so \uhhhh or \Uhhhhhhhh) | |
ASCII-related methods for parsing and character classification Split into its own namespace to allow for clear differentiation from any unicode-related methods.