Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | ********************************************************************** |
michael@0 | 3 | * Copyright (C) 2008-2009, International Business Machines |
michael@0 | 4 | * Corporation and others. All Rights Reserved. |
michael@0 | 5 | ********************************************************************** |
michael@0 | 6 | * Date Name Description |
michael@0 | 7 | * 05/11/2008 Andy Heninger Ported from Java |
michael@0 | 8 | ********************************************************************** |
michael@0 | 9 | */ |
michael@0 | 10 | #ifndef BRKTRANS_H |
michael@0 | 11 | #define BRKTRANS_H |
michael@0 | 12 | |
michael@0 | 13 | #include "unicode/utypes.h" |
michael@0 | 14 | |
michael@0 | 15 | #if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION |
michael@0 | 16 | |
michael@0 | 17 | #include "unicode/translit.h" |
michael@0 | 18 | |
michael@0 | 19 | |
michael@0 | 20 | U_NAMESPACE_BEGIN |
michael@0 | 21 | |
michael@0 | 22 | class UVector32; |
michael@0 | 23 | |
michael@0 | 24 | /** |
michael@0 | 25 | * A transliterator that pInserts the specified characters at word breaks. |
michael@0 | 26 | * To restrict it to particular characters, use a filter. |
michael@0 | 27 | * TODO: this is an internal class, and only temporary. |
michael@0 | 28 | * Remove it once we have \b notation in Transliterator. |
michael@0 | 29 | */ |
michael@0 | 30 | class BreakTransliterator : public Transliterator { |
michael@0 | 31 | public: |
michael@0 | 32 | |
michael@0 | 33 | BreakTransliterator(const UnicodeString &ID, |
michael@0 | 34 | UnicodeFilter *adoptedFilter, |
michael@0 | 35 | BreakIterator *bi, |
michael@0 | 36 | const UnicodeString &insertion); |
michael@0 | 37 | /** |
michael@0 | 38 | * Constructs a transliterator. |
michael@0 | 39 | * @param adoptedFilter the filter for this transliterator. |
michael@0 | 40 | */ |
michael@0 | 41 | BreakTransliterator(UnicodeFilter* adoptedFilter = 0); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Destructor. |
michael@0 | 45 | */ |
michael@0 | 46 | virtual ~BreakTransliterator(); |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Copy constructor. |
michael@0 | 50 | */ |
michael@0 | 51 | BreakTransliterator(const BreakTransliterator&); |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Transliterator API. |
michael@0 | 55 | * @return A copy of the object. |
michael@0 | 56 | */ |
michael@0 | 57 | virtual Transliterator* clone(void) const; |
michael@0 | 58 | |
michael@0 | 59 | virtual const UnicodeString &getInsertion() const; |
michael@0 | 60 | |
michael@0 | 61 | virtual void setInsertion(const UnicodeString &insertion); |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * Return the break iterator used by this transliterator. |
michael@0 | 65 | * Caution, this is the live break iterator; it must not be used while |
michael@0 | 66 | * there is any possibility that this transliterator is using it. |
michael@0 | 67 | */ |
michael@0 | 68 | virtual BreakIterator *getBreakIterator(); |
michael@0 | 69 | |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * ICU "poor man's RTTI", returns a UClassID for the actual class. |
michael@0 | 73 | */ |
michael@0 | 74 | virtual UClassID getDynamicClassID() const; |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * ICU "poor man's RTTI", returns a UClassID for this class. |
michael@0 | 78 | */ |
michael@0 | 79 | U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); |
michael@0 | 80 | |
michael@0 | 81 | protected: |
michael@0 | 82 | |
michael@0 | 83 | /** |
michael@0 | 84 | * Implements {@link Transliterator#handleTransliterate}. |
michael@0 | 85 | * @param text the buffer holding transliterated and |
michael@0 | 86 | * untransliterated text |
michael@0 | 87 | * @param offset the start and limit of the text, the position |
michael@0 | 88 | * of the cursor, and the start and limit of transliteration. |
michael@0 | 89 | * @param incremental if true, assume more text may be coming after |
michael@0 | 90 | * pos.contextLimit. Otherwise, assume the text is complete. |
michael@0 | 91 | */ |
michael@0 | 92 | virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, |
michael@0 | 93 | UBool isIncremental) const; |
michael@0 | 94 | |
michael@0 | 95 | private: |
michael@0 | 96 | BreakIterator *bi; |
michael@0 | 97 | UnicodeString fInsertion; |
michael@0 | 98 | UVector32 *boundaries; |
michael@0 | 99 | UnicodeString sText; // text from handleTransliterate(). |
michael@0 | 100 | |
michael@0 | 101 | static UnicodeString replaceableAsString(Replaceable &r); |
michael@0 | 102 | |
michael@0 | 103 | /** |
michael@0 | 104 | * Assignment operator. |
michael@0 | 105 | */ |
michael@0 | 106 | BreakTransliterator& operator=(const BreakTransliterator&); |
michael@0 | 107 | }; |
michael@0 | 108 | |
michael@0 | 109 | U_NAMESPACE_END |
michael@0 | 110 | |
michael@0 | 111 | #endif /* #if !UCONFIG_NO_TRANSLITERATION */ |
michael@0 | 112 | |
michael@0 | 113 | #endif |