| 8958 | |
| 8959 | template <url_pattern_regex::regex_concept regex_provider> |
| 8960 | url_pattern_component_result |
| 8961 | url_pattern_component<regex_provider>::create_component_match_result( |
| 8962 | std::string&& input, |
| 8963 | std::vector<std::optional<std::string>>&& exec_result) { |
| 8964 | // Let result be a new URLPatternComponentResult. |
| 8965 | // Set result["input"] to input. |
| 8966 | // Let groups be a record<USVString, (USVString or undefined)>. |
| 8967 | auto result = |
| 8968 | url_pattern_component_result{.input = std::move(input), .groups = {}}; |
| 8969 | |
| 8970 | // Optimization: Let's reserve the size. |
| 8971 | result.groups.reserve(exec_result.size()); |
| 8972 | |
| 8973 | // We explicitly start iterating from 0 even though the spec |
| 8974 | // says we should start from 1. This case is handled by the |
| 8975 | // std_regex_provider. |
| 8976 | for (size_t index = 0; index < exec_result.size(); index++) { |
| 8977 | result.groups.insert({ |
| 8978 | group_name_list[index], |
| 8979 | std::move(exec_result[index]), |
| 8980 | }); |
| 8981 | } |
| 8982 | return result; |
| 8983 | } |
| 8984 | |
| 8985 | template <url_pattern_regex::regex_concept regex_provider> |
| 8986 | std::string_view url_pattern<regex_provider>::get_protocol() const |