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

Function canonicalize_search

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

Source from the content-addressed store, hash-verified

16273}
16274
16275tl::expected<std::string, errors> canonicalize_search(std::string_view input) {
16276 // If value is the empty string, return value.
16277 if (input.empty()) [[unlikely]] {
16278 return "";
16279 }
16280 // Let dummyURL be a new URL record.
16281 // Set dummyURL's query to the empty string.
16282 // Let parseResult be the result of running basic URL parser given value with
16283 // dummyURL as url and query state as state override.
16284 auto url = ada::parse<url_aggregator>("fake://dummy.test", nullptr);
16285 ADA_ASSERT_TRUE(url.has_value());
16286 url->set_search(input);
16287 if (url->has_search()) {
16288 const auto search = url->get_search();
16289 if (!search.empty()) {
16290 return std::string(search.substr(1));
16291 }
16292 return "";
16293 }
16294 return tl::unexpected(errors::type_error);
16295}
16296
16297tl::expected<std::string, errors> canonicalize_hash(std::string_view input) {
16298 // If value is the empty string, return value.

Callers 1

process_searchMethod · 0.85

Calls 6

unexpectedClass · 0.85
set_searchMethod · 0.80
has_searchMethod · 0.80
get_searchMethod · 0.60
emptyMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected