21 const std::string &value)
25 value_list.push_back(value);
31 set_option(option, std::string(value?
"1":
"0"));
47 return value.empty()?
false:(std::stoi(value)!=0);
53 return value.empty()?0:std::stoi(value);
69 option_mapt::const_iterator it=
74 else if(it->second.empty())
77 return it->second.front();
81 const std::string &option)
const
83 option_mapt::const_iterator it=
96 .map([](
const std::pair<std::string, value_listt> &option_pair) {
97 return std::pair<std::string, json_arrayt>{
99 make_range(option_pair.second).map(constructor_of<json_stringt>())};
106 xmlt xml_options(
"options");
111 for(
const auto &value : option_pair.second)
114 xml_value.
data = value;
125 out << option_pair.first <<
": ";
127 for(
const auto &value : option_pair.second)
133 out <<
'"' << value <<
'"';
unsigned int get_unsigned_int_option(const std::string &option) const
bool is_set(const std::string &option) const
N.B. opts.is_set("foo") does not imply opts.get_bool_option("foo")
json_objectt to_json() const
Returns the options as JSON key value pairs.
const value_listt empty_list
bool get_bool_option(const std::string &option) const
void set_option(const std::string &option, const bool value)
const std::string get_option(const std::string &option) const
xmlt to_xml() const
Returns the options in XML format.
void output(std::ostream &out) const
Outputs the options to out
signed int get_signed_int_option(const std::string &option) const
const value_listt & get_list_option(const std::string &option) const
std::list< std::string > value_listt
void set_attribute(const std::string &attribute, unsigned value)
xmlt & new_element(const std::string &key)
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
unsigned safe_string2unsigned(const std::string &str, int base)
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.