Boost logo

Boost :

From: Rodolfo Schulz de Lima (rodolfo_at_[hidden])
Date: 2004-09-09 15:52:15


Hi, I wonder if it's possible to handle dynamically created program
options with boost::program_options. For instance: I have a config file
that specifies configure options for dynamic loaded modules in my
project. So the cfg file would be:

[module.foo1]
module_file = foo.so
listen_port = 564
enabled = true

[module.foo2]
module_file = foo.so
listen_port = 565
enabled = false

[module.bar1]
module_file = bar.so
listen_port = 145
enabled = true

As can be seen, foo1, foo2 and bar1 names are defined by the user in the
configure file, and the program doesn't know about them before parsing
the configuration. But if we parse that (somehow), an exception saying that
the option "module.foo1.module_file" is invalid will be thrown. Can I
manage the options_description "on the fly"?

Another less complicated situation would be something like this:

modules = foo1 foo2 bar1

[module.foo1]
.
.
.

[module.foo2]
.
.
.

[module.bar1]
.
.
.

So when parsing the "modules" option, we would know the new options name
and it would be a matter of appending more option descriptions to the
object.

Regards,
rod


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk