#include <Character.h>
Classes | |
struct | EqualsComparer |
struct | ThreeWayComparer |
Public Types | |
enum class | ASCIIOrLatin1Result |
Public Member Functions | |
constexpr | Character () noexcept |
nonvirtual ASCII | GetAsciiCode () const noexcept |
constexpr char32_t | GetCharacterCode () const noexcept |
Return the char32_t UNICODE code-point associated with this character. | |
constexpr | operator char32_t () const noexcept |
constexpr bool | IsASCII () const noexcept |
Return true iff the given character (or all in span) is (are) in the ascii range [0..0x7f]. | |
constexpr bool | IsLatin1 () const noexcept |
Return true iff the given character (or all in span) is (are) in the ascii/iso-latin range [0..0xff]. | |
constexpr bool | IsWhitespace () const noexcept |
nonvirtual bool | IsUpperCase () const noexcept |
nonvirtual bool | IsLowerCase () const noexcept |
constexpr bool | IsControl () const noexcept |
nonvirtual Character | ToLowerCase () const noexcept |
nonvirtual Character | ToUpperCase () const noexcept |
constexpr bool | IsSurrogatePair () const |
constexpr pair< char16_t, char16_t > | GetSurrogatePair () const |
Static Public Member Functions | |
template<IPossibleCharacterRepresentation CHAR_T> | |
static constexpr void | CheckASCII (span< const CHAR_T > s) |
if not IsASCII (arg) throw RuntimeException... | |
template<IUNICODECanUnambiguouslyConvertFrom CHAR_T> | |
static constexpr ASCIIOrLatin1Result | IsASCIIOrLatin1 (span< const CHAR_T > s) noexcept |
template<IUNICODECanUnambiguouslyConvertFrom CHAR_T> | |
static void | CheckLatin1 (span< const CHAR_T > s) |
if not IsLatin1 (arg) throw RuntimeException... | |
template<typename RESULT_T = string, IPossibleCharacterRepresentation CHAR_T> requires requires (RESULT_T* into) { { into->empty () } -> same_as<bool>; { into->push_back (ASCII{0}) }; } | |
static bool | AsASCIIQuietly (span< const CHAR_T > fromS, RESULT_T *into) |
template<IUNICODECanUnambiguouslyConvertFrom CHAR_T, size_t E1, size_t E2> | |
static constexpr strong_ordering | Compare (span< const CHAR_T, E1 > lhs, span< const CHAR_T, E2 > rhs, CompareOptions co) noexcept |
Static Public Attributes | |
static constexpr char16_t | kUNICODESurrogate_High_Start {0xD800} |
Definition at line 218 of file Character.h.
|
strong |
Definition at line 327 of file Character.h.
|
constexprnoexcept |
Default constructor produces a zero (null) character. Constructor with char32_t always produces a valid character.
The overloads check for a valid character code-point and throw if given invalid data.
To avoid checking, cast 'c' to char32_t, as any code-point will be considered valid (so no need to check).
Definition at line 127 of file Character.inl.
|
noexcept |
Definition at line 183 of file Character.inl.
|
explicitconstexprnoexcept |
Explicit cuz creates too many ambiguities with things like c == '\0' where conversions can go both ways.
Definition at line 192 of file Character.inl.
|
constexprnoexcept |
Return true iff the given character (or all in span) is (are) in the ascii range [0..0x7f].
Definition at line 227 of file Character.inl.
|
constexprnoexcept |
Return true iff the given character (or all in span) is (are) in the ascii/iso-latin range [0..0xff].
This refers to ASCII OR https://en.wikipedia.org/wiki/Latin-1_Supplement, so any UNICODE character code point less than U+00FF.
Definition at line 268 of file Character.inl.
|
staticconstexprnoexcept |
Combines check for IsASCII and IsLatin1 in one call (performance). Returns flag indicating most specific possible answer for the entire span. So if all characters ascii, that's returned. If not, but all characters latin1, that's returned. Else returned none.
|
constexprnoexcept |
FROM https://en.cppreference.com/w/cpp/string/wide/iswspace: In the default (C) locale, the whitespace characters are the following: space (0x20, ' ') form feed (0x0c, '\f') line feed (0x0a, '
') carriage return (0x0d, '\r') horizontal tab (0x09, '\t') vertical tab (0x0b, '\v') ... ISO 30112 defines POSIX space characters as UNICODE characters U+0009..U+000D, U+0020, U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+2028, U+2029, U+205F, and U+3000.
Definition at line 394 of file Character.inl.
|
noexcept |
Checks if the given character is upper case. Can be called on any character. Returns false if not alphabetic
Definition at line 449 of file Character.inl.
|
noexcept |
Checks if the given character is lower case. Can be called on any character. Returns false if not alphabetic
Definition at line 454 of file Character.inl.
|
constexprnoexcept |
According to https://en.cppreference.com/w/cpp/string/wide/iswcntrl
ISO 30112 defines POSIX control characters as UNICODE characters U+0000..U+001F, U+007F..U+009F, U+2028, and U+2029 (UNICODE classes Cc, Zl, and Zp)
Definition at line 469 of file Character.inl.
|
noexcept |
Note that this does NOT modify the character in place but returns the new desired
character.
It is not necessary to first check
if the argument character is uppercase or alphabetic. ToLowerCase () just returns the original character if there is no sensible conversion.
Definition at line 492 of file Character.inl.
|
noexcept |
Note that this does NOT modify the character in place but returns the new desired
character.
It is not necessary to first check
if the argument character is lowercase or alphabetic. ToUpperCase () just returns the original character if there is no sensible conversion.
Definition at line 501 of file Character.inl.
|
static |
Convert String losslessly into a standard C++ type. If this source contains any invalid ASCII characters, this returns false, and otherwise true (with set into).
Supported Types (RESULT_T): o Memory::StackBuffer<ASCII> o string o u8string
Definition at line 507 of file Character.inl.
|
constexpr |
Return true iff this Character (or argument codepoints) represent a character which would be represented in UCS-16 as a surrogate pair.
Definition at line 552 of file Character.inl.
|
constexpr |
Definition at line 577 of file Character.inl.
|
staticconstexprnoexcept |
utility to compare an array of characters, like strcmp (), except with param saying if case sensitive or insensitive.
Definition at line 539 of file Character.inl.
|
staticconstexpr |
See https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates
Definition at line 473 of file Character.h.