]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/brktrans.h
ICU-62141.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / brktrans.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
46f4442e
A
3/*
4**********************************************************************
2ca993e8 5* Copyright (C) 2008-2015, International Business Machines
46f4442e
A
6* Corporation and others. All Rights Reserved.
7**********************************************************************
8* Date Name Description
9* 05/11/2008 Andy Heninger Ported from Java
10**********************************************************************
11*/
12#ifndef BRKTRANS_H
13#define BRKTRANS_H
14
15#include "unicode/utypes.h"
16
17#if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION
18
19#include "unicode/translit.h"
20
2ca993e8
A
21#include "unicode/localpointer.h"
22
46f4442e
A
23
24U_NAMESPACE_BEGIN
25
26class UVector32;
27
28/**
29 * A transliterator that pInserts the specified characters at word breaks.
30 * To restrict it to particular characters, use a filter.
31 * TODO: this is an internal class, and only temporary.
32 * Remove it once we have \b notation in Transliterator.
33 */
34class BreakTransliterator : public Transliterator {
35public:
36
46f4442e
A
37 /**
38 * Constructs a transliterator.
39 * @param adoptedFilter the filter for this transliterator.
40 */
41 BreakTransliterator(UnicodeFilter* adoptedFilter = 0);
42
43 /**
44 * Destructor.
45 */
46 virtual ~BreakTransliterator();
47
48 /**
49 * Copy constructor.
50 */
51 BreakTransliterator(const BreakTransliterator&);
52
53 /**
54 * Transliterator API.
55 * @return A copy of the object.
56 */
57 virtual Transliterator* clone(void) const;
58
59 virtual const UnicodeString &getInsertion() const;
60
729e4ab9 61 virtual void setInsertion(const UnicodeString &insertion);
46f4442e 62
46f4442e
A
63 /**
64 * ICU "poor man's RTTI", returns a UClassID for the actual class.
65 */
66 virtual UClassID getDynamicClassID() const;
67
68 /**
69 * ICU "poor man's RTTI", returns a UClassID for this class.
70 */
71 U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
72
73 protected:
74
75 /**
76 * Implements {@link Transliterator#handleTransliterate}.
77 * @param text the buffer holding transliterated and
78 * untransliterated text
79 * @param offset the start and limit of the text, the position
80 * of the cursor, and the start and limit of transliteration.
81 * @param incremental if true, assume more text may be coming after
82 * pos.contextLimit. Otherwise, assume the text is complete.
83 */
84 virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
85 UBool isIncremental) const;
86
87 private:
2ca993e8
A
88 LocalPointer<BreakIterator> cachedBI;
89 LocalPointer<UVector32> cachedBoundaries;
90 UnicodeString fInsertion;
46f4442e
A
91
92 static UnicodeString replaceableAsString(Replaceable &r);
93
94 /**
95 * Assignment operator.
96 */
97 BreakTransliterator& operator=(const BreakTransliterator&);
98};
99
100U_NAMESPACE_END
101
102#endif /* #if !UCONFIG_NO_TRANSLITERATION */
103
104#endif