本文整理汇总了C++中string_ref::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ string_ref::begin方法的具体用法?C++ string_ref::begin怎么用?C++ string_ref::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string_ref
的用法示例。
在下文中一共展示了string_ref::begin方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find_char
inline size_t find_char(const string_ref& s, char c)
{
const char *b = s.begin();
const char *e = s.end();
const char *const p = memchr_char(b, c, e - b);
return p ? (p - b) : (e - b);
}
示例2: operator
void Writer::operator() (const string_ref &s) {
if (need_indent) {
need_indent = 0;
write_indent();
}
append (s.begin(), s.length());
}
示例3: id_value
void id_value(string_ref value)
{
if (id_placeholder* p = state.get_placeholder(value))
{
assert(!use_resolved_ids ||
p->check_state(id_placeholder::generated));
std::string const& id = use_resolved_ids ?
p->id : p->unresolved_id;
result.append(source_pos, value.begin());
result.append(id.begin(), id.end());
source_pos = value.end();
}
}
示例4: callout
void syntax_highlight_actions::callout(parse_iterator, parse_iterator)
{
out << state.add_callout(qbk_value(state.current_file,
marked_text.begin(), marked_text.end()));
marked_text.clear();
}
示例5: interop
// Should be equal
void interop ( const std::string &str, string_ref ref ) {
// BOOST_CHECK ( str == ref );
BOOST_CHECK ( str.size () == ref.size ());
BOOST_CHECK ( std::equal ( str.begin (), str.end (), ref.begin ()));
BOOST_CHECK ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
}
示例6: return
inline bool
operator !=(const string_ref& x, const string_ref& y) {
return (x.size() != y.size()) ||
(::memcmp(x.begin(), y.begin(), x.size()) != 0);
}
示例7: char
template <size_t N> inline bool
operator ==(const string_ref& x, const char (& y)[N]) {
return (x.size() == N - 1) && (::memcmp(x.begin(), y, N - 1) == 0);
}
示例8: operator
size_t operator()(string_ref const& sr) const {
return boost::hash_range(sr.begin(), sr.end());
}
示例9: start
void start(string_ref xml)
{
source_pos = xml.begin();
}
示例10: close
void
hstcpcli::request_buf_exec_generic(size_t pst_id, const string_ref& op,
const string_ref *kvs, size_t kvslen, uint32_t limit, uint32_t skip,
const string_ref& mod_op, const string_ref *mvs, size_t mvslen,
const hstcpcli_filter *fils, size_t filslen, int invalues_keypart,
const string_ref *invalues, size_t invalueslen)
{
if (num_req_sent > 0 || num_req_rcvd > 0) {
close();
set_error(-1, "request_buf_exec_generic: protocol out of sync");
return;
}
append_uint32(writebuf, pst_id); // FIXME size_t ?
writebuf.append_literal("\t");
writebuf.append(op.begin(), op.end());
writebuf.append_literal("\t");
append_uint32(writebuf, kvslen); // FIXME size_t ?
for (size_t i = 0; i < kvslen; ++i) {
const string_ref& kv = kvs[i];
append_delim_value(writebuf, kv.begin(), kv.end());
}
if (limit != 0 || skip != 0 || invalues_keypart >= 0 ||
mod_op.size() != 0 || filslen != 0) {
/* has more option */
writebuf.append_literal("\t");
append_uint32(writebuf, limit); // FIXME size_t ?
if (skip != 0 || invalues_keypart >= 0 ||
mod_op.size() != 0 || filslen != 0) {
writebuf.append_literal("\t");
append_uint32(writebuf, skip); // FIXME size_t ?
}
if (invalues_keypart >= 0) {
writebuf.append_literal("\[email protected]\t");
append_uint32(writebuf, invalues_keypart);
writebuf.append_literal("\t");
append_uint32(writebuf, invalueslen);
for (size_t i = 0; i < invalueslen; ++i) {
const string_ref& s = invalues[i];
append_delim_value(writebuf, s.begin(), s.end());
}
}
for (size_t i = 0; i < filslen; ++i) {
const hstcpcli_filter& f = fils[i];
writebuf.append_literal("\t");
writebuf.append(f.filter_type.begin(), f.filter_type.end());
writebuf.append_literal("\t");
writebuf.append(f.op.begin(), f.op.end());
writebuf.append_literal("\t");
append_uint32(writebuf, f.ff_offset);
append_delim_value(writebuf, f.val.begin(), f.val.end());
}
if (mod_op.size() != 0) {
writebuf.append_literal("\t");
writebuf.append(mod_op.begin(), mod_op.end());
for (size_t i = 0; i < mvslen; ++i) {
const string_ref& mv = mvs[i];
append_delim_value(writebuf, mv.begin(), mv.end());
}
}
}
writebuf.append_literal("\n");
++num_req_bufd;
}