12#ifndef OPENVPN_OPTIONS_SERVPUSH_H
13#define OPENVPN_OPTIONS_SERVPUSH_H
38 reserve(size() + push->size());
54 void parse(
const std::string &title,
const Json::Value &push_list)
58 for (
size_t i = 0; i < ja.size(); ++i)
60 const Json::Value &jv = ja[i];
63 else if (jv.isObject())
65 const Json::Value &ji = jv[
"item"];
68 else if (ji.isArray())
70 const auto &ia = ji.asArray();
71 for (
size_t j = 0; j < ia.size(); ++j)
73 const Json::Value &iv = ia[j];
77 throw json::json_parse(
json::fmt_name(i, title) +
" object contains 'item' array that includes non-string element at index=" + std::to_string(j));
81 throw json::json_parse(
json::fmt_name(i, title) +
" object must contain 'item' string or array");
84 throw json::json_parse(
json::fmt_name(i, title) +
" must be of type string or object");
89 void extend(
const std::vector<std::string> &other)
91 reserve(size() + other.size());
99 std::ostringstream
os;
106 for (
auto &e : *
this)
115 const bool must_quote = (e.find_first_of(
',') != std::string::npos);
const IndexList * get_index_ptr(const std::string &name) const
static OptionList parse_from_csv_static(const std::string &str, Limits *lim)
void touch(bool lightly=false) const
const std::string & get(const size_t index, const size_t max_len) const
static void escape_string(std::ostream &out, const std::string &term, const bool must_quote)
void extend(const std::vector< std::string > &other)
void parse(const std::string &opt_name, const OptionList &opt)
static void output_arg(const std::string &e, std::ostream &os)
OptionList to_option_list() const
void output_csv(std::ostream &os) const
void parse(const std::string &title, const Json::Value &push_list)
std::string fmt_name(const NAME &name, const TITLE &title)
const Json::Value & cast_array(const Json::Value &value, const bool optional, const TITLE &title)
server addresses push_back({address, port})