本文整理汇总了C++中boost::string_ref::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ string_ref::begin方法的具体用法?C++ string_ref::begin怎么用?C++ string_ref::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::string_ref
的用法示例。
在下文中一共展示了string_ref::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find_if
std::vector<std::pair<boost::string_ref, boost::string_ref>>::const_iterator find(const boost::string_ref key) const
{
return std::find_if(m_collection.begin(), m_collection.end(),
[key](const std::pair<boost::string_ref, boost::string_ref>& str)-> bool
{
auto oneSize = str.first.size();
auto twoSize = key.size();
if (oneSize != twoSize)
{
return false;
}
if (oneSize >= 4)
{
if ((str.first[0] == key[0]) &&
(str.first[1] == key[1]) &&
(str.first[oneSize - 1] == key[oneSize - 1]) &&
(str.first[oneSize - 2] == key[oneSize - 2]))
{
return std::memcmp(str.first.begin(), key.begin(), oneSize) == 0;
}
}
else
{
return std::memcmp(str.first.begin(), key.begin(), oneSize) == 0;
}
return false;
}
);
}
示例2: operator
bool operator()(const boost::string_ref& strRef1, const boost::string_ref& strRef2) const
{
auto oneSize = strRef1.size();
auto twoSize = strRef2.size();
if (oneSize != twoSize)
{
return false;
}
return std::memcmp(strRef1.begin(), strRef2.begin(), oneSize) == 0;
}
示例3: print_string
void print_string(boost::string_ref str, std::ostream& out)
{
for (boost::string_ref::const_iterator cur = str.begin();
cur != str.end(); ++cur)
{
print_char(*cur, out);
}
}
示例4: cpp_name
std::string codegen_base::cpp_name(boost::string_ref name)
{
std::string result;
if (!std::isalpha(name[0]))
result = "_";
std::transform(name.begin(), name.end(), std::back_inserter(result),
[] (char c) { return std::isalnum(c) ? c : '_'; });
return result;
}
示例5: is_emm_file
inline bool is_emm_file(boost::string_ref path)
{
std::ifstream ifs( convert_code( path, CP_UTF8, CP_OEMCP ), std::ios::binary );
if( ifs.fail() ) {
return false;
}
std::istreambuf_iterator< char > first( ifs ), last;
boost::string_ref const seg( "[Info]\r\nVersion = 3\r\n" );
return std::search( first, last, seg.begin(), seg.end() ) != last;
}
示例6: drive_letter_exists
inline bool drive_letter_exists(Iterator itr, Iterator end)
{
boost::string_ref const str( ":\\" );
if( std::distance( itr, end ) < static_cast< std::ptrdiff_t >( str.size() + 1 ) ) {
return false;
}
for( int i = 'A'; i <= 'Z'; ++i ) {
if( *itr == i ) {
return std::equal( str.begin(), str.end(), itr + 1 );
}
}
return false;
}
示例7: index
id_placeholder::id_placeholder(
unsigned index,
boost::string_ref id,
id_category category,
id_placeholder const* parent_)
: index(index),
unresolved_id(parent_ ?
parent_->unresolved_id + '.' + detail::to_s(id) :
detail::to_s(id)),
id(id.begin(), id.end()),
parent(parent_),
category(category),
num_dots(boost::range::count(id, '.') +
(parent_ ? parent_->num_dots + 1 : 0))
{
}
示例8: encode_string
std::string encode_string(boost::string_ref str)
{
std::string result;
result.reserve(str.size());
for (boost::string_ref::const_iterator it = str.begin();
it != str.end(); ++it)
{
switch (*it)
{
case '<': result += "<"; break;
case '>': result += ">"; break;
case '&': result += "&"; break;
case '"': result += """; break;
default: result += *it; break;
}
}
return result;
}
示例9: file
file(file const& f, boost::string_ref source) :
path(f.path), source_(source.begin(), source.end()),
is_code_snippets(f.is_code_snippets),
qbk_version(f.qbk_version), ref_count(0)
{}
示例10: operator
auto operator()(boost::string_ref string) const
{
return boost::hash_range(string.begin(), string.end());
}
示例11: string
inline std::string to_s(boost::string_ref x) {
return std::string(x.begin(), x.end());
}
示例12: escape_uri
inline std::string escape_uri(boost::string_ref uri) {
return escape_uri(std::string(uri.begin(), uri.end()));
}
示例13: parse
url::
url(const boost::string_ref &ref)
: m_string { ref.begin(), ref.end() }
{
parse();
}
示例14: generic_to_path
fs::path generic_to_path(boost::string_ref x)
{
return fs::path(x.begin(), x.end());
}
示例15: 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();
}