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

Add missing support for pointers #11

Merged
merged 3 commits into from
May 12, 2017
Merged

Conversation

talex5
Copy link
Collaborator

@talex5 talex5 commented May 3, 2017

Before, the only ways to create a struct were as a root, or as a child with a type declared in the schema. For AnyPointer types, we need to be able to add any struct to a message.

This commit adds two new auto-generated operations to structs:

  • Child.init_pointer ptr allocates a fresh Child struct, storing a pointer to it in ptr, and returns its builder.

  • Child.of_pointer ptr returns a reader for the Child struct pointed to by ptr.

Also, it is sometimes necessary to set an AnyPointer to an interface rather than to a struct. For this, there are two new generated operations on pointers: field_set_interface and field_get_interface.

Thomas Leonard added 3 commits April 28, 2017 11:21
To make the tests pass, I also:

- Added a missing space in the code generation.
- Added depext on capnp.
- Added core_extended to the test dependencies.
Before, the only ways to create a struct were as a root, or as a child
with a type declared in the schema. For AnyPointer types, we need to be
able to add any struct to a message.

This commit adds two new auto-generated operations to structs:

- `Child.init_pointer ptr` allocates a fresh `Child` struct, storing a
  pointer to it in `ptr`, and returns its builder.

- `Child.of_pointer ptr` returns a reader for the `Child` struct pointed
  to by `ptr`.

Also, it is sometimes necessary to set an AnyPointer to an interface
rather than to a struct. For this, there are two new generated
operations on pointers: `field_set_interface` and `field_get_interface`.
@pelzlpj pelzlpj merged commit 1ee8e78 into capnproto:master May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants