本文整理汇总了C++中CharacterIterator::current方法的典型用法代码示例。如果您正苦于以下问题:C++ CharacterIterator::current方法的具体用法?C++ CharacterIterator::current怎么用?C++ CharacterIterator::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharacterIterator
的用法示例。
在下文中一共展示了CharacterIterator::current方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestUCharIterator
void CharIterTest::TestUCharIterator(UCharIterator *iter, CharacterIterator &ci,
const char *moves, const char *which) {
int32_t m;
UChar32 c, c2;
UBool h, h2;
for(m=0;; ++m) {
// move both iter and s[index]
switch(moves[m]) {
case '0':
h=iter->hasNext(iter);
h2=ci.hasNext();
c=iter->current(iter);
c2=ci.current();
break;
case '|':
h=iter->hasNext(iter);
h2=ci.hasNext();
c=uiter_current32(iter);
c2=ci.current32();
break;
case '+':
h=iter->hasNext(iter);
h2=ci.hasNext();
c=iter->next(iter);
c2=ci.nextPostInc();
break;
case '>':
h=iter->hasNext(iter);
h2=ci.hasNext();
c=uiter_next32(iter);
c2=ci.next32PostInc();
break;
case '-':
h=iter->hasPrevious(iter);
h2=ci.hasPrevious();
c=iter->previous(iter);
c2=ci.previous();
break;
case '<':
h=iter->hasPrevious(iter);
h2=ci.hasPrevious();
c=uiter_previous32(iter);
c2=ci.previous32();
break;
case '2':
h=h2=FALSE;
c=(UChar32)iter->move(iter, 2, UITER_CURRENT);
c2=(UChar32)ci.move(2, CharacterIterator::kCurrent);
break;
case '8':
h=h2=FALSE;
c=(UChar32)iter->move(iter, -2, UITER_CURRENT);
c2=(UChar32)ci.move(-2, CharacterIterator::kCurrent);
break;
case 0:
return;
default:
errln("error: unexpected move character '%c' in \"%s\"", moves[m], moves);
return;
}
// compare results
if(c2==0xffff) {
c2=(UChar32)-1;
}
if(c!=c2 || h!=h2 || ci.getIndex()!=iter->getIndex(iter, UITER_CURRENT)) {
errln("error: UCharIterator(%s) misbehaving at \"%s\"[%d]='%c'", which, moves, m, moves[m]);
}
}
}