1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | http://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Gustavo Lopes <cataphract@php.net> | 14 +----------------------------------------------------------------------+ 15 */ 16 17 #ifndef CODEPOINTITERATOR_INTERNAL_H 18 #define CODEPOINTITERATOR_INTERNAL_H 19 20 #include <unicode/brkiter.h> 21 22 using U_ICU_NAMESPACE::BreakIterator; 23 24 namespace PHP { 25 26 class CodePointBreakIterator : public BreakIterator { 27 28 public: 29 static UClassID getStaticClassID(); 30 31 CodePointBreakIterator(); 32 33 CodePointBreakIterator(const CodePointBreakIterator &other); 34 35 CodePointBreakIterator& operator=(const CodePointBreakIterator& that); 36 37 virtual ~CodePointBreakIterator(); 38 39 virtual UBool operator==(const BreakIterator& that) const; 40 41 virtual CodePointBreakIterator* clone(void) const; 42 43 virtual UClassID getDynamicClassID(void) const; 44 45 virtual CharacterIterator& getText(void) const; 46 47 virtual UText *getUText(UText *fillIn, UErrorCode &status) const; 48 49 virtual void setText(const UnicodeString &text); 50 51 virtual void setText(UText *text, UErrorCode &status); 52 53 virtual void adoptText(CharacterIterator* it); 54 55 virtual int32_t first(void); 56 57 virtual int32_t last(void); 58 59 virtual int32_t previous(void); 60 61 virtual int32_t next(void); 62 63 virtual int32_t current(void) const; 64 65 virtual int32_t following(int32_t offset); 66 67 virtual int32_t preceding(int32_t offset); 68 69 virtual UBool isBoundary(int32_t offset); 70 71 virtual int32_t next(int32_t n); 72 73 virtual CodePointBreakIterator *createBufferClone(void *stackBuffer, 74 int32_t &BufferSize, 75 UErrorCode &status); 76 77 virtual CodePointBreakIterator &refreshInputText(UText *input, UErrorCode &status); 78 getLastCodePoint()79 inline UChar32 getLastCodePoint() 80 { 81 return this->lastCodePoint; 82 } 83 84 private: 85 UText *fText; 86 UChar32 lastCodePoint; 87 mutable CharacterIterator *fCharIter; 88 clearCurrentCharIter()89 inline void clearCurrentCharIter() 90 { 91 delete this->fCharIter; 92 this->fCharIter = NULL; 93 this->lastCodePoint = U_SENTINEL; 94 } 95 }; 96 } 97 98 #endif 99