Hi Dmitry,
Unknown fields are automatically copied when you copy a struct -- that is,
when you set a struct field to a Reader for the same type, like:
someBuilder.setMyStructField(someReader.getMyStructField());
If you want to inspect or manipulate the unknown fields, you need to use
the "any" API, found in `capnp/any.h`. Any struct Reader can be converted
to an AnyStruct::Reader, which allows you to inspect the raw bytes and
pointers of the struct.
-Kenton
On Thu, Jul 25, 2019 at 8:25 AM Dmitry Shmorgun <[email protected]> wrote:
> Hi!
>
> According to
> https://capnproto.org/news/2014-06-17-capnproto-flatbuffers-sbe.html there
> is a way to extract new unknown fields from a message and then construct
> the same or slightly modified message using an outdated scheme and place
> these fields back.
> But how actually this can be done? I don't find any example.
> I assume there should be something else than dynamic scheme loading.
> Can I go further and just reinterpret a message type A as an message
> containing a header and a one struct that can be specified as a generic
> message B, modify and pack back as A? So in this way, I can even not know
> the scheme of A at all.
>
> Many thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/capnproto/CAMLcW_Ojh22Qv69Dt_bx078PsKr%2B4TYEvyNCzz%3D%2BZdYrbbHhFg%40mail.gmail.com
> <https://groups.google.com/d/msgid/capnproto/CAMLcW_Ojh22Qv69Dt_bx078PsKr%2B4TYEvyNCzz%3D%2BZdYrbbHhFg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/capnproto/CAJouXQnZaQEEGbwxmkZ-y-BzKNsg0kipAGhqCXr74h4eT2N4UQ%40mail.gmail.com.