20 if (view.ends_with(
'.')) {
21 view.remove_suffix(1);
24 size_t last_dot = view.rfind(
'.');
25 if (last_dot != std::string_view::npos) {
27 view.remove_prefix(last_dot + 1);
36 if (view.size() == 1) {
40 if (!view.starts_with(
"0x")) {
44 if (view.size() == 2) {
49 view.remove_prefix(2);
50 return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
57 std::array<uint8_t, 256>
result{};
58 for (
size_t i = 0; i < 256; i++) {
59 if (i <= 0x20 || i == 0x22 || i == 0x23 || i == 0x3c || i == 0x3e ||
60 i == 0x3f || i == 0x5e || i == 0x60 || i == 0x7b || i == 0x7d ||
63 }
else if (i == 0x25) {
65 }
else if (i == 0x2e) {
67 }
else if (i == 0x5c) {
77 std::string_view input)
noexcept {
84 uint8_t accumulator{};
85 for (; i + 7 < input.size(); i += 8) {
95 for (; i < input.size(); i++) {
102 std::string_view input)
noexcept {
103 if (input.empty())
return false;
104 if (input.back() ==
'.') {
105 if (input.size() > 254)
return false;
106 }
else if (input.size() > 253)
110 while (start < input.size()) {
111 auto dot_location = input.find(
'.', start);
113 if (dot_location == std::string_view::npos) dot_location = input.size();
115 auto label_size = dot_location - start;
116 if (label_size > 63 || label_size == 0)
return false;
118 start = dot_location + 1;
Definitions for URL specific checkers used within Ada.
Declarations for URL specific checkers used within Ada.
Cross-platform compiler macros and common definitions.
#define ada_really_inline
Includes the definitions for validation functions.
constexpr bool last_label_may_be_a_number(std::string_view view) noexcept
static constexpr std::array< uint8_t, 256 > path_signature_table
constexpr bool is_digit(char x) noexcept
tl::expected< result_type, ada::errors > result
Definitions for unicode operations.