本文整理汇总了C++中string_ref::data方法的典型用法代码示例。如果您正苦于以下问题:C++ string_ref::data方法的具体用法?C++ string_ref::data怎么用?C++ string_ref::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string_ref
的用法示例。
在下文中一共展示了string_ref::data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: error
void
basic_url_base::parse_impl (string_ref s, boost::system::error_code& ec)
{
joyent::http_parser_url p;
value_type const* const data (s.data());
int const error (joyent::http_parser_parse_url (
data, s.size(), false, &p));
if (error)
{
ec = boost::system::error_code (
boost::system::errc::invalid_argument,
boost::system::generic_category());
return;
}
if ((p.field_set & (1<<joyent::UF_SCHEMA)) != 0)
{
m_scheme = string_ref (
data + p.field_data [joyent::UF_SCHEMA].off,
p.field_data [joyent::UF_SCHEMA].len);
}
else
{
m_scheme = string_ref {};
}
if ((p.field_set & (1<<joyent::UF_HOST)) != 0)
{
m_host = string_ref (
data + p.field_data [joyent::UF_HOST].off,
p.field_data [joyent::UF_HOST].len);
}
else
{
m_host = string_ref {};
}
if ((p.field_set & (1<<joyent::UF_PORT)) != 0)
{
m_port = p.port;
m_port_string = string_ref (
data + p.field_data [joyent::UF_PORT].off,
p.field_data [joyent::UF_PORT].len);
}
else
{
m_port = 0;
m_port_string = string_ref {};
}
if ((p.field_set & (1<<joyent::UF_PATH)) != 0)
{
m_path = string_ref (
data + p.field_data [joyent::UF_PATH].off,
p.field_data [joyent::UF_PATH].len);
}
else
{
m_path = string_ref {};
}
if ((p.field_set & (1<<joyent::UF_QUERY)) != 0)
{
m_query = string_ref (
data + p.field_data [joyent::UF_QUERY].off,
p.field_data [joyent::UF_QUERY].len);
}
else
{
m_query = string_ref {};
}
if ((p.field_set & (1<<joyent::UF_FRAGMENT)) != 0)
{
m_fragment = string_ref (
data + p.field_data [joyent::UF_FRAGMENT].off,
p.field_data [joyent::UF_FRAGMENT].len);
}
else
{
m_fragment = string_ref {};
}
if ((p.field_set & (1<<joyent::UF_USERINFO)) != 0)
{
m_userinfo = string_ref (
data + p.field_data [joyent::UF_USERINFO].off,
p.field_data [joyent::UF_USERINFO].len);
}
else
{
m_userinfo = string_ref {};
}
}
示例2: error
void
basic_url_base::parse_impl (string_ref s, boost::system::error_code& ec)
{
joyent::http_parser_url p;
value_type const* const data (s.data());
int const error (joyent::http_parser_parse_url (
data, s.size(), false, &p));
if (error)
{
ec = boost::system::error_code (
boost::system::errc::invalid_argument,
boost::system::generic_category());
return;
}
if ((p.field_set & (1<<joyent::uf_schema)) != 0)
{
m_scheme = string_ref (
data + p.field_data [joyent::uf_schema].off,
p.field_data [joyent::uf_schema].len);
}
else
{
m_scheme = string_ref {};
}
if ((p.field_set & (1<<joyent::uf_host)) != 0)
{
m_host = string_ref (
data + p.field_data [joyent::uf_host].off,
p.field_data [joyent::uf_host].len);
}
else
{
m_host = string_ref {};
}
if ((p.field_set & (1<<joyent::uf_port)) != 0)
{
m_port = p.port;
m_port_string = string_ref (
data + p.field_data [joyent::uf_port].off,
p.field_data [joyent::uf_port].len);
}
else
{
m_port = 0;
m_port_string = string_ref {};
}
if ((p.field_set & (1<<joyent::uf_path)) != 0)
{
m_path = string_ref (
data + p.field_data [joyent::uf_path].off,
p.field_data [joyent::uf_path].len);
}
else
{
m_path = string_ref {};
}
if ((p.field_set & (1<<joyent::uf_query)) != 0)
{
m_query = string_ref (
data + p.field_data [joyent::uf_query].off,
p.field_data [joyent::uf_query].len);
}
else
{
m_query = string_ref {};
}
if ((p.field_set & (1<<joyent::uf_fragment)) != 0)
{
m_fragment = string_ref (
data + p.field_data [joyent::uf_fragment].off,
p.field_data [joyent::uf_fragment].len);
}
else
{
m_fragment = string_ref {};
}
if ((p.field_set & (1<<joyent::uf_userinfo)) != 0)
{
m_userinfo = string_ref (
data + p.field_data [joyent::uf_userinfo].off,
p.field_data [joyent::uf_userinfo].len);
}
else
{
m_userinfo = string_ref {};
}
}