CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cxxopts::OptionAdder Class Reference

#include <cxxopts.h>

Public Member Functions

OptionAdderoperator() (const std::string &opts, const std::string &desc, std::shared_ptr< const Value > value=::cxxopts::value< bool >(), std::string arg_help="")
 
 OptionAdder (Options &options, std::string group)
 

Private Attributes

std::string m_group
 
Optionsm_options
 

Detailed Description

Definition at line 841 of file cxxopts.h.

Constructor & Destructor Documentation

◆ OptionAdder()

cxxopts::OptionAdder::OptionAdder ( Options options,
std::string  group 
)
inline

Definition at line 843 of file cxxopts.h.

std::string m_group
Definition: cxxopts.h:852
Options & m_options
Definition: cxxopts.h:851
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ operator()()

OptionAdder & cxxopts::OptionAdder::operator() ( const std::string &  opts,
const std::string &  desc,
std::shared_ptr< const Value value = ::cxxopts::value<bool>(),
std::string  arg_help = "" 
)
inline

Definition at line 958 of file cxxopts.h.

References cxxopts::Options::add_option(), submitPVResolutionJobs::desc, m_group, m_options, eostools::move(), geometryDiff::opts, and mps_fire::result.

961  {
962  std::match_results<const char*> result;
963  std::regex_match(opts.c_str(), result, option_specifier);
964 
965  if (result.empty()) {
966  throw Invalid_option_format_error(opts);
967  }
968 
969  const auto& short_match = result[2];
970  const auto& long_match = result[3];
971 
972  if (!short_match.length() && !long_match.length()) {
973  throw Invalid_option_format_error(opts);
974  } else if (long_match.length() == 1 && short_match.length()) {
975  throw Invalid_option_format_error(opts);
976  }
977 
978  auto option_names = [](const std::sub_match<const char*>& short_, const std::sub_match<const char*>& long_) {
979  if (long_.length() == 1) {
980  return std::make_tuple(long_.str(), short_.str());
981  } else {
982  return std::make_tuple(short_.str(), long_.str());
983  }
984  }(short_match, long_match);
985 
987  m_group, std::get<0>(option_names), std::get<1>(option_names), desc, value, std::move(arg_help));
988 
989  return *this;
990  }
std::string m_group
Definition: cxxopts.h:852
void add_option(const std::string &group, const std::string &s, const std::string &l, std::string desc, std::shared_ptr< const Value > value, std::string arg_help)
Definition: cxxopts.h:1206
Options & m_options
Definition: cxxopts.h:851
Definition: value.py:1
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ m_group

std::string cxxopts::OptionAdder::m_group
private

Definition at line 852 of file cxxopts.h.

Referenced by operator()().

◆ m_options

Options& cxxopts::OptionAdder::m_options
private

Definition at line 851 of file cxxopts.h.

Referenced by operator()().