5#ifndef ADA_CHECKERS_INL_H
6#define ADA_CHECKERS_INL_H
15 constexpr bool is_little_endian = std::endian::native == std::endian::little;
16 constexpr auto word0x =
17 std::bit_cast<uint16_t>(
static_cast<uint16_t
>(0x7830));
18 uint16_t two_first_bytes =
19 static_cast<uint16_t
>(input[0]) |
20 static_cast<uint16_t
>((
static_cast<uint16_t
>(input[1]) << 8));
21 if constexpr (is_little_endian) {
22 two_first_bytes |= 0x2000;
24 two_first_bytes |= 0x020;
26 return two_first_bytes == word0x;
33constexpr bool is_digit(
char x)
noexcept {
return (x >=
'0') & (x <=
'9'); }
35constexpr char to_lower(
char x)
noexcept {
return (x | 0x20); }
42 return input.size() >= 2 &&
43 (
is_alpha(input[0]) && ((input[1] ==
':') || (input[1] ==
'|'))) &&
44 ((input.size() == 2) || (input[2] ==
'/' || input[2] ==
'\\' ||
45 input[2] ==
'?' || input[2] ==
'#'));
49 std::string_view input)
noexcept {
50 return input.size() >= 2 && (
is_alpha(input[0]) && (input[1] ==
':'));
Includes the definitions for validation functions.
constexpr bool has_hex_prefix_unsafe(std::string_view input)
constexpr bool has_hex_prefix(std::string_view input)
constexpr bool is_normalized_windows_drive_letter(std::string_view input) noexcept
constexpr bool is_windows_drive_letter(std::string_view input) noexcept
constexpr char to_lower(char x) noexcept
constexpr bool is_alpha(char x) noexcept
constexpr bool is_digit(char x) noexcept