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


C++ QString::cend方法代码示例

本文整理汇总了C++中QString::cend方法的典型用法代码示例。如果您正苦于以下问题:C++ QString::cend方法的具体用法?C++ QString::cend怎么用?C++ QString::cend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QString的用法示例。


在下文中一共展示了QString::cend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: constIteratorStdCopyTest

void StringIteratorTest::constIteratorStdCopyTest()
{
  QString source;
  QString destination;
  StringConstIterator first, last;

  source = "abcd";
  destination.clear();
  first = source.cbegin();
  last = source.cend();
  std::copy( first, last, std::back_inserter(destination) );
  QCOMPARE(destination, source);

  source = "éöàäèü$£";
  destination.clear();
  first = source.cbegin();
  last = source.cend();
  std::copy( first, last, std::back_inserter(destination) );
  QCOMPARE(destination, source);
}
开发者ID:scandyna,项目名称:multidiagtools,代码行数:20,代码来源:StringIteratorTest.cpp

示例2: validateFragment

 bool Address::validateFragment(const QString& s)
 {
     // TODO refactor with ExpressionParser.cpp (auto base = +qi::char_("a-zA-Z0-9_~().-");)
     return std::all_of(s.cbegin(), s.cend(), [] (auto uc) {
         auto c = uc.toLatin1();
         return (c >= 'a' && c <= 'z')
                 || (c >= 'A' && c <= 'Z')
                 || (c >= '0' && c <= '9')
                 || (c == '.')
                 || (c == '~')
                 || (c == '_')
                 || (c == '(')
                 || (c == ')')
                 || (c == '-')
                 ;
     });
 }
开发者ID:Sciss,项目名称:i-score,代码行数:17,代码来源:Address.cpp

示例3: constIteratorBenchmark

void StringIteratorTest::constIteratorBenchmark()
{
  QString source = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
  std::vector<wchar_t> destination;

  destination.reserve(source.size());
  QBENCHMARK
  {
    destination.clear();
    StringConstIterator first(source.cbegin());
    StringConstIterator last(source.cend());
    while(first != last){
      destination.push_back(*first);
      ++first;
    }
  }
  QCOMPARE((int)destination.size(), source.size());
}
开发者ID:scandyna,项目名称:multidiagtools,代码行数:18,代码来源:StringIteratorTest.cpp

示例4:

bool OsmAnd::Utilities::extractFirstNumberPosition(const QString& value, int& first, int& last, bool allowSigned, bool allowDot)
{
    first = -1;
    last = -1;
    int curPos = 0;
    for(auto itChr = value.cbegin(); itChr != value.cend() && (first == -1 || last == -1); ++itChr, curPos++)
    {
        auto chr = *itChr;
        if (first == -1 && chr.isDigit())
            first = curPos;
        if (last == -1 && first != -1 && !chr.isDigit() && ((allowDot && chr != '.') || !allowDot))
            last = curPos - 1;
    }
    if (first >= 1 && allowSigned && value[first - 1] == '-')
        first -= 1;
    if (first != -1 && last == -1)
        last = value.length() - 1;
    return first != -1;
}
开发者ID:kendzi,项目名称:OsmAnd-core,代码行数:19,代码来源:Utilities.cpp


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