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

Method set_protocol

test-app/runtime/src/main/cpp/ada/ada.cpp:12897–12919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12895}
12896
12897bool url::set_protocol(const std::string_view input) {
12898 std::string view(input);
12899 helpers::remove_ascii_tab_or_newline(view);
12900 if (view.empty()) {
12901 return true;
12902 }
12903
12904 // Schemes should start with alpha values.
12905 if (!checkers::is_alpha(view[0])) {
12906 return false;
12907 }
12908
12909 view.append(":");
12910
12911 std::string::iterator pointer =
12912 std::ranges::find_if_not(view, unicode::is_alnum_plus);
12913
12914 if (pointer != view.end() && *pointer == ':') {
12915 return parse_scheme<true>(
12916 std::string_view(view.data(), pointer - view.begin()));
12917 }
12918 return false;
12919}
12920
12921bool url::set_href(const std::string_view input) {
12922 ada::result<ada::url> out = ada::parse<ada::url>(input);

Callers 2

SetProtocolMethod · 0.80
ada_set_protocolFunction · 0.80

Calls 8

is_alphaFunction · 0.85
overlapsFunction · 0.85
appendMethod · 0.65
emptyMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected