如何在Boost :: Program_Options中支持命令行语法“-DEVICE:iphone”?

时间:2011-08-02 03:35:51

标签: c++ boost boost-program-options

Boost :: Program_Options的默认语法是“--DEVICE iphone”。我如何支持语法“-DEVICE:iphone”或“-DEVICE = iphone”?

1 个答案:

答案 0 :(得分:5)

Boost.Program_Options有相当多的option styles。你似乎想要的特殊组合是:

command_line_style::long_allow_adjacent |
command_line_style::short_allow_adjacent |
command_line_style::allow_long_disguise

这些选项应该提供给命令行解析器的style函数:

    po::store(po::command_line_parser(argc, argv).style(<your styles here>).run(), vm);