本文整理汇总了C++中self_type::BeginReading方法的典型用法代码示例。如果您正苦于以下问题:C++ self_type::BeginReading方法的具体用法?C++ self_type::BeginReading怎么用?C++ self_type::BeginReading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self_type
的用法示例。
在下文中一共展示了self_type::BeginReading方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BeginReading
int32_t
nsACString::Find(const self_type& aStr, uint32_t aOffset,
ComparatorFunc c) const
{
const char_type *begin, *end;
uint32_t selflen = BeginReading(&begin, &end);
if (aOffset > selflen)
return -1;
const char_type *other;
uint32_t otherlen = aStr.BeginReading(&other);
if (otherlen > selflen - aOffset)
return -1;
// We want to stop searching otherlen characters before the end of the string
end -= otherlen;
for (const char_type *cur = begin + aOffset; cur <= end; ++cur) {
if (!c(cur, other, otherlen))
return cur - begin;
}
return -1;
}
示例2: BeginReading
int32_t
nsACString::RFind(const self_type& aStr, int32_t aOffset,
ComparatorFunc aComparator) const
{
const char_type* begin;
const char_type* end;
uint32_t selflen = BeginReading(&begin, &end);
const char_type* other;
uint32_t otherlen = aStr.BeginReading(&other);
if (selflen < otherlen) {
return -1;
}
if (aOffset < 0 || uint32_t(aOffset) > (selflen - otherlen)) {
end -= otherlen;
} else {
end = begin + aOffset;
}
for (const char_type* cur = end; cur >= begin; --cur) {
if (!aComparator(cur, other, otherlen)) {
return cur - begin;
}
}
return -1;
}
示例3: BeginReading
PRInt32
nsACString::RFind(const self_type& aStr, PRInt32 aOffset, ComparatorFunc c) const
{
const char_type *begin, *end;
PRUint32 selflen = BeginReading(&begin, &end);
const char_type *other;
PRUint32 otherlen = aStr.BeginReading(&other);
if (selflen < otherlen)
return -1;
if (aOffset < 0 || aOffset > (selflen - otherlen))
end -= otherlen;
else
end = begin + aOffset;
for (const char_type *cur = end; cur >= begin; --cur) {
if (!c(cur, other, otherlen))
return cur - begin;
}
return -1;
}