|
Boost Users : |
From: Roel (roel_v_at_[hidden])
Date: 2006-05-06 09:06:29
Hi,
I've been using boost::program_options but I have some questions about it.
First: to catch errors that the users makes when specifying command-line
options (eg I declared an option to be integer-only but the user
specified a string), I surrounded the call to store() by a try/catch block:
try {
boost::program_options::store(
boost::program_options::command_line_parser(argc, argv).
options(desc).positional(p).run(), vm);
}
catch (boost::program_options::invalid_option_value e) {
}
But now how do I give a meaningfull error message? The what() function
of invalid_option_value is private, what other options do I have?
Secondly, is there a mechanism to check the relation between options? I
have a number of options: -a, -m and -d for add, modify and delete
respectively; I want only one of them to be allowed at the same time.
Also, when the -a option is specified, the -t and -r options are valid,
and only then. Do I have to check all of that manually? Thanks.
cheers,
roel
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