Boost logo

Boost Users :

Subject: [Boost-users] [spirit] Qi-adapted-struct light bulb
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-09-07 09:14:28


Hello,

A light bulb went on for me with regard to adapting structs into Qi
parser grammars. Feel free to correct me if I'm wrong.

The key is adapting a struct into your grammer's parser(s) using the
BOOST_FUSION_ADAPT_STRUCT, which identifies the type (struct) and
fields you are synthesizing out of the grammar.

It doesn't mean that there can't be other (presumably) public
variables, functions, etc, in the struct. It also doesn't mean there
can't be private or protected or even a hierarchy of members.

It just means that those are the *adapted* fields into which values
will be synthesized.

Need a style feedback as well. I am finding that I define both the
struct and its parser grammar in the same header/source. Is there any
reason to separate the two, really? Other than perhaps not everything
needs to know about the grammer, just the struct, type thing.

Thank you...

Regards,

Michael Powell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net