16#ifndef OPENVPN_COMMON_SPLIT_H
17#define OPENVPN_COMMON_SPLIT_H
58template <
typename V,
typename LEX,
typename LIM>
59inline void by_char_void(V &
ret,
const std::string &
input,
const char split_by,
const unsigned int flags = 0,
const unsigned int max_terms = ~0, LIM *lim =
nullptr)
62 unsigned int nterms = 0;
64 for (std::string::const_iterator i =
input.begin(); i !=
input.end(); ++i)
68 if (!lex.in_quote() && c == split_by && nterms < max_terms)
72 ret.push_back(std::move(term));
82 ret.push_back(std::move(term));
86template <
typename V,
typename LEX,
typename LIM>
87inline V
by_char(
const std::string &
input,
const char split_by,
const unsigned int flags = 0,
const unsigned int max_terms = ~0, LIM *lim =
nullptr)
90 by_char_void<V, LEX, LIM>(
ret,
input, split_by,
flags, max_terms, lim);
104template <
typename V,
typename LEX,
typename SPACE,
typename LIM>
110 bool defined =
false;
111 for (std::string::const_iterator i =
input.begin(); i !=
input.end(); ++i)
119 const char tc = clamp_to_default<char>(lex.get(),
'?');
120 if (!SPACE::is_space(tc) || lex.in_quote())
129 ret.push_back(std::move(term));
139 ret.push_back(std::move(term));
144template <
typename V,
typename LEX,
typename SPACE,
typename LIM>
148 by_space_void<V, LEX, SPACE, LIM>(
ret,
input, lim);
void by_space_void(V &ret, const std::string &input, LIM *lim=nullptr)
V by_char(const std::string &input, const char split_by, const unsigned int flags=0, const unsigned int max_terms=~0, LIM *lim=nullptr)
void by_char_void(V &ret, const std::string &input, const char split_by, const unsigned int flags=0, const unsigned int max_terms=~0, LIM *lim=nullptr)
V by_space(const std::string &input, LIM *lim=nullptr)
static bool is_space(char c)
static const char * input[]