MCPcopy Create free account
hub / github.com/NativeScript/android / create_component_match_result

Method create_component_match_result

test-app/runtime/src/main/cpp/ada/ada.h:8960–8983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8958
8959template <url_pattern_regex::regex_concept regex_provider>
8960url_pattern_component_result
8961url_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
8985template <url_pattern_regex::regex_concept regex_provider>
8986std::string_view url_pattern<regex_provider>::get_protocol() const

Callers 1

matchMethod · 0.80

Calls 3

reserveMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected