|
Boost Users : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-04-25 01:45:55
Andrew Schweitzer wrote:
> Vladimir Prus wrote:
>> Fran?ois Duranleau wrote:
>>>variables_map inherits from std::map as well (though it's not documented
>>>as such).
>
>>>The type of values iterated over are pairs of std::string and
>>>boost::program_options::variable_value.
>>
>>
>> I have no idea why BoostBook decided to hide that inheritance, but it was
>> designed that way, so that you can iterate variables_map. I've added
>> comment to that effect to varaibles_map class docs.
>>
> > - Volodya
>
> Is there a way to extract the "original" string from variable_value? By
> this I mean the one taken from command line or ini file before
> conversion to int, float etc...? I suppose for vectors this would be
> impossible - you would need a vector of "original" strings. But this
> would at least cut the cases down. Is it possible to as a variable it
> holds a single or multiple values?
No, it's not possible, partly due to issues with vectors, and partly because
I did not though this will be requested. The best you can now is:
parsed_options opts = parse_command_line(......);
store(opts, vm);
And then iterate over opts.options. Each element has type 'option' which in
turn has member 'original_tokens'.
- 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