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

Method parse_path

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

Source from the content-addressed store, hash-verified

12504}
12505
12506ada_really_inline void url::parse_path(std::string_view input) {
12507 ada_log("parse_path ", input);
12508 std::string tmp_buffer;
12509 std::string_view internal_input;
12510 if (unicode::has_tabs_or_newline(input)) {
12511 tmp_buffer = input;
12512 // Optimization opportunity: Instead of copying and then pruning, we could
12513 // just directly build the string from user_input.
12514 helpers::remove_ascii_tab_or_newline(tmp_buffer);
12515 internal_input = tmp_buffer;
12516 } else {
12517 internal_input = input;
12518 }
12519
12520 // If url is special, then:
12521 if (is_special()) {
12522 if (internal_input.empty()) {
12523 path = "/";
12524 } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
12525 helpers::parse_prepared_path(internal_input.substr(1), type, path);
12526 } else {
12527 helpers::parse_prepared_path(internal_input, type, path);
12528 }
12529 } else if (!internal_input.empty()) {
12530 if (internal_input[0] == '/') {
12531 helpers::parse_prepared_path(internal_input.substr(1), type, path);
12532 } else {
12533 helpers::parse_prepared_path(internal_input, type, path);
12534 }
12535 } else {
12536 if (!host.has_value()) {
12537 path = "/";
12538 }
12539 }
12540}
12541
12542[[nodiscard]] std::string url::to_string() const {
12543 if (!is_valid) {

Callers

nothing calls this directly

Calls 7

has_tabs_or_newlineFunction · 0.85
is_specialFunction · 0.85
parse_prepared_pathFunction · 0.85
overlapsFunction · 0.85
emptyMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected