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

Method initialize

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

Source from the content-addressed store, hash-verified

8665}
8666
8667inline void url_search_params::initialize(std::string_view input) {
8668 if (!input.empty() && input.front() == '?') {
8669 input.remove_prefix(1);
8670 }
8671
8672 auto process_key_value = [&](const std::string_view current) {
8673 auto equal = current.find('=');
8674
8675 if (equal == std::string_view::npos) {
8676 std::string name(current);
8677 std::ranges::replace(name, '+', ' ');
8678 params.emplace_back(unicode::percent_decode(name, name.find('%')), "");
8679 } else {
8680 std::string name(current.substr(0, equal));
8681 std::string value(current.substr(equal + 1));
8682
8683 std::ranges::replace(name, '+', ' ');
8684 std::ranges::replace(value, '+', ' ');
8685
8686 params.emplace_back(unicode::percent_decode(name, name.find('%')),
8687 unicode::percent_decode(value, value.find('%')));
8688 }
8689 };
8690
8691 while (!input.empty()) {
8692 auto ampersand_index = input.find('&');
8693
8694 if (ampersand_index == std::string_view::npos) {
8695 if (!input.empty()) {
8696 process_key_value(input);
8697 }
8698 break;
8699 } else if (ampersand_index != 0) {
8700 process_key_value(input.substr(0, ampersand_index));
8701 }
8702
8703 input.remove_prefix(ampersand_index + 1);
8704 }
8705}
8706
8707inline void url_search_params::append(const std::string_view key,
8708 const std::string_view value) {

Callers

nothing calls this directly

Calls 6

replaceFunction · 0.85
percent_decodeFunction · 0.85
frontMethod · 0.80
emplace_backMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected