Lines Matching refs:iter
90 stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { in stringIteratorGetIndex() argument
95 return iter->start; in stringIteratorGetIndex()
97 return iter->index; in stringIteratorGetIndex()
99 return iter->limit; in stringIteratorGetIndex()
101 return iter->length; in stringIteratorGetIndex()
110 stringIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in stringIteratorMove() argument
118 pos=iter->start+delta; in stringIteratorMove()
121 pos=iter->index+delta; in stringIteratorMove()
124 pos=iter->limit+delta; in stringIteratorMove()
127 pos=iter->length+delta; in stringIteratorMove()
133 if(pos<iter->start) { in stringIteratorMove()
134 pos=iter->start; in stringIteratorMove()
135 } else if(pos>iter->limit) { in stringIteratorMove()
136 pos=iter->limit; in stringIteratorMove()
139 return iter->index=pos; in stringIteratorMove()
143 stringIteratorHasNext(UCharIterator *iter) { in stringIteratorHasNext() argument
144 return iter->index<iter->limit; in stringIteratorHasNext()
148 stringIteratorHasPrevious(UCharIterator *iter) { in stringIteratorHasPrevious() argument
149 return iter->index>iter->start; in stringIteratorHasPrevious()
153 stringIteratorCurrent(UCharIterator *iter) { in stringIteratorCurrent() argument
154 if(iter->index<iter->limit) { in stringIteratorCurrent()
155 return ((const UChar *)(iter->context))[iter->index]; in stringIteratorCurrent()
162 stringIteratorNext(UCharIterator *iter) { in stringIteratorNext() argument
163 if(iter->index<iter->limit) { in stringIteratorNext()
164 return ((const UChar *)(iter->context))[iter->index++]; in stringIteratorNext()
171 stringIteratorPrevious(UCharIterator *iter) { in stringIteratorPrevious() argument
172 if(iter->index>iter->start) { in stringIteratorPrevious()
173 return ((const UChar *)(iter->context))[--iter->index]; in stringIteratorPrevious()
180 stringIteratorGetState(const UCharIterator *iter) { in stringIteratorGetState() argument
181 return (uint32_t)iter->index; in stringIteratorGetState()
185 stringIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in stringIteratorSetState() argument
188 } else if(iter==NULL) { in stringIteratorSetState()
190 } else if((int32_t)state<iter->start || iter->limit<(int32_t)state) { in stringIteratorSetState()
193 iter->index=(int32_t)state; in stringIteratorSetState()
212 uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) { in uiter_setString() argument
213 if(iter!=0) { in uiter_setString()
215 *iter=stringIterator; in uiter_setString()
216 iter->context=s; in uiter_setString()
218 iter->length=length; in uiter_setString()
220 iter->length=u_strlen(s); in uiter_setString()
222 iter->limit=iter->length; in uiter_setString()
224 *iter=noopIterator; in uiter_setString()
243 utf16BEIteratorGet(UCharIterator *iter, int32_t index) { in utf16BEIteratorGet() argument
244 const uint8_t *p=(const uint8_t *)iter->context; in utf16BEIteratorGet()
249 utf16BEIteratorCurrent(UCharIterator *iter) { in utf16BEIteratorCurrent() argument
252 if((index=iter->index)<iter->limit) { in utf16BEIteratorCurrent()
253 return utf16BEIteratorGet(iter, index); in utf16BEIteratorCurrent()
260 utf16BEIteratorNext(UCharIterator *iter) { in utf16BEIteratorNext() argument
263 if((index=iter->index)<iter->limit) { in utf16BEIteratorNext()
264 iter->index=index+1; in utf16BEIteratorNext()
265 return utf16BEIteratorGet(iter, index); in utf16BEIteratorNext()
272 utf16BEIteratorPrevious(UCharIterator *iter) { in utf16BEIteratorPrevious() argument
275 if((index=iter->index)>iter->start) { in utf16BEIteratorPrevious()
276 iter->index=--index; in utf16BEIteratorPrevious()
277 return utf16BEIteratorGet(iter, index); in utf16BEIteratorPrevious()
323 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length) { in uiter_setUTF16BE() argument
324 if(iter!=NULL) { in uiter_setUTF16BE()
332 uiter_setString(iter, (const UChar *)s, length); in uiter_setUTF16BE()
336 *iter=utf16BEIterator; in uiter_setUTF16BE()
337 iter->context=s; in uiter_setUTF16BE()
339 iter->length=length; in uiter_setUTF16BE()
341 iter->length=utf16BE_strlen(s); in uiter_setUTF16BE()
343 iter->limit=iter->length; in uiter_setUTF16BE()
345 *iter=noopIterator; in uiter_setUTF16BE()
360 characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { in characterIteratorGetIndex() argument
365 return ((CharacterIterator *)(iter->context))->startIndex(); in characterIteratorGetIndex()
367 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorGetIndex()
369 return ((CharacterIterator *)(iter->context))->endIndex(); in characterIteratorGetIndex()
371 return ((CharacterIterator *)(iter->context))->getLength(); in characterIteratorGetIndex()
380 characterIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in characterIteratorMove() argument
383 ((CharacterIterator *)(iter->context))->setIndex(delta); in characterIteratorMove()
384 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorMove()
388 … return ((CharacterIterator *)(iter->context))->move(delta, (CharacterIterator::EOrigin)origin); in characterIteratorMove()
390 …((CharacterIterator *)(iter->context))->setIndex(((CharacterIterator *)(iter->context))->getLength… in characterIteratorMove()
391 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorMove()
400 characterIteratorHasNext(UCharIterator *iter) { in characterIteratorHasNext() argument
401 return ((CharacterIterator *)(iter->context))->hasNext(); in characterIteratorHasNext()
405 characterIteratorHasPrevious(UCharIterator *iter) { in characterIteratorHasPrevious() argument
406 return ((CharacterIterator *)(iter->context))->hasPrevious(); in characterIteratorHasPrevious()
410 characterIteratorCurrent(UCharIterator *iter) { in characterIteratorCurrent() argument
413 c=((CharacterIterator *)(iter->context))->current(); in characterIteratorCurrent()
414 if(c!=0xffff || ((CharacterIterator *)(iter->context))->hasNext()) { in characterIteratorCurrent()
422 characterIteratorNext(UCharIterator *iter) { in characterIteratorNext() argument
423 if(((CharacterIterator *)(iter->context))->hasNext()) { in characterIteratorNext()
424 return ((CharacterIterator *)(iter->context))->nextPostInc(); in characterIteratorNext()
431 characterIteratorPrevious(UCharIterator *iter) { in characterIteratorPrevious() argument
432 if(((CharacterIterator *)(iter->context))->hasPrevious()) { in characterIteratorPrevious()
433 return ((CharacterIterator *)(iter->context))->previous(); in characterIteratorPrevious()
440 characterIteratorGetState(const UCharIterator *iter) { in characterIteratorGetState() argument
441 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorGetState()
445 characterIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in characterIteratorSetState() argument
448 } else if(iter==NULL || iter->context==NULL) { in characterIteratorSetState()
450 …else if((int32_t)state<((CharacterIterator *)(iter->context))->startIndex() || ((CharacterIterator… in characterIteratorSetState()
453 ((CharacterIterator *)(iter->context))->setIndex((int32_t)state); in characterIteratorSetState()
472 uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter) { in uiter_setCharacterIterator() argument
473 if(iter!=0) { in uiter_setCharacterIterator()
475 *iter=characterIteratorWrapper; in uiter_setCharacterIterator()
476 iter->context=charIter; in uiter_setCharacterIterator()
478 *iter=noopIterator; in uiter_setCharacterIterator()
495 replaceableIteratorCurrent(UCharIterator *iter) { in replaceableIteratorCurrent() argument
496 if(iter->index<iter->limit) { in replaceableIteratorCurrent()
497 return ((Replaceable *)(iter->context))->charAt(iter->index); in replaceableIteratorCurrent()
504 replaceableIteratorNext(UCharIterator *iter) { in replaceableIteratorNext() argument
505 if(iter->index<iter->limit) { in replaceableIteratorNext()
506 return ((Replaceable *)(iter->context))->charAt(iter->index++); in replaceableIteratorNext()
513 replaceableIteratorPrevious(UCharIterator *iter) { in replaceableIteratorPrevious() argument
514 if(iter->index>iter->start) { in replaceableIteratorPrevious()
515 return ((Replaceable *)(iter->context))->charAt(--iter->index); in replaceableIteratorPrevious()
536 uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) { in uiter_setReplaceable() argument
537 if(iter!=0) { in uiter_setReplaceable()
539 *iter=replaceableIterator; in uiter_setReplaceable()
540 iter->context=rep; in uiter_setReplaceable()
541 iter->limit=iter->length=rep->length(); in uiter_setReplaceable()
543 *iter=noopIterator; in uiter_setReplaceable()
587 utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { in utf8IteratorGetIndex() argument
593 if(iter->index<0) { in utf8IteratorGetIndex()
599 s=(const uint8_t *)iter->context; in utf8IteratorGetIndex()
601 limit=iter->start; /* count up to the UTF-8 index */ in utf8IteratorGetIndex()
607 iter->start=i; /* just in case setState() did not get us to a code point boundary */ in utf8IteratorGetIndex()
608 if(i==iter->limit) { in utf8IteratorGetIndex()
609 iter->length=index; /* in case it was <0 or wrong */ in utf8IteratorGetIndex()
611 if(iter->reservedField!=0) { in utf8IteratorGetIndex()
614 iter->index=index; in utf8IteratorGetIndex()
616 return iter->index; in utf8IteratorGetIndex()
619 if(iter->length<0) { in utf8IteratorGetIndex()
624 s=(const uint8_t *)iter->context; in utf8IteratorGetIndex()
625 if(iter->index<0) { in utf8IteratorGetIndex()
631 limit=iter->start; in utf8IteratorGetIndex()
640 iter->start=i; /* just in case setState() did not get us to a code point boundary */ in utf8IteratorGetIndex()
641 iter->index= iter->reservedField!=0 ? length-1 : length; in utf8IteratorGetIndex()
643 i=iter->start; in utf8IteratorGetIndex()
644 length=iter->index; in utf8IteratorGetIndex()
645 if(iter->reservedField!=0) { in utf8IteratorGetIndex()
651 limit=iter->limit; in utf8IteratorGetIndex()
656 iter->length=length; in utf8IteratorGetIndex()
658 return iter->length; in utf8IteratorGetIndex()
667 utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in utf8IteratorMove() argument
683 if(iter->index>=0) { in utf8IteratorMove()
684 pos=iter->index+delta; in utf8IteratorMove()
694 if(iter->length>=0) { in utf8IteratorMove()
695 pos=iter->length+delta; in utf8IteratorMove()
699 iter->index=-1; in utf8IteratorMove()
700 iter->start=iter->limit; in utf8IteratorMove()
701 iter->reservedField=0; in utf8IteratorMove()
718 iter->index=iter->start=iter->reservedField=0; in utf8IteratorMove()
720 } else if(iter->length>=0 && pos>=iter->length) { in utf8IteratorMove()
721 iter->index=iter->length; in utf8IteratorMove()
722 iter->start=iter->limit; in utf8IteratorMove()
723 iter->reservedField=0; in utf8IteratorMove()
724 return iter->index; in utf8IteratorMove()
728 if(iter->index<0 || pos<iter->index/2) { in utf8IteratorMove()
730 iter->index=iter->start=iter->reservedField=0; in utf8IteratorMove()
731 } else if(iter->length>=0 && (iter->length-pos)<(pos-iter->index)) { in utf8IteratorMove()
737 iter->index=iter->length; in utf8IteratorMove()
738 iter->start=iter->limit; in utf8IteratorMove()
739 iter->reservedField=0; in utf8IteratorMove()
742 delta=pos-iter->index; in utf8IteratorMove()
744 return iter->index; /* nothing to do */ in utf8IteratorMove()
750 } else if(-delta>=iter->start) { in utf8IteratorMove()
752 iter->index=iter->start=iter->reservedField=0; in utf8IteratorMove()
754 } else if(delta>=(iter->limit-iter->start)) { in utf8IteratorMove()
756 iter->index=iter->length; /* may or may not be <0 (unknown) */ in utf8IteratorMove()
757 iter->start=iter->limit; in utf8IteratorMove()
758 iter->reservedField=0; in utf8IteratorMove()
759 return iter->index>=0 ? iter->index : (int32_t)UITER_UNKNOWN_INDEX; in utf8IteratorMove()
766 s=(const uint8_t *)iter->context; in utf8IteratorMove()
767 pos=iter->index; /* could be <0 (unknown) */ in utf8IteratorMove()
768 i=iter->start; in utf8IteratorMove()
771 int32_t limit=iter->limit; in utf8IteratorMove()
772 if(iter->reservedField!=0) { in utf8IteratorMove()
773 iter->reservedField=0; in utf8IteratorMove()
787 iter->reservedField=c; in utf8IteratorMove()
793 if(iter->length<0 && iter->index>=0) { in utf8IteratorMove()
794 iter->length= iter->reservedField==0 ? pos : pos+1; in utf8IteratorMove()
795 } else if(iter->index<0 && iter->length>=0) { in utf8IteratorMove()
796 iter->index= iter->reservedField==0 ? iter->length : iter->length-1; in utf8IteratorMove()
801 if(iter->reservedField!=0) { in utf8IteratorMove()
802 iter->reservedField=0; in utf8IteratorMove()
818 iter->reservedField=c; in utf8IteratorMove()
825 iter->start=i; in utf8IteratorMove()
826 if(iter->index>=0) { in utf8IteratorMove()
827 return iter->index=pos; in utf8IteratorMove()
831 return iter->index=i; /* reached the beginning */ in utf8IteratorMove()
840 utf8IteratorHasNext(UCharIterator *iter) { in utf8IteratorHasNext() argument
841 return iter->start<iter->limit || iter->reservedField!=0; in utf8IteratorHasNext()
845 utf8IteratorHasPrevious(UCharIterator *iter) { in utf8IteratorHasPrevious() argument
846 return iter->start>0; in utf8IteratorHasPrevious()
850 utf8IteratorCurrent(UCharIterator *iter) { in utf8IteratorCurrent() argument
851 if(iter->reservedField!=0) { in utf8IteratorCurrent()
852 return U16_TRAIL(iter->reservedField); in utf8IteratorCurrent()
853 } else if(iter->start<iter->limit) { in utf8IteratorCurrent()
854 const uint8_t *s=(const uint8_t *)iter->context; in utf8IteratorCurrent()
856 int32_t i=iter->start; in utf8IteratorCurrent()
858 U8_NEXT_OR_FFFD(s, i, iter->limit, c); in utf8IteratorCurrent()
870 utf8IteratorNext(UCharIterator *iter) { in utf8IteratorNext() argument
873 if(iter->reservedField!=0) { in utf8IteratorNext()
874 UChar trail=U16_TRAIL(iter->reservedField); in utf8IteratorNext()
875 iter->reservedField=0; in utf8IteratorNext()
876 if((index=iter->index)>=0) { in utf8IteratorNext()
877 iter->index=index+1; in utf8IteratorNext()
880 } else if(iter->start<iter->limit) { in utf8IteratorNext()
881 const uint8_t *s=(const uint8_t *)iter->context; in utf8IteratorNext()
884 U8_NEXT_OR_FFFD(s, iter->start, iter->limit, c); in utf8IteratorNext()
885 if((index=iter->index)>=0) { in utf8IteratorNext()
886 iter->index=++index; in utf8IteratorNext()
887 if(iter->length<0 && iter->start==iter->limit) { in utf8IteratorNext()
888 iter->length= c<=0xffff ? index : index+1; in utf8IteratorNext()
890 } else if(iter->start==iter->limit && iter->length>=0) { in utf8IteratorNext()
891 iter->index= c<=0xffff ? iter->length : iter->length-1; in utf8IteratorNext()
896 iter->reservedField=c; in utf8IteratorNext()
905 utf8IteratorPrevious(UCharIterator *iter) { in utf8IteratorPrevious() argument
908 if(iter->reservedField!=0) { in utf8IteratorPrevious()
909 UChar lead=U16_LEAD(iter->reservedField); in utf8IteratorPrevious()
910 iter->reservedField=0; in utf8IteratorPrevious()
911 iter->start-=4; /* we stayed behind the supplementary code point; go before it now */ in utf8IteratorPrevious()
912 if((index=iter->index)>0) { in utf8IteratorPrevious()
913 iter->index=index-1; in utf8IteratorPrevious()
916 } else if(iter->start>0) { in utf8IteratorPrevious()
917 const uint8_t *s=(const uint8_t *)iter->context; in utf8IteratorPrevious()
920 U8_PREV_OR_FFFD(s, 0, iter->start, c); in utf8IteratorPrevious()
921 if((index=iter->index)>0) { in utf8IteratorPrevious()
922 iter->index=index-1; in utf8IteratorPrevious()
923 } else if(iter->start<=1) { in utf8IteratorPrevious()
924 iter->index= c<=0xffff ? iter->start : iter->start+1; in utf8IteratorPrevious()
929 iter->start+=4; /* back to behind this supplementary code point for consistent state */ in utf8IteratorPrevious()
930 iter->reservedField=c; in utf8IteratorPrevious()
939 utf8IteratorGetState(const UCharIterator *iter) { in utf8IteratorGetState() argument
940 uint32_t state=(uint32_t)(iter->start<<1); in utf8IteratorGetState()
941 if(iter->reservedField!=0) { in utf8IteratorGetState()
948 utf8IteratorSetState(UCharIterator *iter, in utf8IteratorSetState() argument
954 } else if(iter==NULL) { in utf8IteratorSetState()
956 } else if(state==utf8IteratorGetState(iter)) { in utf8IteratorSetState()
962 if((state==0 ? index<0 : index<4) || iter->limit<index) { in utf8IteratorSetState()
965 iter->start=index; /* restore UTF-8 byte index */ in utf8IteratorSetState()
967 iter->index=index; in utf8IteratorSetState()
969 iter->index=-1; /* unknown UTF-16 index */ in utf8IteratorSetState()
972 iter->reservedField=0; in utf8IteratorSetState()
976 U8_PREV_OR_FFFD((const uint8_t *)iter->context, 0, index, c); in utf8IteratorSetState()
980 iter->reservedField=c; in utf8IteratorSetState()
1002 uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length) { in uiter_setUTF8() argument
1003 if(iter!=0) { in uiter_setUTF8()
1005 *iter=utf8Iterator; in uiter_setUTF8()
1006 iter->context=s; in uiter_setUTF8()
1008 iter->limit=length; in uiter_setUTF8()
1010 iter->limit=(int32_t)uprv_strlen(s); in uiter_setUTF8()
1012 iter->length= iter->limit<=1 ? iter->limit : -1; in uiter_setUTF8()
1014 *iter=noopIterator; in uiter_setUTF8()
1022 uiter_current32(UCharIterator *iter) { in uiter_current32() argument
1025 c=iter->current(iter); in uiter_current32()
1032 iter->move(iter, 1, UITER_CURRENT); in uiter_current32()
1033 if(U16_IS_TRAIL(c2=iter->current(iter))) { in uiter_current32()
1038 iter->move(iter, -1, UITER_CURRENT); in uiter_current32()
1040 if(U16_IS_LEAD(c2=iter->previous(iter))) { in uiter_current32()
1045 iter->move(iter, 1, UITER_CURRENT); in uiter_current32()
1053 uiter_next32(UCharIterator *iter) { in uiter_next32() argument
1056 c=iter->next(iter); in uiter_next32()
1058 if(U16_IS_TRAIL(c2=iter->next(iter))) { in uiter_next32()
1062 iter->move(iter, -1, UITER_CURRENT); in uiter_next32()
1069 uiter_previous32(UCharIterator *iter) { in uiter_previous32() argument
1072 c=iter->previous(iter); in uiter_previous32()
1074 if(U16_IS_LEAD(c2=iter->previous(iter))) { in uiter_previous32()
1078 iter->move(iter, 1, UITER_CURRENT); in uiter_previous32()
1085 uiter_getState(const UCharIterator *iter) { in uiter_getState() argument
1086 if(iter==NULL || iter->getState==NULL) { in uiter_getState()
1089 return iter->getState(iter); in uiter_getState()
1094 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in uiter_setState() argument
1097 } else if(iter==NULL) { in uiter_setState()
1099 } else if(iter->setState==NULL) { in uiter_setState()
1102 iter->setState(iter, state, pErrorCode); in uiter_setState()