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

[C-API] - add support for Dictionary::get_keys(), Dictionary::contains(StringData key) and Dictionary::find_any(Mixed value) #6181

Closed
edualonso opened this issue Jan 9, 2023 · 2 comments · Fixed by #6235
Assignees

Comments

@edualonso
Copy link
Contributor

Kotlin exposes keys, containsKey(key: K) and containsValue(value: V) in its Map interface so we need the following functions (or similar) to be added to the C-API:

  • Dictionary::get_keys()->realm_dictionary_get_keys(const realm_dictionary_t*, size_t* out_size, realm_value_t* out_keys)
  • Dictionary::contains(StringData key)->realm_dictionary_contains_key(const realm_dictionary_t*, realm_value_t key)
  • Dictionary::find_any(Mixed value)->realm_dictionary_contains_value(const realm_dictionary_t*, realm_value_t value)
@edualonso
Copy link
Contributor Author

edualonso commented Jan 20, 2023

Is it possible to also get size_t* out_index for realm_dictionary_contains_key and realm_dictionary_contains_value? I have found a use case where it would be very beneficial to receive the position in which the key or value are located. Not super important though, it would make my life a bit easier 😅

@edualonso
Copy link
Contributor Author

I don't think I need out_index for keys and values after all.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants