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

Method change_state

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

Source from the content-addressed store, hash-verified

9592
9593template <url_pattern_regex::regex_concept regex_provider>
9594void constructor_string_parser<regex_provider>::change_state(State new_state,
9595 size_t skip) {
9596 // If parser's state is not "init", not "authority", and not "done", then set
9597 // parser's result[parser's state] to the result of running make a component
9598 // string given parser.
9599 if (state != State::INIT && state != State::AUTHORITY &&
9600 state != State::DONE) {
9601 auto value = make_component_string();
9602 // TODO: Simplify this.
9603 switch (state) {
9604 case State::PROTOCOL: {
9605 result.protocol = value;
9606 break;
9607 }
9608 case State::USERNAME: {
9609 result.username = value;
9610 break;
9611 }
9612 case State::PASSWORD: {
9613 result.password = value;
9614 break;
9615 }
9616 case State::HOSTNAME: {
9617 result.hostname = value;
9618 break;
9619 }
9620 case State::PORT: {
9621 result.port = value;
9622 break;
9623 }
9624 case State::PATHNAME: {
9625 result.pathname = value;
9626 break;
9627 }
9628 case State::SEARCH: {
9629 result.search = value;
9630 break;
9631 }
9632 case State::HASH: {
9633 result.hash = value;
9634 break;
9635 }
9636 default:
9637 ada::unreachable();
9638 }
9639 }
9640
9641 // If parser's state is not "init" and new state is not "done", then:
9642 if (state != State::INIT && new_state != State::DONE) {
9643 // If parser's state is "protocol", "authority", "username", or "password";
9644 // new state is "port", "pathname", "search", or "hash"; and parser's
9645 // result["hostname"] does not exist, then set parser's result["hostname"]
9646 // to the empty string.
9647 if ((state == State::PROTOCOL || state == State::AUTHORITY ||
9648 state == State::USERNAME || state == State::PASSWORD) &&
9649 (new_state == State::PORT || new_state == State::PATHNAME ||
9650 new_state == State::SEARCH || new_state == State::HASH) &&
9651 !result.hostname)

Callers 1

parseMethod · 0.80

Calls 1

unreachableFunction · 0.85

Tested by

no test coverage detected