本文整理汇总了C++中boost::string_ref::starts_with方法的典型用法代码示例。如果您正苦于以下问题:C++ string_ref::starts_with方法的具体用法?C++ string_ref::starts_with怎么用?C++ string_ref::starts_with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::string_ref
的用法示例。
在下文中一共展示了string_ref::starts_with方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pdibuf
/* irc_inline() - 1 single line received from serv */
void
server::p_inline (const boost::string_ref& text)
{
session *sess;
char *type;
char *word[PDIWORDS+1];
char *word_eol[PDIWORDS+1];
message_tags_data tags_data = message_tags_data();
std::string pdibuf(text.size(), '\0');
sess = this->front_session;
/* Python relies on this */
word[PDIWORDS] = NULL;
word_eol[PDIWORDS] = NULL;
std::string buf;
if (text.starts_with('@'))
{
auto sep = text.find_first_of(' ');
if (sep == boost::string_ref::npos)
return;
/* skip the '@' */
auto tags = text.substr(1, sep - 1);
buf = text.substr(sep + 1).to_string();
handle_message_tags(*this, tags, tags_data);
}
else
{
buf = text.to_string();
}
url_check_line(buf.data(), buf.size());
/* split line into words and words_to_end_of_line */
process_data_init (&pdibuf[0], &buf[0], word, word_eol, false, false);
if (buf[0] == ':')
{
/* find a context for this message */
if (this->is_channel_name (word[3]))
{
auto tmp = find_channel (word[3]);
if (tmp)
sess = &(*tmp);
}
/* for server messages, the 2nd word is the "message type" */
type = word[2];
word[0] = type;
word_eol[1] = &buf[0]; /* keep the ":" for plugins */
if (plugin_emit_server(sess, type, word, word_eol,
tags_data.timestamp))
{
return;
}
word[1]++;
word_eol[1] = &buf[1]; /* but not for HexChat internally */
} else
{
word[0] = type = word[1];
if (plugin_emit_server(sess, type, word, word_eol,
tags_data.timestamp))
{
return;
}
}
if (buf[0] != ':')
{
process_named_servermsg (sess, &buf[0], word[0], word_eol, &tags_data);
return;
}
/* see if the second word is a numeric */
std::locale locale;
if (std::isdigit (word[2][0], locale))
{
char* t = word_eol[4];
if (*t == ':')
t++;
process_numeric (sess, atoi (word[2]), word, word_eol, t, &tags_data);
} else
{
process_named_msg (sess, type, word, word_eol, &tags_data);
}
}