/*
******************************************************************************
-* Copyright (C) 1998-2010, International Business Machines Corporation and
+* Copyright (C) 1998-2011, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
#include "unicode/uchriter.h"
#include "unicode/ustring.h"
-#include "uhash.h"
+#include "unicode/utf16.h"
+#include "ustr_imp.h"
U_NAMESPACE_BEGIN
int32_t
UCharCharacterIterator::hashCode() const {
- return uhash_hashUCharsN(text, textLength) ^ pos ^ begin ^ end;
+ return ustr_hashUCharsN(text, textLength) ^ pos ^ begin ^ end;
}
CharacterIterator*
if(pos < end) {
int32_t i = pos;
UChar32 c;
- UTF_NEXT_CHAR(text, i, end, c);
+ U16_NEXT(text, i, end, c);
return c;
} else {
return DONE;
pos = begin;
if(pos < end) {
UChar32 c;
- UTF_NEXT_CHAR(text, pos, end, c);
+ U16_NEXT(text, pos, end, c);
return c;
} else {
return DONE;
pos = end;
if(pos > begin) {
UChar32 c;
- UTF_PREV_CHAR(text, begin, pos, c);
+ U16_PREV(text, begin, pos, c);
return c;
} else {
return DONE;
position = end;
}
if(position < end) {
- UTF_SET_CHAR_START(text, begin, position);
+ U16_SET_CP_START(text, begin, position);
int32_t i = this->pos = position;
UChar32 c;
- UTF_NEXT_CHAR(text, i, end, c);
+ U16_NEXT(text, i, end, c);
return c;
} else {
this->pos = position;
UCharCharacterIterator::current32() const {
if (pos >= begin && pos < end) {
UChar32 c;
- UTF_GET_CHAR(text, begin, pos, end, c);
+ U16_GET(text, begin, pos, end, c);
return c;
} else {
return DONE;
UChar32
UCharCharacterIterator::next32() {
if (pos < end) {
- UTF_FWD_1(text, pos, end);
+ U16_FWD_1(text, pos, end);
if(pos < end) {
int32_t i = pos;
UChar32 c;
- UTF_NEXT_CHAR(text, i, end, c);
+ U16_NEXT(text, i, end, c);
return c;
}
}
UCharCharacterIterator::next32PostInc() {
if (pos < end) {
UChar32 c;
- UTF_NEXT_CHAR(text, pos, end, c);
+ U16_NEXT(text, pos, end, c);
return c;
} else {
return DONE;
UCharCharacterIterator::previous32() {
if (pos > begin) {
UChar32 c;
- UTF_PREV_CHAR(text, begin, pos, c);
+ U16_PREV(text, begin, pos, c);
return c;
} else {
return DONE;
case kStart:
pos = begin;
if(delta > 0) {
- UTF_FWD_N(text, pos, end, delta);
+ U16_FWD_N(text, pos, end, delta);
}
break;
case kCurrent:
if(delta > 0) {
- UTF_FWD_N(text, pos, end, delta);
+ U16_FWD_N(text, pos, end, delta);
} else {
- UTF_BACK_N(text, begin, pos, -delta);
+ U16_BACK_N(text, begin, pos, -delta);
}
break;
case kEnd:
pos = end;
if(delta < 0) {
- UTF_BACK_N(text, begin, pos, -delta);
+ U16_BACK_N(text, begin, pos, -delta);
}
break;
default: