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

Method clear_hostname

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

Source from the content-addressed store, hash-verified

7975}
7976
7977constexpr void url_aggregator::clear_hostname() {
7978 ada_log("url_aggregator::clear_hostname");
7979 ADA_ASSERT_TRUE(validate());
7980 if (!has_authority()) {
7981 return;
7982 }
7983 ADA_ASSERT_TRUE(has_authority());
7984
7985 uint32_t hostname_length = components.host_end - components.host_start;
7986 uint32_t start = components.host_start;
7987
7988 // If hostname starts with "@", we should not remove that character.
7989 if (hostname_length > 0 && buffer[start] == '@') {
7990 start++;
7991 hostname_length--;
7992 }
7993 buffer.erase(start, hostname_length);
7994 components.host_end = start;
7995 components.pathname_start -= hostname_length;
7996 if (components.search_start != url_components::omitted) {
7997 components.search_start -= hostname_length;
7998 }
7999 if (components.hash_start != url_components::omitted) {
8000 components.hash_start -= hostname_length;
8001 }
8002#if ADA_DEVELOPMENT_CHECKS
8003 ADA_ASSERT_EQUAL(get_hostname(), "",
8004 "hostname should have been cleared on buffer=" + buffer +
8005 " with " + components.to_string() + "\n" + to_diagram());
8006#endif
8007 ADA_ASSERT_TRUE(has_authority());
8008 ADA_ASSERT_EQUAL(has_empty_hostname(), true,
8009 "hostname should have been cleared on buffer=" + buffer +
8010 " with " + components.to_string() + "\n" + to_diagram());
8011 ADA_ASSERT_TRUE(validate());
8012}
8013
8014[[nodiscard]] constexpr bool url_aggregator::has_hash() const noexcept {
8015 ada_log("url_aggregator::has_hash");

Callers

nothing calls this directly

Calls 2

eraseMethod · 0.80
to_stringMethod · 0.60

Tested by

no test coverage detected