Boost logo

Boost Users :

From: Joshua ChaitinPollak (jpollak_at_[hidden])
Date: 2007-05-22 17:20:19


Hello,

I'm gradually porting my application to Boost, and I'm starting to
use the program_options library. I'm also using the boost::unit_test
library, and for some higher level unit tests its often convenient to
programmatically setup some properties specific to the test before it
runs. I can't figure out how to programmatically set program_options
in the variable_map however.

I currently wrap the boost::program_options interface with a simple
Config class, so what I'd like to have is something like this:

Config::setProperty(std::string &option, std::string &value);
Config::setProperty(std::string &option, int value);
Config::setProperty(std::string &option, bool value);

But I can't even get a generic std::string implementation working. It
looks like I have go through creating basic_option and
basic_parsed_options objects and calling po::store(parsed_options,
vm); except that instead of "std::string& option" above, I need to
pass in the option_description& object, which starts to get messy.

Is there an elegant way of doing this?

Thanks,

Josh

-- 
Joshua ChaitinPollak
Software Engineer
Kiva Systems

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