当前位置: 首页>>代码示例>>C++>>正文


C++ self_type::BeginReading方法代码示例

本文整理汇总了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;
}
开发者ID:mikeaich,项目名称:releases-mozilla-central,代码行数:25,代码来源:nsStringAPI.cpp

示例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;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:28,代码来源:nsStringAPI.cpp

示例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;
}
开发者ID:fortunto2,项目名称:celtx,代码行数:23,代码来源:nsStringAPI.cpp


注:本文中的self_type::BeginReading方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。