Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export clear functions #57

Closed
schochastics opened this issue Oct 16, 2023 · 6 comments
Closed

export clear functions #57

schochastics opened this issue Oct 16, 2023 · 6 comments
Assignees
Labels

Comments

@schochastics
Copy link
Member

https://github.com/schochastics/adaR/blob/main/src/ada/ada.cpp#L15116-L15148

@schochastics schochastics self-assigned this Oct 16, 2023
@schochastics
Copy link
Member Author

these are actually void functions

@schochastics
Copy link
Member Author

similar issue as with #15

@chainsawriot do you think this is a viable way for ada_clear_* and ada_set_*? or is there a shortcut?

ada_string ada_clear_port1(ada_url url) noexcept {
  ada::result<ada::url_aggregator>& r = get_instance(url);
  if (!r) {
    return ada_string_create(NULL, 0);
  }
  r->clear_port();
  std::string_view out = r->get_href();
  return ada_string_create(out.data(), out.length());
}

@chainsawriot
Copy link
Collaborator

@schochastics There should be a way to do that without rewriting ada_clear_*. Let me try.

@schochastics schochastics removed their assignment Oct 16, 2023
@chainsawriot
Copy link
Collaborator

chainsawriot commented Oct 16, 2023

std::string Rcpp_clear_port(String s) {
  std::string_view input(s.get_cstring());
  ada_url url = ada_parse(input.data(), input.length());
  ada_clear_port(url);
  std::string res = charsub(ada_get_href(url));
  ada_free(url);
  return res;
}

Not vectorize, but proof of concept.

@schochastics
Copy link
Member Author

@chainsawriot I think I get it. Do you mind if I implement this, or do you want to do this yourself?

@chainsawriot
Copy link
Collaborator

@schochastics Please do that.

@schochastics schochastics self-assigned this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants