本文整理汇总了C++中rxx::start方法的典型用法代码示例。如果您正苦于以下问题:C++ rxx::start方法的具体用法?C++ rxx::start怎么用?C++ rxx::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rxx
的用法示例。
在下文中一共展示了rxx::start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sep
// A lot of this is taken from async/rxx.C in sfslite, but with some
// modifications for returning the matched pattern.
//
int
split2 (vec<str> *out, rxx pat, str expr, size_t lim, bool emptylast)
{
const char *p = expr;
const char *const e = p + expr.len ();
size_t n;
if (out)
out->clear ();
// check p < e to see that we're not dealing with an empty
// string (especially since x? matches "").
for (n = 0; p < e && n + 1 < lim; n++) {
if (!pat._exec (p, e - p, 0)) {
return 0;
}
if (!pat.success ())
break;
if (out) {
out->push_back (str (p, pat.start (0)));
str sep (p + pat.start (0), pat.len (0));
out->push_back (sep);
}
p += max (pat.end (0), 1);
}
if (lim && (p < e || emptylast)) {
n++;
if (out) {
out->push_back (str (p, e - p));
}
}
return n;
}
示例2: str
void
repl_el_capture_t::output (strbuf &out, const char *s, rxx &x)
{
int start = x.start (_i);
int ln = x.len (_i);
if (start >= 0 && ln > 0) {
str repl = str (s + start, ln);
strbuf_output (out, repl);
}
}
示例3: if
static void
extract_matches (vec<str> *out, const char *base, rxx &x)
{
bool go = true;
for (int i = 0; go; i++) {
int ln = x.len (i);
int start = x.start (i);
if (ln < 0 || start < 0) { go = false; }
else if (ln > 0) { out->push_back (str (base + start, ln)); }
}
}