An RTL label is a label that contains at least one character of type R, AL, or AN. https://www.rfc-editor.org/rfc/rfc5893#section-2
| 9004 | // An RTL label is a label that contains at least one character of type R, AL, |
| 9005 | // or AN. https://www.rfc-editor.org/rfc/rfc5893#section-2 |
| 9006 | inline static bool is_rtl_label(const std::u32string_view label) noexcept { |
| 9007 | const size_t mask = |
| 9008 | (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN); |
| 9009 | |
| 9010 | size_t directions = 0; |
| 9011 | for (size_t i = 0; i < label.size(); i++) { |
| 9012 | directions |= 1u << find_direction(label[i]); |
| 9013 | } |
| 9014 | return (directions & mask) != 0; |
| 9015 | } |
| 9016 | |
| 9017 | bool is_label_valid(const std::u32string_view label) { |
| 9018 | if (label.empty()) { |
no test coverage detected