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

Method copy_scheme

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

Source from the content-addressed store, hash-verified

14009}
14010
14011inline void url_aggregator::copy_scheme(const url_aggregator& u) noexcept {
14012 ada_log("url_aggregator::copy_scheme ", u.buffer);
14013 ADA_ASSERT_TRUE(validate());
14014 // next line could overflow but unsigned arithmetic has well-defined
14015 // overflows.
14016 uint32_t new_difference = u.components.protocol_end - components.protocol_end;
14017 type = u.type;
14018 buffer.erase(0, components.protocol_end);
14019 buffer.insert(0, u.get_protocol());
14020 components.protocol_end = u.components.protocol_end;
14021
14022 // No need to update the components
14023 if (new_difference == 0) {
14024 return;
14025 }
14026
14027 // Update the rest of the components.
14028 components.username_end += new_difference;
14029 components.host_start += new_difference;
14030 components.host_end += new_difference;
14031 components.pathname_start += new_difference;
14032 if (components.search_start != url_components::omitted) {
14033 components.search_start += new_difference;
14034 }
14035 if (components.hash_start != url_components::omitted) {
14036 components.hash_start += new_difference;
14037 }
14038 ADA_ASSERT_TRUE(validate());
14039}
14040
14041inline void url_aggregator::set_scheme_from_view_with_colon(
14042 std::string_view new_scheme_with_colon) noexcept {

Callers 1

parse_url_implFunction · 0.60

Calls 3

eraseMethod · 0.80
get_protocolMethod · 0.60
insertMethod · 0.45

Tested by

no test coverage detected