Re: References get lost coming out of parser.

Dan Bloomquist <[email protected]> Sat, 14 Dec 2019 14:12:10 -0800
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Dan Bloomquist wrote:
> On the other hand, I would think there is a way to pass references. I 
> do see T& in symbols but it gets messed by the deference even with 
> std::ref. Over my head for now!

So, the answer was to just pass the whole object in and then do 
whatever. Much more versatile that way, also. I've actually deployed the 
usage, the guy likes his new page. This is an example:
<https://github.com/lakeweb/stuff/blob/master/Sample.pdf>

The code, below. Next was to pass parameters to the operators, having 
the dollar formatting hardwired is not going to cut it. Just added 
Seth's method of error handling and it just worked!
<https://github.com/lakeweb/stuff/blob/master/little_test.cpp>

I decided to delegate the parameter parsing 'on up', I think that's a 
good idea, keeps maintenance simple.
Thanks Joel, for a great library!
Best, Dan.

report_section fully funded calculation
     uid(afacac3e-3e60-4c84-8ce3-92c16c63f183)
     tabs(L0 L750 R3500 L3650 R4100 L4320 R4800 L5000 R6000 M500)
     headers
         item("Asset ID")
         item("Description")
         item("Current", "Cost",just=center)
         item("x",vert=-.5)
         item("Age",vert=-.5,offset=100)
         item("/",vert=-.5)
         item("Useful","Life",just=center,offset=100)
         item("=",vert=-.5)
         item("Fully", "Funded",just=center)

     components
         ops(
             prt_ma_id,
             2100, prt_ma_name,
             push_ma_funded,
             if,
                 prt_ma_curcost,
                 "x", prt_val,
                 push_ma_first_useful, dup, push_ma_first_remaining, 
sub, 12, div, prt_val,
                 "/", prt_val,
                 12, div, prt_val,
                 "=", prt_val,
                 prt_ma_fully,
             else,
                 "", prt_val,
                 "This is Unfunded", prt_val,
             end_if
         )
     catgroups
         ops(
             push_catgroup," - Total:",add,prt_val,
             8, tab_to, prt_cg_fully
         )
     final
         ops( new_line,
             "Total Asset Summary:",prt_val,
                 8, tab_to, prt_fully,
             push_use_contingency,
             if,
                 new_line, "Contingency at ", push_contingency, add, 
prt_val,
                     8, tab_to, prt_cont_fully,
                 new_line, "Summary Total", prt_val, 8, tab_to, 
prt_fully_wcont,
             end_if
         )



_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general