Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-07-18 14:21:23


Bryan Green wrote:

> Ian McCulloch writes:
>> Bryan Green wrote:
>> [snip]
>> >
>> > While I'm on the subject, you sometimes see something like the
>> > following:
>> >
>> > ./prog -vvv
>> > or
>> > ./prog -v -v -v
>> >
>> > This would *increment* the verbosity level three times. I can't see
>> > how to replicate this in program_options.
>>
>> This is something I have asked about before on this list, but at the time
>> there was no response. I would be very interested in knowing how to do
>> this using boost::program_options!
>
> Hmm, I'm starting to see a pattern here. Does there happen to be any
> development going on in program_options, or is it in need of developers?

If you're volunteering, you're most welcome.

Speaking about -v -v -v, there's no stock way to achieve that. However, the
provided interfaces seem to make it possible:

        1. Derive from value_semantics.

        2. Define the 'parse' method to add one to already stored value.

Compare this to handing of vector<string> -- each new token is *appened*
to existing value. In the case of -v -v -v, you need each new token to
increment existing value, which is essentially the same.

- Volodya


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