Re: [capnproto] CapnProto C++ as library for parsing textual schemas

2020-06-19 Thread John Demme
https://github.com/capnproto/capnproto/pull/1016 Wasn't that difficult ;) ~John On Thursday, June 18, 2020 at 7:54:02 PM UTC-7, John Demme wrote: > > Yeah, I thought of that but it was too ugly. Also, I had some C# code > which worked on a CodeGenRequest lying around from an abandoned version o

Re: [capnproto] CapnProto C++ as library for parsing textual schemas

2020-06-18 Thread John Demme
Yeah, I thought of that but it was too ugly. Also, I had some C# code which worked on a CodeGenRequest lying around from an abandoned version of this. There was another reason as well, though I don't remember it now... If that method existed, I'd use it ;) ~John On Thu, Jun 18, 2020 at 6:40 PM '

Re: [capnproto] CapnProto C++ as library for parsing textual schemas

2020-06-18 Thread 'Kenton Varda' via Cap'n Proto
`schema.getProto().getNestedNodes()` returns a list of `capnp::schema::Node::NestedNode`, which has `name` and `id` fields. So that gives you the names of the nested declarations, which you can get plug into `getNested()`. It's a little ugly, but in general, the C++ schema classes only have method

Re: [capnproto] CapnProto C++ as library for parsing textual schemas

2020-06-18 Thread John Demme
Hi Kenton- I only see: > ParsedSchema getNested(kj::StringPtr name) const; > // Gets the nested node with the given name, or throws an exception if > there is no such nested > // declaration. > If there were a getNested() which returned a list of ParsedSchemas that'd probably be sufficient

Re: [capnproto] CapnProto C++ as library for parsing textual schemas

2020-06-18 Thread 'Kenton Varda' via Cap'n Proto
Hi John, `capnp::SchemaParser` will parse capnp files and give you a `capnp::ParsedSchema`, which is like `capnp::Schema` but also has the `getNested()` method which allows you to traverse the whole tree of child nodes. So it's not just the root node. That said, it's true that it's not super-conv

[capnproto] CapnProto C++ as library for parsing textual schemas

2020-06-18 Thread John Demme
Hello all- I've spent a lot of time digging around the CapnProto C++ code base, but I can't figure how to point a function to a textual capnp schema and get out the CodeGenRequest. Parsing to a capnp::Schema is not sufficient as that class only represents the root node with (AFAICT) no way to a