Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-10-01 12:31:20


Marty Fried wrote:

> I want to use the program_options library for my app's, well, program
> options. There is one set of options, which will usually only be one or
> two lines, that will have an unknown name; this is only handled by the
> (boost::program_options::) basic_command_line_parser template, with,
> apparently, no equivalent functionality for config files.
>
> This seems to me to be an oversight. I would have thought there would at
> least be an option to ignore unknown parameters if they aren't supported
> like for the command line.
>
> For my needs, it looks like I might need to modify the Boost sources to
> disable the exception on unknown parameters, or force the user to create a
> special config file for, most likely, a single parameter. Or I can change
> the syntax to something much less natural.
>
> What I'm hoping for is either someone to inform me that I'm wrong, and
> there is a way to handle config files more elegantly than what I'm seeing,
> or a suggestion as to how best to implement what I need.

I think SVN HEAD has this definition:

    basic_parsed_options<charT>
    parse_config_file(std::basic_istream<charT>&, const options_description&,
                      bool allow_unregistered = false);

which should work for you.

- 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