]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/brktrans.h
2 **********************************************************************
3 * Copyright (C) 2008-2009, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 05/11/2008 Andy Heninger Ported from Java
8 **********************************************************************
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION
17 #include "unicode/translit.h"
25 * A transliterator that pInserts the specified characters at word breaks.
26 * To restrict it to particular characters, use a filter.
27 * TODO: this is an internal class, and only temporary.
28 * Remove it once we have \b notation in Transliterator.
30 class BreakTransliterator
: public Transliterator
{
33 BreakTransliterator(const UnicodeString
&ID
,
34 UnicodeFilter
*adoptedFilter
,
36 const UnicodeString
&insertion
);
38 * Constructs a transliterator.
39 * @param adoptedFilter the filter for this transliterator.
41 BreakTransliterator(UnicodeFilter
* adoptedFilter
= 0);
46 virtual ~BreakTransliterator();
51 BreakTransliterator(const BreakTransliterator
&);
55 * @return A copy of the object.
57 virtual Transliterator
* clone(void) const;
59 virtual const UnicodeString
&getInsertion() const;
61 virtual void setInsertion(const UnicodeString
&insertion
);
64 * Return the break iterator used by this transliterator.
65 * Caution, this is the live break iterator; it must not be used while
66 * there is any possibility that this transliterator is using it.
68 virtual BreakIterator
*getBreakIterator();
72 * ICU "poor man's RTTI", returns a UClassID for the actual class.
74 virtual UClassID
getDynamicClassID() const;
77 * ICU "poor man's RTTI", returns a UClassID for this class.
79 U_I18N_API
static UClassID U_EXPORT2
getStaticClassID();
84 * Implements {@link Transliterator#handleTransliterate}.
85 * @param text the buffer holding transliterated and
86 * untransliterated text
87 * @param offset the start and limit of the text, the position
88 * of the cursor, and the start and limit of transliteration.
89 * @param incremental if true, assume more text may be coming after
90 * pos.contextLimit. Otherwise, assume the text is complete.
92 virtual void handleTransliterate(Replaceable
& text
, UTransPosition
& offset
,
93 UBool isIncremental
) const;
97 UnicodeString fInsertion
;
98 UVector32
*boundaries
;
99 UnicodeString sText
; // text from handleTransliterate().
101 static UnicodeString
replaceableAsString(Replaceable
&r
);
104 * Assignment operator.
106 BreakTransliterator
& operator=(const BreakTransliterator
&);
111 #endif /* #if !UCONFIG_NO_TRANSLITERATION */