]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/uchriter.cpp
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / common / uchriter.cpp
index f2878815e4f003fc168ebbe5e98bb3885e870186..2d59e167a1df3d69f27e43961d3c64b063cf0326 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ******************************************************************************
-* Copyright (C) 1998-2010, International Business Machines Corporation and
+* Copyright (C) 1998-2011, International Business Machines Corporation and
 * others. All Rights Reserved.
 ******************************************************************************
 */
@@ -9,7 +9,8 @@
 
 #include "unicode/uchriter.h"
 #include "unicode/ustring.h"
-#include "uhash.h"
+#include "unicode/utf16.h"
+#include "ustr_imp.h"
 
 U_NAMESPACE_BEGIN
 
@@ -83,7 +84,7 @@ UCharCharacterIterator::operator==(const ForwardCharacterIterator& that) const {
 
 int32_t
 UCharCharacterIterator::hashCode() const {
-    return uhash_hashUCharsN(text, textLength) ^ pos ^ begin ^ end;
+    return ustr_hashUCharsN(text, textLength) ^ pos ^ begin ^ end;
 }
 
 CharacterIterator*
@@ -191,7 +192,7 @@ UCharCharacterIterator::first32() {
     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;
@@ -203,7 +204,7 @@ UCharCharacterIterator::first32PostInc() {
     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;
@@ -215,7 +216,7 @@ UCharCharacterIterator::last32() {
     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;
@@ -230,10 +231,10 @@ UCharCharacterIterator::setIndex32(int32_t position) {
         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;
@@ -245,7 +246,7 @@ UChar32
 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;
@@ -255,11 +256,11 @@ UCharCharacterIterator::current32() const {
 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;
         }
     }
@@ -272,7 +273,7 @@ UChar32
 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;
@@ -283,7 +284,7 @@ UChar32
 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;
@@ -323,20 +324,20 @@ UCharCharacterIterator::move32(int32_t delta, CharacterIterator::EOrigin origin)
     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: