14 substring ss = {
const_cast<char*
>(s.c_str()), const_cast<char*>(s.c_str()) + s.size()};
30 if (opt->default_value_supplied())
32 THROW(
"Using a bool option type acts as a switch, no explicit default value is allowed.")
35 value->default_value({
false});
37 value->implicit_value({
true});
43 std::shared_ptr<base_option> opt, po::options_description& options_description)
45 add_to_description_impl<supported_options_types>(std::move(opt), options_description);
50 po::options_description new_options(group.
m_name);
72 .style(po::command_line_style::default_style ^ po::command_line_style::allow_guessing)
76 for (
auto const& option : parsed_options.options)
88 for (
auto& val : option.value)
95 if (option.string_key.length() > 0 && option.string_key[0] ==
'-')
97 auto short_name = option.string_key.substr(1);
98 for (
const auto& opt_ptr : group.
m_options)
100 if (opt_ptr->m_short_name == short_name)
108 po::store(parsed_options, vm);
111 catch (boost::exception_detail::clone_impl<
112 boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value>>& ex)
116 catch (boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_lexical_cast>>& ex)
120 catch (boost::exception_detail::clone_impl<
121 boost::exception_detail::error_info_injector<boost::program_options::ambiguous_option>>& ex)
125 catch (boost::program_options::ambiguous_option& ex)
148 std::vector<std::shared_ptr<base_option>> output_values;
151 [](std::pair<const std::string, std::shared_ptr<base_option>>& kv) {
return kv.second; });
153 return output_values;
164 throw std::out_of_range(key +
" was not found.");
180 void options_boost_po::add_to_description_impl<typelist<>>(std::shared_ptr<base_option>, po::options_description&)
182 THROW(
"That is an unsupported option type.");
po::typed_value< std::vector< T > > * add_notifier(std::shared_ptr< typed_option< T >> &opt, po::typed_value< std::vector< T >> *po_value)
po::typed_value< std::vector< T > > * convert_to_boost_value(std::shared_ptr< typed_option< T >> &opt)
std::vector< std::shared_ptr< base_option > > m_options
#define THROW_EX(ex, args)
std::vector< std::string > m_command_line
const char * what() const noexcept override
void add_to_description(std::shared_ptr< base_option > opt, po::options_description &options_description)
std::set< std::string > m_ignore_supplied
virtual void check_unregistered() override
bool is_number(const std::string &s)
virtual void add_and_parse(const option_group_definition &group) override
virtual std::vector< std::shared_ptr< base_option > > get_all_options() override
virtual bool was_supplied(const std::string &key) override
std::set< std::string > m_supplied_options
po::typed_value< std::vector< T > > * get_base_boost_value(std::shared_ptr< typed_option< T >> &opt)
virtual std::string help() override
node_pred * find(recall_tree &b, uint32_t cn, example &ec)
std::map< std::string, std::shared_ptr< base_option > > m_options
std::set< std::string > m_defined_options
std::stringstream m_help_stringstream
float parseFloat(char *p, char **end, char *endLine=nullptr)
virtual std::shared_ptr< base_option > get_option(const std::string &key) override