14 char last_char = view.back();
16 if (last_char ==
'.') {
17 view.remove_suffix(1);
21 last_char = view.back();
23 bool possible_ipv4 = (last_char >=
'0' && last_char <=
'9') ||
24 (last_char >=
'a' && last_char <=
'f') ||
30 size_t last_dot = view.rfind(
'.');
31 if (last_dot != std::string_view::npos) {
33 view = view.substr(last_dot + 1);
42 if (view.size() == 1) {
46 if (!std::equal(view.begin(), view.begin() + 2,
"0x")) {
50 if (view.size() == 2) {
55 return std::all_of(view.begin() + 2, view.end(),
56 ada::unicode::is_lowercase_hex);
63 std::array<uint8_t, 256>
result{};
64 for (
size_t i = 0; i < 256; i++) {
65 if (i <= 0x20 || i == 0x22 || i == 0x23 || i == 0x3c || i == 0x3e ||
66 i == 0x3f || i == 0x60 || i == 0x7b || i == 0x7d || i > 0x7e) {
68 }
else if (i == 0x25) {
70 }
else if (i == 0x2e) {
72 }
else if (i == 0x5c) {
82 std::string_view input)
noexcept {
89 uint8_t accumulator{};
90 for (; i + 7 < input.size(); i += 8) {
100 for (; i < input.size(); i++) {
107 std::string_view input)
noexcept {
108 if (input.back() ==
'.') {
109 if (input.size() > 254)
return false;
110 }
else if (input.size() > 253)
114 while (start < input.size()) {
115 auto dot_location = input.find(
'.', start);
117 if (dot_location == std::string_view::npos) dot_location = input.size();
119 auto label_size = dot_location - start;
120 if (label_size > 63 || label_size == 0)
return false;
122 start = dot_location + 1;
Declarations for URL specific checkers used within Ada.
#define ada_really_inline
Includes the definitions for validation functions.
static constexpr std::array< uint8_t, 256 > path_signature_table
constexpr bool is_digit(char x) noexcept
tl::expected< result_type, ada::errors > result