ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
chariter.h
Go to the documentation of this file.
1 /*
2 ********************************************************************
3 *
4 * Copyright (C) 1997-2005, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ********************************************************************
8 */
9 
10 #ifndef CHARITER_H
11 #define CHARITER_H
12 
13 #include "unicode/utypes.h"
14 #include "unicode/uobject.h"
15 #include "unicode/unistr.h"
90 public:
96  enum { DONE = 0xffff };
97 
102  virtual ~ForwardCharacterIterator();
103 
112  virtual UBool operator==(const ForwardCharacterIterator& that) const = 0;
113 
124  inline UBool operator!=(const ForwardCharacterIterator& that) const;
125 
131  virtual int32_t hashCode(void) const = 0;
132 
140  virtual UClassID getDynamicClassID(void) const = 0;
141 
150  virtual UChar nextPostInc(void) = 0;
151 
160  virtual UChar32 next32PostInc(void) = 0;
161 
171  virtual UBool hasNext() = 0;
172 
173 protected:
176 
179 
185 };
186 
357 public:
362  enum EOrigin { kStart, kCurrent, kEnd };
363 
372  virtual CharacterIterator* clone(void) const = 0;
373 
381  virtual UChar first(void) = 0;
382 
391  virtual UChar firstPostInc(void);
392 
402  virtual UChar32 first32(void) = 0;
403 
412  virtual UChar32 first32PostInc(void);
413 
421  inline int32_t setToStart();
422 
430  virtual UChar last(void) = 0;
431 
439  virtual UChar32 last32(void) = 0;
440 
448  inline int32_t setToEnd();
449 
458  virtual UChar setIndex(int32_t position) = 0;
459 
471  virtual UChar32 setIndex32(int32_t position) = 0;
472 
478  virtual UChar current(void) const = 0;
479 
485  virtual UChar32 current32(void) const = 0;
486 
494  virtual UChar next(void) = 0;
495 
506  virtual UChar32 next32(void) = 0;
507 
515  virtual UChar previous(void) = 0;
516 
524  virtual UChar32 previous32(void) = 0;
525 
535  virtual UBool hasPrevious() = 0;
536 
547  inline int32_t startIndex(void) const;
548 
558  inline int32_t endIndex(void) const;
559 
568  inline int32_t getIndex(void) const;
569 
576  inline int32_t getLength() const;
577 
589  virtual int32_t move(int32_t delta, EOrigin origin) = 0;
590 
602  virtual int32_t move32(int32_t delta, EOrigin origin) = 0;
603 
610  virtual void getText(UnicodeString& result) = 0;
611 
612 protected:
618 
623  CharacterIterator(int32_t length);
624 
629  CharacterIterator(int32_t length, int32_t position);
630 
635  CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
636 
644 
653 
659  int32_t textLength;
660 
665  int32_t pos;
666 
671  int32_t begin;
672 
677  int32_t end;
678 };
679 
680 inline UBool
682  return !operator==(that);
683 }
684 
685 inline int32_t
687  return move(0, kStart);
688 }
689 
690 inline int32_t
692  return move(0, kEnd);
693 }
694 
695 inline int32_t
697  return begin;
698 }
699 
700 inline int32_t
702  return end;
703 }
704 
705 inline int32_t
707  return pos;
708 }
709 
710 inline int32_t
712  return textLength;
713 }
714 
716 #endif