Boost logo

Boost Users :

Subject: Re: [Boost-users] [program_options] Obtaining parameter order
From: Adam Nielsen (a.nielsen_at_[hidden])
Date: 2009-04-13 01:35:29


>> For example, a program to work with .zip files might work like this:
>>
>> zip --rename=one.bin:alpha.bin --add=one.bin --rename=one.bin:beta.bin
>
> The parse_command_line function returns vector<options> which is accurate
> representation of what was found on the command line -- in particular:
>
> - the order of options is the same as on command line
> - if there are multiple occurrences of the same option, those are not
> collapsed and stay separate.
>
> Does this help?

Yes! This works exactly as I need. Thanks!

One question - parse_command_line() returns (eventually) a vector of
basic_option. This basic_option class contains the name of the option and a
vector of values.

What is this vector used for? If a command line option has no value (e.g.
"--verbose") then the vector is of course empty, and if the command line
option has a value (such as "--output file.bin") then the vector contains a
single value, so I'm wondering whether there's some syntax that will cause
multiple values to end up in this vector, or is it there for use later on
(when options are combined)?

At any rate this has solved my problem so thanks for the pointer!

Cheers,
Adam.


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