• Home
  • Raw
  • Download

Lines Matching refs:iter

92 stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {  in stringIteratorGetIndex()  argument
97 return iter->start; in stringIteratorGetIndex()
99 return iter->index; in stringIteratorGetIndex()
101 return iter->limit; in stringIteratorGetIndex()
103 return iter->length; in stringIteratorGetIndex()
112 stringIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in stringIteratorMove() argument
120 pos=iter->start+delta; in stringIteratorMove()
123 pos=iter->index+delta; in stringIteratorMove()
126 pos=iter->limit+delta; in stringIteratorMove()
129 pos=iter->length+delta; in stringIteratorMove()
135 if(pos<iter->start) { in stringIteratorMove()
136 pos=iter->start; in stringIteratorMove()
137 } else if(pos>iter->limit) { in stringIteratorMove()
138 pos=iter->limit; in stringIteratorMove()
141 return iter->index=pos; in stringIteratorMove()
145 stringIteratorHasNext(UCharIterator *iter) { in stringIteratorHasNext() argument
146 return iter->index<iter->limit; in stringIteratorHasNext()
150 stringIteratorHasPrevious(UCharIterator *iter) { in stringIteratorHasPrevious() argument
151 return iter->index>iter->start; in stringIteratorHasPrevious()
155 stringIteratorCurrent(UCharIterator *iter) { in stringIteratorCurrent() argument
156 if(iter->index<iter->limit) { in stringIteratorCurrent()
157 return ((const UChar *)(iter->context))[iter->index]; in stringIteratorCurrent()
164 stringIteratorNext(UCharIterator *iter) { in stringIteratorNext() argument
165 if(iter->index<iter->limit) { in stringIteratorNext()
166 return ((const UChar *)(iter->context))[iter->index++]; in stringIteratorNext()
173 stringIteratorPrevious(UCharIterator *iter) { in stringIteratorPrevious() argument
174 if(iter->index>iter->start) { in stringIteratorPrevious()
175 return ((const UChar *)(iter->context))[--iter->index]; in stringIteratorPrevious()
182 stringIteratorGetState(const UCharIterator *iter) { in stringIteratorGetState() argument
183 return (uint32_t)iter->index; in stringIteratorGetState()
187 stringIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in stringIteratorSetState() argument
190 } else if(iter==NULL) { in stringIteratorSetState()
192 } else if((int32_t)state<iter->start || iter->limit<(int32_t)state) { in stringIteratorSetState()
195 iter->index=(int32_t)state; in stringIteratorSetState()
214 uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) { in uiter_setString() argument
215 if(iter!=0) { in uiter_setString()
217 *iter=stringIterator; in uiter_setString()
218 iter->context=s; in uiter_setString()
220 iter->length=length; in uiter_setString()
222 iter->length=u_strlen(s); in uiter_setString()
224 iter->limit=iter->length; in uiter_setString()
226 *iter=noopIterator; in uiter_setString()
245 utf16BEIteratorGet(UCharIterator *iter, int32_t index) { in utf16BEIteratorGet() argument
246 const uint8_t *p=(const uint8_t *)iter->context; in utf16BEIteratorGet()
251 utf16BEIteratorCurrent(UCharIterator *iter) { in utf16BEIteratorCurrent() argument
254 if((index=iter->index)<iter->limit) { in utf16BEIteratorCurrent()
255 return utf16BEIteratorGet(iter, index); in utf16BEIteratorCurrent()
262 utf16BEIteratorNext(UCharIterator *iter) { in utf16BEIteratorNext() argument
265 if((index=iter->index)<iter->limit) { in utf16BEIteratorNext()
266 iter->index=index+1; in utf16BEIteratorNext()
267 return utf16BEIteratorGet(iter, index); in utf16BEIteratorNext()
274 utf16BEIteratorPrevious(UCharIterator *iter) { in utf16BEIteratorPrevious() argument
277 if((index=iter->index)>iter->start) { in utf16BEIteratorPrevious()
278 iter->index=--index; in utf16BEIteratorPrevious()
279 return utf16BEIteratorGet(iter, index); in utf16BEIteratorPrevious()
325 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length) { in uiter_setUTF16BE() argument
326 if(iter!=NULL) { in uiter_setUTF16BE()
334 uiter_setString(iter, (const UChar *)s, length); in uiter_setUTF16BE()
338 *iter=utf16BEIterator; in uiter_setUTF16BE()
339 iter->context=s; in uiter_setUTF16BE()
341 iter->length=length; in uiter_setUTF16BE()
343 iter->length=utf16BE_strlen(s); in uiter_setUTF16BE()
345 iter->limit=iter->length; in uiter_setUTF16BE()
347 *iter=noopIterator; in uiter_setUTF16BE()
362 characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { in characterIteratorGetIndex() argument
367 return ((CharacterIterator *)(iter->context))->startIndex(); in characterIteratorGetIndex()
369 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorGetIndex()
371 return ((CharacterIterator *)(iter->context))->endIndex(); in characterIteratorGetIndex()
373 return ((CharacterIterator *)(iter->context))->getLength(); in characterIteratorGetIndex()
382 characterIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in characterIteratorMove() argument
385 ((CharacterIterator *)(iter->context))->setIndex(delta); in characterIteratorMove()
386 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorMove()
390 … return ((CharacterIterator *)(iter->context))->move(delta, (CharacterIterator::EOrigin)origin); in characterIteratorMove()
392 …((CharacterIterator *)(iter->context))->setIndex(((CharacterIterator *)(iter->context))->getLength… in characterIteratorMove()
393 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorMove()
402 characterIteratorHasNext(UCharIterator *iter) { in characterIteratorHasNext() argument
403 return ((CharacterIterator *)(iter->context))->hasNext(); in characterIteratorHasNext()
407 characterIteratorHasPrevious(UCharIterator *iter) { in characterIteratorHasPrevious() argument
408 return ((CharacterIterator *)(iter->context))->hasPrevious(); in characterIteratorHasPrevious()
412 characterIteratorCurrent(UCharIterator *iter) { in characterIteratorCurrent() argument
415 c=((CharacterIterator *)(iter->context))->current(); in characterIteratorCurrent()
416 if(c!=0xffff || ((CharacterIterator *)(iter->context))->hasNext()) { in characterIteratorCurrent()
424 characterIteratorNext(UCharIterator *iter) { in characterIteratorNext() argument
425 if(((CharacterIterator *)(iter->context))->hasNext()) { in characterIteratorNext()
426 return ((CharacterIterator *)(iter->context))->nextPostInc(); in characterIteratorNext()
433 characterIteratorPrevious(UCharIterator *iter) { in characterIteratorPrevious() argument
434 if(((CharacterIterator *)(iter->context))->hasPrevious()) { in characterIteratorPrevious()
435 return ((CharacterIterator *)(iter->context))->previous(); in characterIteratorPrevious()
442 characterIteratorGetState(const UCharIterator *iter) { in characterIteratorGetState() argument
443 return ((CharacterIterator *)(iter->context))->getIndex(); in characterIteratorGetState()
447 characterIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in characterIteratorSetState() argument
450 } else if(iter==NULL || iter->context==NULL) { in characterIteratorSetState()
452 …else if((int32_t)state<((CharacterIterator *)(iter->context))->startIndex() || ((CharacterIterator… in characterIteratorSetState()
455 ((CharacterIterator *)(iter->context))->setIndex((int32_t)state); in characterIteratorSetState()
474 uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter) { in uiter_setCharacterIterator() argument
475 if(iter!=0) { in uiter_setCharacterIterator()
477 *iter=characterIteratorWrapper; in uiter_setCharacterIterator()
478 iter->context=charIter; in uiter_setCharacterIterator()
480 *iter=noopIterator; in uiter_setCharacterIterator()
497 replaceableIteratorCurrent(UCharIterator *iter) { in replaceableIteratorCurrent() argument
498 if(iter->index<iter->limit) { in replaceableIteratorCurrent()
499 return ((Replaceable *)(iter->context))->charAt(iter->index); in replaceableIteratorCurrent()
506 replaceableIteratorNext(UCharIterator *iter) { in replaceableIteratorNext() argument
507 if(iter->index<iter->limit) { in replaceableIteratorNext()
508 return ((Replaceable *)(iter->context))->charAt(iter->index++); in replaceableIteratorNext()
515 replaceableIteratorPrevious(UCharIterator *iter) { in replaceableIteratorPrevious() argument
516 if(iter->index>iter->start) { in replaceableIteratorPrevious()
517 return ((Replaceable *)(iter->context))->charAt(--iter->index); in replaceableIteratorPrevious()
538 uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) { in uiter_setReplaceable() argument
539 if(iter!=0) { in uiter_setReplaceable()
541 *iter=replaceableIterator; in uiter_setReplaceable()
542 iter->context=rep; in uiter_setReplaceable()
543 iter->limit=iter->length=rep->length(); in uiter_setReplaceable()
545 *iter=noopIterator; in uiter_setReplaceable()
589 utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { in utf8IteratorGetIndex() argument
595 if(iter->index<0) { in utf8IteratorGetIndex()
601 s=(const uint8_t *)iter->context; in utf8IteratorGetIndex()
603 limit=iter->start; /* count up to the UTF-8 index */ in utf8IteratorGetIndex()
609 iter->start=i; /* just in case setState() did not get us to a code point boundary */ in utf8IteratorGetIndex()
610 if(i==iter->limit) { in utf8IteratorGetIndex()
611 iter->length=index; /* in case it was <0 or wrong */ in utf8IteratorGetIndex()
613 if(iter->reservedField!=0) { in utf8IteratorGetIndex()
616 iter->index=index; in utf8IteratorGetIndex()
618 return iter->index; in utf8IteratorGetIndex()
621 if(iter->length<0) { in utf8IteratorGetIndex()
626 s=(const uint8_t *)iter->context; in utf8IteratorGetIndex()
627 if(iter->index<0) { in utf8IteratorGetIndex()
633 limit=iter->start; in utf8IteratorGetIndex()
642 iter->start=i; /* just in case setState() did not get us to a code point boundary */ in utf8IteratorGetIndex()
643 iter->index= iter->reservedField!=0 ? length-1 : length; in utf8IteratorGetIndex()
645 i=iter->start; in utf8IteratorGetIndex()
646 length=iter->index; in utf8IteratorGetIndex()
647 if(iter->reservedField!=0) { in utf8IteratorGetIndex()
653 limit=iter->limit; in utf8IteratorGetIndex()
658 iter->length=length; in utf8IteratorGetIndex()
660 return iter->length; in utf8IteratorGetIndex()
669 utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { in utf8IteratorMove() argument
685 if(iter->index>=0) { in utf8IteratorMove()
686 pos=iter->index+delta; in utf8IteratorMove()
696 if(iter->length>=0) { in utf8IteratorMove()
697 pos=iter->length+delta; in utf8IteratorMove()
701 iter->index=-1; in utf8IteratorMove()
702 iter->start=iter->limit; in utf8IteratorMove()
703 iter->reservedField=0; in utf8IteratorMove()
720 iter->index=iter->start=iter->reservedField=0; in utf8IteratorMove()
722 } else if(iter->length>=0 && pos>=iter->length) { in utf8IteratorMove()
723 iter->index=iter->length; in utf8IteratorMove()
724 iter->start=iter->limit; in utf8IteratorMove()
725 iter->reservedField=0; in utf8IteratorMove()
726 return iter->index; in utf8IteratorMove()
730 if(iter->index<0 || pos<iter->index/2) { in utf8IteratorMove()
732 iter->index=iter->start=iter->reservedField=0; in utf8IteratorMove()
733 } else if(iter->length>=0 && (iter->length-pos)<(pos-iter->index)) { in utf8IteratorMove()
739 iter->index=iter->length; in utf8IteratorMove()
740 iter->start=iter->limit; in utf8IteratorMove()
741 iter->reservedField=0; in utf8IteratorMove()
744 delta=pos-iter->index; in utf8IteratorMove()
746 return iter->index; /* nothing to do */ in utf8IteratorMove()
752 } else if(-delta>=iter->start) { in utf8IteratorMove()
754 iter->index=iter->start=iter->reservedField=0; in utf8IteratorMove()
756 } else if(delta>=(iter->limit-iter->start)) { in utf8IteratorMove()
758 iter->index=iter->length; /* may or may not be <0 (unknown) */ in utf8IteratorMove()
759 iter->start=iter->limit; in utf8IteratorMove()
760 iter->reservedField=0; in utf8IteratorMove()
761 return iter->index>=0 ? iter->index : (int32_t)UITER_UNKNOWN_INDEX; in utf8IteratorMove()
768 s=(const uint8_t *)iter->context; in utf8IteratorMove()
769 pos=iter->index; /* could be <0 (unknown) */ in utf8IteratorMove()
770 i=iter->start; in utf8IteratorMove()
773 int32_t limit=iter->limit; in utf8IteratorMove()
774 if(iter->reservedField!=0) { in utf8IteratorMove()
775 iter->reservedField=0; in utf8IteratorMove()
789 iter->reservedField=c; in utf8IteratorMove()
795 if(iter->length<0 && iter->index>=0) { in utf8IteratorMove()
796 iter->length= iter->reservedField==0 ? pos : pos+1; in utf8IteratorMove()
797 } else if(iter->index<0 && iter->length>=0) { in utf8IteratorMove()
798 iter->index= iter->reservedField==0 ? iter->length : iter->length-1; in utf8IteratorMove()
803 if(iter->reservedField!=0) { in utf8IteratorMove()
804 iter->reservedField=0; in utf8IteratorMove()
820 iter->reservedField=c; in utf8IteratorMove()
827 iter->start=i; in utf8IteratorMove()
828 if(iter->index>=0) { in utf8IteratorMove()
829 return iter->index=pos; in utf8IteratorMove()
833 return iter->index=i; /* reached the beginning */ in utf8IteratorMove()
842 utf8IteratorHasNext(UCharIterator *iter) { in utf8IteratorHasNext() argument
843 return iter->start<iter->limit || iter->reservedField!=0; in utf8IteratorHasNext()
847 utf8IteratorHasPrevious(UCharIterator *iter) { in utf8IteratorHasPrevious() argument
848 return iter->start>0; in utf8IteratorHasPrevious()
852 utf8IteratorCurrent(UCharIterator *iter) { in utf8IteratorCurrent() argument
853 if(iter->reservedField!=0) { in utf8IteratorCurrent()
854 return U16_TRAIL(iter->reservedField); in utf8IteratorCurrent()
855 } else if(iter->start<iter->limit) { in utf8IteratorCurrent()
856 const uint8_t *s=(const uint8_t *)iter->context; in utf8IteratorCurrent()
858 int32_t i=iter->start; in utf8IteratorCurrent()
860 U8_NEXT_OR_FFFD(s, i, iter->limit, c); in utf8IteratorCurrent()
872 utf8IteratorNext(UCharIterator *iter) { in utf8IteratorNext() argument
875 if(iter->reservedField!=0) { in utf8IteratorNext()
876 UChar trail=U16_TRAIL(iter->reservedField); in utf8IteratorNext()
877 iter->reservedField=0; in utf8IteratorNext()
878 if((index=iter->index)>=0) { in utf8IteratorNext()
879 iter->index=index+1; in utf8IteratorNext()
882 } else if(iter->start<iter->limit) { in utf8IteratorNext()
883 const uint8_t *s=(const uint8_t *)iter->context; in utf8IteratorNext()
886 U8_NEXT_OR_FFFD(s, iter->start, iter->limit, c); in utf8IteratorNext()
887 if((index=iter->index)>=0) { in utf8IteratorNext()
888 iter->index=++index; in utf8IteratorNext()
889 if(iter->length<0 && iter->start==iter->limit) { in utf8IteratorNext()
890 iter->length= c<=0xffff ? index : index+1; in utf8IteratorNext()
892 } else if(iter->start==iter->limit && iter->length>=0) { in utf8IteratorNext()
893 iter->index= c<=0xffff ? iter->length : iter->length-1; in utf8IteratorNext()
898 iter->reservedField=c; in utf8IteratorNext()
907 utf8IteratorPrevious(UCharIterator *iter) { in utf8IteratorPrevious() argument
910 if(iter->reservedField!=0) { in utf8IteratorPrevious()
911 UChar lead=U16_LEAD(iter->reservedField); in utf8IteratorPrevious()
912 iter->reservedField=0; in utf8IteratorPrevious()
913 iter->start-=4; /* we stayed behind the supplementary code point; go before it now */ in utf8IteratorPrevious()
914 if((index=iter->index)>0) { in utf8IteratorPrevious()
915 iter->index=index-1; in utf8IteratorPrevious()
918 } else if(iter->start>0) { in utf8IteratorPrevious()
919 const uint8_t *s=(const uint8_t *)iter->context; in utf8IteratorPrevious()
922 U8_PREV_OR_FFFD(s, 0, iter->start, c); in utf8IteratorPrevious()
923 if((index=iter->index)>0) { in utf8IteratorPrevious()
924 iter->index=index-1; in utf8IteratorPrevious()
925 } else if(iter->start<=1) { in utf8IteratorPrevious()
926 iter->index= c<=0xffff ? iter->start : iter->start+1; in utf8IteratorPrevious()
931 iter->start+=4; /* back to behind this supplementary code point for consistent state */ in utf8IteratorPrevious()
932 iter->reservedField=c; in utf8IteratorPrevious()
941 utf8IteratorGetState(const UCharIterator *iter) { in utf8IteratorGetState() argument
942 uint32_t state=(uint32_t)(iter->start<<1); in utf8IteratorGetState()
943 if(iter->reservedField!=0) { in utf8IteratorGetState()
950 utf8IteratorSetState(UCharIterator *iter, in utf8IteratorSetState() argument
956 } else if(iter==NULL) { in utf8IteratorSetState()
958 } else if(state==utf8IteratorGetState(iter)) { in utf8IteratorSetState()
964 if((state==0 ? index<0 : index<4) || iter->limit<index) { in utf8IteratorSetState()
967 iter->start=index; /* restore UTF-8 byte index */ in utf8IteratorSetState()
969 iter->index=index; in utf8IteratorSetState()
971 iter->index=-1; /* unknown UTF-16 index */ in utf8IteratorSetState()
974 iter->reservedField=0; in utf8IteratorSetState()
978 U8_PREV_OR_FFFD((const uint8_t *)iter->context, 0, index, c); in utf8IteratorSetState()
982 iter->reservedField=c; in utf8IteratorSetState()
1004 uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length) { in uiter_setUTF8() argument
1005 if(iter!=0) { in uiter_setUTF8()
1007 *iter=utf8Iterator; in uiter_setUTF8()
1008 iter->context=s; in uiter_setUTF8()
1010 iter->limit=length; in uiter_setUTF8()
1012 iter->limit=(int32_t)uprv_strlen(s); in uiter_setUTF8()
1014 iter->length= iter->limit<=1 ? iter->limit : -1; in uiter_setUTF8()
1016 *iter=noopIterator; in uiter_setUTF8()
1024 uiter_current32(UCharIterator *iter) { in uiter_current32() argument
1027 c=iter->current(iter); in uiter_current32()
1034 iter->move(iter, 1, UITER_CURRENT); in uiter_current32()
1035 if(U16_IS_TRAIL(c2=iter->current(iter))) { in uiter_current32()
1040 iter->move(iter, -1, UITER_CURRENT); in uiter_current32()
1042 if(U16_IS_LEAD(c2=iter->previous(iter))) { in uiter_current32()
1047 iter->move(iter, 1, UITER_CURRENT); in uiter_current32()
1055 uiter_next32(UCharIterator *iter) { in uiter_next32() argument
1058 c=iter->next(iter); in uiter_next32()
1060 if(U16_IS_TRAIL(c2=iter->next(iter))) { in uiter_next32()
1064 iter->move(iter, -1, UITER_CURRENT); in uiter_next32()
1071 uiter_previous32(UCharIterator *iter) { in uiter_previous32() argument
1074 c=iter->previous(iter); in uiter_previous32()
1076 if(U16_IS_LEAD(c2=iter->previous(iter))) { in uiter_previous32()
1080 iter->move(iter, 1, UITER_CURRENT); in uiter_previous32()
1087 uiter_getState(const UCharIterator *iter) { in uiter_getState() argument
1088 if(iter==NULL || iter->getState==NULL) { in uiter_getState()
1091 return iter->getState(iter); in uiter_getState()
1096 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { in uiter_setState() argument
1099 } else if(iter==NULL) { in uiter_setState()
1101 } else if(iter->setState==NULL) { in uiter_setState()
1104 iter->setState(iter, state, pErrorCode); in uiter_setState()