// © 2016 and later: Unicode, Inc. and others.1// License & terms of use: http://www.unicode.org/copyright.html2/*3**********************************************************************4* Copyright (C) 2008-2015, International Business Machines5* Corporation and others. All Rights Reserved.6**********************************************************************7* Date Name Description8* 05/11/2008 Andy Heninger Ported from Java9**********************************************************************10*/11#ifndef BRKTRANS_H12#define BRKTRANS_H1314#include "unicode/utypes.h"1516#if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION1718#include "unicode/translit.h"1920#include "unicode/localpointer.h"212223U_NAMESPACE_BEGIN2425class UVector32;2627/**28* A transliterator that pInserts the specified characters at word breaks.29* To restrict it to particular characters, use a filter.30* TODO: this is an internal class, and only temporary.31* Remove it once we have \b notation in Transliterator.32*/33class BreakTransliterator : public Transliterator {34public:3536/**37* Constructs a transliterator.38* @param adoptedFilter the filter for this transliterator.39*/40BreakTransliterator(UnicodeFilter* adoptedFilter = 0);4142/**43* Destructor.44*/45virtual ~BreakTransliterator();4647/**48* Copy constructor.49*/50BreakTransliterator(const BreakTransliterator&);5152/**53* Transliterator API.54* @return A copy of the object.55*/56virtual BreakTransliterator* clone() const override;5758virtual const UnicodeString &getInsertion() const;5960virtual void setInsertion(const UnicodeString &insertion);6162/**63* ICU "poor man's RTTI", returns a UClassID for the actual class.64*/65virtual UClassID getDynamicClassID() const override;6667/**68* ICU "poor man's RTTI", returns a UClassID for this class.69*/70U_I18N_API static UClassID U_EXPORT2 getStaticClassID();7172protected:7374/**75* Implements {@link Transliterator#handleTransliterate}.76* @param text the buffer holding transliterated and77* untransliterated text78* @param offset the start and limit of the text, the position79* of the cursor, and the start and limit of transliteration.80* @param incremental if true, assume more text may be coming after81* pos.contextLimit. Otherwise, assume the text is complete.82*/83virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,84UBool isIncremental) const override;8586private:87LocalPointer<BreakIterator> cachedBI;88LocalPointer<UVector32> cachedBoundaries;89UnicodeString fInsertion;9091static UnicodeString replaceableAsString(Replaceable &r);9293/**94* Assignment operator.95*/96BreakTransliterator& operator=(const BreakTransliterator&);97};9899U_NAMESPACE_END100101#endif /* #if !UCONFIG_NO_TRANSLITERATION */102103#endif104105106