I'm trying to read config files with Boost::program_options. The config files look like:
hier.arch.y.option_name = 0x5
another.hier.archy.setting_name = 0x1E
I want to be able to search by just "option_name" or "setting_name". I'm not worried too much about duplicates but if there's a way optionally to match 2 substrings (i.e. "another" + "setting_name") that'd be great too.
Is there a way to get program_options to match based on substring?
Code sample:
namespace po = boost::program_options;
po::options_description cmd_opts{"Options"};
po::options_description config_file_opts;
cmd_opts.add_options()
("help,h", "Help message")
("config_help", "List of configurations available in config file");
po::variables_map vm;
po::store(parse_command_line(argc, argv, combined_opts), vm);
auto parsed_opts = po::parse_config_file<char>(vm.["config_file"].as<std::string>);
po::store(parsed_opts, vm);
Config file:
foo.bar.setting0 = 0x5
foo.notbar.setting1 = 0x6
bar.notfoo.setting2 = 0x5E
I'd like to assign the following options:
int setting0;
int setting1;
int setting2;