Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-04-18 13:51:57


Stefan,

it depends on how far you are ready to go ;) What you request is possible,
but that will not work (AFAIK) from the scratch.

What you need is custom handling of the options parsed.

namespace po = boost::program_options;

template<class CharT>
void handle_parsed_option(po::basic_option<CharT> const& parsed_option)
{
   //parse it
}

//program options are used to properly parse values
// so all options parsed are valid
po::options_description options("Option Parser");
options.add_options()
  ("*", po::value<int>(), "dummy placeholder")
;

po::parsed_options const& opts = po::parse_config_file(input, options);

::std::for_each(opts.options.begin(), opts.options.end(),
&handle_parsed_option<char>);

Hope that helps.

Best Regards,
Ovanes

On Fri, Apr 18, 2008 at 10:53 AM, Stefan Walk <walk_at_[hidden]>
wrote:

> Hi,
>
> is there a general description of the config file syntax that
> program_options uses available? Like if it's case-sensitive, if you can
> quote arguments, etc ... currently i'm wondering if I can fill a vector
> from one line, like
> val = foo bar baz
> with foo, bar, and baz as the values ... is this possible with some
> separator?
>
> Regards,
> Stefan
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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