Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-26 08:24:55

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 ********************************************************************************
0005 *   Copyright (C) 1997-2016, International Business Machines
0006 *   Corporation and others.  All Rights Reserved.
0007 ********************************************************************************
0008 *
0009 * File brkiter.h
0010 *
0011 * Modification History:
0012 *
0013 *   Date        Name        Description
0014 *   02/18/97    aliu        Added typedef for TextCount.  Made DONE const.
0015 *   05/07/97    aliu        Fixed DLL declaration.
0016 *   07/09/97    jfitz       Renamed BreakIterator and interface synced with JDK
0017 *   08/11/98    helena      Sync-up JDK1.2.
0018 *   01/13/2000  helena      Added UErrorCode parameter to createXXXInstance methods.
0019 ********************************************************************************
0020 */
0021 
0022 #ifndef BRKITER_H
0023 #define BRKITER_H
0024 
0025 #include "unicode/utypes.h"
0026 
0027 /**
0028  * \file
0029  * \brief C++ API: Break Iterator.
0030  */
0031 
0032 #include "unicode/utypes.h"
0033 
0034 #if U_SHOW_CPLUSPLUS_API
0035 
0036 #if UCONFIG_NO_BREAK_ITERATION
0037 
0038 U_NAMESPACE_BEGIN
0039 
0040 /*
0041  * Allow the declaration of APIs with pointers to BreakIterator
0042  * even when break iteration is removed from the build.
0043  */
0044 class BreakIterator;
0045 
0046 U_NAMESPACE_END
0047 
0048 #else
0049 
0050 #include "unicode/uobject.h"
0051 #include "unicode/unistr.h"
0052 #include "unicode/chariter.h"
0053 #include "unicode/locid.h"
0054 #include "unicode/ubrk.h"
0055 #include "unicode/strenum.h"
0056 #include "unicode/utext.h"
0057 #include "unicode/umisc.h"
0058 
0059 U_NAMESPACE_BEGIN
0060 
0061 /**
0062  * The BreakIterator class implements methods for finding the location
0063  * of boundaries in text. BreakIterator is an abstract base class.
0064  * Instances of BreakIterator maintain a current position and scan over
0065  * text returning the index of characters where boundaries occur.
0066  * <p>
0067  * Line boundary analysis determines where a text string can be broken
0068  * when line-wrapping. The mechanism correctly handles punctuation and
0069  * hyphenated words.
0070  * <p>
0071  * Sentence boundary analysis allows selection with correct
0072  * interpretation of periods within numbers and abbreviations, and
0073  * trailing punctuation marks such as quotation marks and parentheses.
0074  * <p>
0075  * Word boundary analysis is used by search and replace functions, as
0076  * well as within text editing applications that allow the user to
0077  * select words with a double click. Word selection provides correct
0078  * interpretation of punctuation marks within and following
0079  * words. Characters that are not part of a word, such as symbols or
0080  * punctuation marks, have word-breaks on both sides.
0081  * <p>
0082  * Character boundary analysis allows users to interact with
0083  * characters as they expect to, for example, when moving the cursor
0084  * through a text string. Character boundary analysis provides correct
0085  * navigation of through character strings, regardless of how the
0086  * character is stored.  For example, an accented character might be
0087  * stored as a base character and a diacritical mark. What users
0088  * consider to be a character can differ between languages.
0089  * <p>
0090  * The text boundary positions are found according to the rules
0091  * described in Unicode Standard Annex #29, Text Boundaries, and
0092  * Unicode Standard Annex #14, Line Breaking Properties.  These
0093  * are available at http://www.unicode.org/reports/tr14/ and
0094  * http://www.unicode.org/reports/tr29/.
0095  * <p>
0096  * In addition to the C++ API defined in this header file, a
0097  * plain C API with equivalent functionality is defined in the
0098  * file ubrk.h
0099  * <p>
0100  * Code snippets illustrating the use of the Break Iterator APIs
0101  * are available in the ICU User Guide,
0102  * https://unicode-org.github.io/icu/userguide/boundaryanalysis/
0103  * and in the sample program icu/source/samples/break/break.cpp
0104  *
0105  */
0106 class U_COMMON_API BreakIterator : public UObject {
0107 public:
0108     /**
0109      *  destructor
0110      *  @stable ICU 2.0
0111      */
0112     virtual ~BreakIterator();
0113 
0114     /**
0115      * Return true if another object is semantically equal to this
0116      * one. The other object should be an instance of the same subclass of
0117      * BreakIterator. Objects of different subclasses are considered
0118      * unequal.
0119      * <P>
0120      * Return true if this BreakIterator is at the same position in the
0121      * same text, and is the same class and type (word, line, etc.) of
0122      * BreakIterator, as the argument.  Text is considered the same if
0123      * it contains the same characters, it need not be the same
0124      * object, and styles are not considered.
0125      * @stable ICU 2.0
0126      */
0127     virtual bool operator==(const BreakIterator&) const = 0;
0128 
0129     /**
0130      * Returns the complement of the result of operator==
0131      * @param rhs The BreakIterator to be compared for inequality
0132      * @return the complement of the result of operator==
0133      * @stable ICU 2.0
0134      */
0135     bool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); }
0136 
0137     /**
0138      * Return a polymorphic copy of this object.  This is an abstract
0139      * method which subclasses implement.
0140      * @stable ICU 2.0
0141      */
0142     virtual BreakIterator* clone() const = 0;
0143 
0144     /**
0145      * Return a polymorphic class ID for this object. Different subclasses
0146      * will return distinct unequal values.
0147      * @stable ICU 2.0
0148      */
0149     virtual UClassID getDynamicClassID() const override = 0;
0150 
0151     /**
0152      * Return a CharacterIterator over the text being analyzed.
0153      * @stable ICU 2.0
0154      */
0155     virtual CharacterIterator& getText() const = 0;
0156 
0157     /**
0158       *  Get a UText for the text being analyzed.
0159       *  The returned UText is a shallow clone of the UText used internally
0160       *  by the break iterator implementation.  It can safely be used to
0161       *  access the text without impacting any break iterator operations,
0162       *  but the underlying text itself must not be altered.
0163       *
0164       * @param fillIn A UText to be filled in.  If nullptr, a new UText will be
0165       *           allocated to hold the result.
0166       * @param status receives any error codes.
0167       * @return   The current UText for this break iterator.  If an input
0168       *           UText was provided, it will always be returned.
0169       * @stable ICU 3.4
0170       */
0171      virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0;
0172 
0173     /**
0174      * Change the text over which this operates. The text boundary is
0175      * reset to the start.
0176      *
0177      * The BreakIterator will retain a reference to the supplied string.
0178      * The caller must not modify or delete the text while the BreakIterator
0179      * retains the reference.
0180      *
0181      * @param text The UnicodeString used to change the text.
0182      * @stable ICU 2.0
0183      */
0184     virtual void  setText(const UnicodeString &text) = 0;
0185 
0186     /**
0187      * Reset the break iterator to operate over the text represented by
0188      * the UText.  The iterator position is reset to the start.
0189      *
0190      * This function makes a shallow clone of the supplied UText.  This means
0191      * that the caller is free to immediately close or otherwise reuse the
0192      * Utext that was passed as a parameter, but that the underlying text itself
0193      * must not be altered while being referenced by the break iterator.
0194      *
0195      * All index positions returned by break iterator functions are
0196      * native indices from the UText. For example, when breaking UTF-8
0197      * encoded text, the break positions returned by next(), previous(), etc.
0198      * will be UTF-8 string indices, not UTF-16 positions.
0199      *
0200      * @param text The UText used to change the text.
0201      * @param status receives any error codes.
0202      * @stable ICU 3.4
0203      */
0204     virtual void  setText(UText *text, UErrorCode &status) = 0;
0205 
0206     /**
0207      * Change the text over which this operates. The text boundary is
0208      * reset to the start.
0209      * Note that setText(UText *) provides similar functionality to this function,
0210      * and is more efficient.
0211      * @param it The CharacterIterator used to change the text.
0212      * @stable ICU 2.0
0213      */
0214     virtual void  adoptText(CharacterIterator* it) = 0;
0215 
0216     enum {
0217         /**
0218          * DONE is returned by previous() and next() after all valid
0219          * boundaries have been returned.
0220          * @stable ICU 2.0
0221          */
0222         DONE = static_cast<int32_t>(-1)
0223     };
0224 
0225     /**
0226      * Sets the current iteration position to the beginning of the text, position zero.
0227      * @return The offset of the beginning of the text, zero.
0228      * @stable ICU 2.0
0229      */
0230     virtual int32_t first() = 0;
0231 
0232     /**
0233      * Set the iterator position to the index immediately BEYOND the last character in the text being scanned.
0234      * @return The index immediately BEYOND the last character in the text being scanned.
0235      * @stable ICU 2.0
0236      */
0237     virtual int32_t last() = 0;
0238 
0239     /**
0240      * Set the iterator position to the boundary preceding the current boundary.
0241      * @return The character index of the previous text boundary or DONE if all
0242      * boundaries have been returned.
0243      * @stable ICU 2.0
0244      */
0245     virtual int32_t previous() = 0;
0246 
0247     /**
0248      * Advance the iterator to the boundary following the current boundary.
0249      * @return The character index of the next text boundary or DONE if all
0250      * boundaries have been returned.
0251      * @stable ICU 2.0
0252      */
0253     virtual int32_t next() = 0;
0254 
0255     /**
0256      * Return character index of the current iterator position within the text.
0257      * @return The boundary most recently returned.
0258      * @stable ICU 2.0
0259      */
0260     virtual int32_t current() const = 0;
0261 
0262     /**
0263      * Advance the iterator to the first boundary following the specified offset.
0264      * The value returned is always greater than the offset or
0265      * the value BreakIterator.DONE
0266      * @param offset the offset to begin scanning.
0267      * @return The first boundary after the specified offset.
0268      * @stable ICU 2.0
0269      */
0270     virtual int32_t following(int32_t offset) = 0;
0271 
0272     /**
0273      * Set the iterator position to the first boundary preceding the specified offset.
0274      * The value returned is always smaller than the offset or
0275      * the value BreakIterator.DONE
0276      * @param offset the offset to begin scanning.
0277      * @return The first boundary before the specified offset.
0278      * @stable ICU 2.0
0279      */
0280     virtual int32_t preceding(int32_t offset) = 0;
0281 
0282     /**
0283      * Return true if the specified position is a boundary position.
0284      * As a side effect, the current position of the iterator is set
0285      * to the first boundary position at or following the specified offset.
0286      * @param offset the offset to check.
0287      * @return True if "offset" is a boundary position.
0288      * @stable ICU 2.0
0289      */
0290     virtual UBool isBoundary(int32_t offset) = 0;
0291 
0292     /**
0293      * Set the iterator position to the nth boundary from the current boundary
0294      * @param n the number of boundaries to move by.  A value of 0
0295      * does nothing.  Negative values move to previous boundaries
0296      * and positive values move to later boundaries.
0297      * @return The new iterator position, or
0298      * DONE if there are fewer than |n| boundaries in the specified direction.
0299      * @stable ICU 2.0
0300      */
0301     virtual int32_t next(int32_t n) = 0;
0302 
0303    /**
0304      * For RuleBasedBreakIterators, return the status tag from the break rule
0305      * that determined the boundary at the current iteration position.
0306      * <p>
0307      * For break iterator types that do not support a rule status,
0308      * a default value of 0 is returned.
0309      * <p>
0310      * @return the status from the break rule that determined the boundary at
0311      *         the current iteration position.
0312      * @see RuleBaseBreakIterator::getRuleStatus()
0313      * @see UWordBreak
0314      * @stable ICU 52
0315      */
0316     virtual int32_t getRuleStatus() const;
0317 
0318    /**
0319     * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s)
0320     * that determined the boundary at the current iteration position.
0321     * <p>
0322     * For break iterator types that do not support rule status,
0323     * no values are returned.
0324     * <p>
0325     * The returned status value(s) are stored into an array provided by the caller.
0326     * The values are stored in sorted (ascending) order.
0327     * If the capacity of the output array is insufficient to hold the data,
0328     *  the output will be truncated to the available length, and a
0329     *  U_BUFFER_OVERFLOW_ERROR will be signaled.
0330     * <p>
0331     * @see RuleBaseBreakIterator::getRuleStatusVec
0332     *
0333     * @param fillInVec an array to be filled in with the status values.
0334     * @param capacity  the length of the supplied vector.  A length of zero causes
0335     *                  the function to return the number of status values, in the
0336     *                  normal way, without attempting to store any values.
0337     * @param status    receives error codes.
0338     * @return          The number of rule status values from rules that determined
0339     *                  the boundary at the current iteration position.
0340     *                  In the event of a U_BUFFER_OVERFLOW_ERROR, the return value
0341     *                  is the total number of status values that were available,
0342     *                  not the reduced number that were actually returned.
0343     * @see getRuleStatus
0344     * @stable ICU 52
0345     */
0346     virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status);
0347 
0348     /**
0349      * Create BreakIterator for word-breaks using the given locale.
0350      * Returns an instance of a BreakIterator implementing word breaks.
0351      * WordBreak is useful for word selection (ex. double click)
0352      * @param where the locale.
0353      * @param status the error code
0354      * @return A BreakIterator for word-breaks.  The UErrorCode& status
0355      * parameter is used to return status information to the user.
0356      * To check whether the construction succeeded or not, you should check
0357      * the value of U_SUCCESS(err).  If you wish more detailed information, you
0358      * can check for informational error results which still indicate success.
0359      * U_USING_FALLBACK_WARNING indicates that a fall back locale was used.  For
0360      * example, 'de_CH' was requested, but nothing was found there, so 'de' was
0361      * used.  U_USING_DEFAULT_WARNING indicates that the default locale data was
0362      * used; neither the requested locale nor any of its fall back locales
0363      * could be found.
0364      * The caller owns the returned object and is responsible for deleting it.
0365      * @stable ICU 2.0
0366      */
0367     static BreakIterator* U_EXPORT2
0368     createWordInstance(const Locale& where, UErrorCode& status);
0369 
0370     /**
0371      * Create BreakIterator for line-breaks using specified locale.
0372      * Returns an instance of a BreakIterator implementing line breaks. Line
0373      * breaks are logically possible line breaks, actual line breaks are
0374      * usually determined based on display width.
0375      * LineBreak is useful for word wrapping text.
0376      * @param where the locale.
0377      * @param status The error code.
0378      * @return A BreakIterator for line-breaks.  The UErrorCode& status
0379      * parameter is used to return status information to the user.
0380      * To check whether the construction succeeded or not, you should check
0381      * the value of U_SUCCESS(err).  If you wish more detailed information, you
0382      * can check for informational error results which still indicate success.
0383      * U_USING_FALLBACK_WARNING indicates that a fall back locale was used.  For
0384      * example, 'de_CH' was requested, but nothing was found there, so 'de' was
0385      * used.  U_USING_DEFAULT_WARNING indicates that the default locale data was
0386      * used; neither the requested locale nor any of its fall back locales
0387      * could be found.
0388      * The caller owns the returned object and is responsible for deleting it.
0389      * @stable ICU 2.0
0390      */
0391     static BreakIterator* U_EXPORT2
0392     createLineInstance(const Locale& where, UErrorCode& status);
0393 
0394     /**
0395      * Create BreakIterator for character-breaks using specified locale
0396      * Returns an instance of a BreakIterator implementing character breaks.
0397      * Character breaks are boundaries of combining character sequences.
0398      * @param where the locale.
0399      * @param status The error code.
0400      * @return A BreakIterator for character-breaks.  The UErrorCode& status
0401      * parameter is used to return status information to the user.
0402      * To check whether the construction succeeded or not, you should check
0403      * the value of U_SUCCESS(err).  If you wish more detailed information, you
0404      * can check for informational error results which still indicate success.
0405      * U_USING_FALLBACK_WARNING indicates that a fall back locale was used.  For
0406      * example, 'de_CH' was requested, but nothing was found there, so 'de' was
0407      * used.  U_USING_DEFAULT_WARNING indicates that the default locale data was
0408      * used; neither the requested locale nor any of its fall back locales
0409      * could be found.
0410      * The caller owns the returned object and is responsible for deleting it.
0411      * @stable ICU 2.0
0412      */
0413     static BreakIterator* U_EXPORT2
0414     createCharacterInstance(const Locale& where, UErrorCode& status);
0415 
0416     /**
0417      * Create BreakIterator for sentence-breaks using specified locale
0418      * Returns an instance of a BreakIterator implementing sentence breaks.
0419      * @param where the locale.
0420      * @param status The error code.
0421      * @return A BreakIterator for sentence-breaks.  The UErrorCode& status
0422      * parameter is used to return status information to the user.
0423      * To check whether the construction succeeded or not, you should check
0424      * the value of U_SUCCESS(err).  If you wish more detailed information, you
0425      * can check for informational error results which still indicate success.
0426      * U_USING_FALLBACK_WARNING indicates that a fall back locale was used.  For
0427      * example, 'de_CH' was requested, but nothing was found there, so 'de' was
0428      * used.  U_USING_DEFAULT_WARNING indicates that the default locale data was
0429      * used; neither the requested locale nor any of its fall back locales
0430      * could be found.
0431      * The caller owns the returned object and is responsible for deleting it.
0432      * @stable ICU 2.0
0433      */
0434     static BreakIterator* U_EXPORT2
0435     createSentenceInstance(const Locale& where, UErrorCode& status);
0436 
0437 #ifndef U_HIDE_DEPRECATED_API
0438     /**
0439      * Create BreakIterator for title-casing breaks using the specified locale
0440      * Returns an instance of a BreakIterator implementing title breaks.
0441      * The iterator returned locates title boundaries as described for
0442      * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,
0443      * please use a word boundary iterator. See {@link #createWordInstance }.
0444      *
0445      * @param where the locale.
0446      * @param status The error code.
0447      * @return A BreakIterator for title-breaks.  The UErrorCode& status
0448      * parameter is used to return status information to the user.
0449      * To check whether the construction succeeded or not, you should check
0450      * the value of U_SUCCESS(err).  If you wish more detailed information, you
0451      * can check for informational error results which still indicate success.
0452      * U_USING_FALLBACK_WARNING indicates that a fall back locale was used.  For
0453      * example, 'de_CH' was requested, but nothing was found there, so 'de' was
0454      * used.  U_USING_DEFAULT_WARNING indicates that the default locale data was
0455      * used; neither the requested locale nor any of its fall back locales
0456      * could be found.
0457      * The caller owns the returned object and is responsible for deleting it.
0458      * @deprecated ICU 64 Use createWordInstance instead.
0459      */
0460     static BreakIterator* U_EXPORT2
0461     createTitleInstance(const Locale& where, UErrorCode& status);
0462 #endif /* U_HIDE_DEPRECATED_API */
0463 
0464     /**
0465      * Get the set of Locales for which TextBoundaries are installed.
0466      * <p><b>Note:</b> this will not return locales added through the register
0467      * call. To see the registered locales too, use the getAvailableLocales
0468      * function that returns a StringEnumeration object </p>
0469      * @param count the output parameter of number of elements in the locale list
0470      * @return available locales
0471      * @stable ICU 2.0
0472      */
0473     static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
0474 
0475     /**
0476      * Get name of the object for the desired Locale, in the desired language.
0477      * @param objectLocale must be from getAvailableLocales.
0478      * @param displayLocale specifies the desired locale for output.
0479      * @param name the fill-in parameter of the return value
0480      * Uses best match.
0481      * @return user-displayable name
0482      * @stable ICU 2.0
0483      */
0484     static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
0485                                          const Locale& displayLocale,
0486                                          UnicodeString& name);
0487 
0488     /**
0489      * Get name of the object for the desired Locale, in the language of the
0490      * default locale.
0491      * @param objectLocale must be from getMatchingLocales
0492      * @param name the fill-in parameter of the return value
0493      * @return user-displayable name
0494      * @stable ICU 2.0
0495      */
0496     static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
0497                                          UnicodeString& name);
0498 
0499 #ifndef U_FORCE_HIDE_DEPRECATED_API
0500     /**
0501      * Deprecated functionality. Use clone() instead.
0502      *
0503      * Thread safe client-buffer-based cloning operation
0504      *    Do NOT call delete on a safeclone, since 'new' is not used to create it.
0505      * @param stackBuffer user allocated space for the new clone. If nullptr new memory will be allocated.
0506      * If buffer is not large enough, new memory will be allocated.
0507      * @param BufferSize reference to size of allocated space.
0508      * If BufferSize == 0, a sufficient size for use in cloning will
0509      * be returned ('pre-flighting')
0510      * If BufferSize is not enough for a stack-based safe clone,
0511      * new memory will be allocated.
0512      * @param status to indicate whether the operation went on smoothly or there were errors
0513      *  An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were
0514      *  necessary.
0515      * @return pointer to the new clone
0516      *
0517      * @deprecated ICU 52. Use clone() instead.
0518      */
0519     virtual BreakIterator *  createBufferClone(void *stackBuffer,
0520                                                int32_t &BufferSize,
0521                                                UErrorCode &status) = 0;
0522 #endif  // U_FORCE_HIDE_DEPRECATED_API
0523 
0524 #ifndef U_HIDE_DEPRECATED_API
0525 
0526     /**
0527      *   Determine whether the BreakIterator was created in user memory by
0528      *   createBufferClone(), and thus should not be deleted.  Such objects
0529      *   must be closed by an explicit call to the destructor (not delete).
0530      * @deprecated ICU 52. Always delete the BreakIterator.
0531      */
0532     inline UBool isBufferClone();
0533 
0534 #endif /* U_HIDE_DEPRECATED_API */
0535 
0536 #if !UCONFIG_NO_SERVICE
0537     /**
0538      * Register a new break iterator of the indicated kind, to use in the given locale.
0539      * The break iterator will be adopted.  Clones of the iterator will be returned
0540      * if a request for a break iterator of the given kind matches or falls back to
0541      * this locale.
0542      * Because ICU may choose to cache BreakIterators internally, this must
0543      * be called at application startup, prior to any calls to
0544      * BreakIterator::createXXXInstance to avoid undefined behavior.
0545      * @param toAdopt the BreakIterator instance to be adopted
0546      * @param locale the Locale for which this instance is to be registered
0547      * @param kind the type of iterator for which this instance is to be registered
0548      * @param status the in/out status code, no special meanings are assigned
0549      * @return a registry key that can be used to unregister this instance
0550      * @stable ICU 2.4
0551      */
0552     static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt,
0553                                         const Locale& locale,
0554                                         UBreakIteratorType kind,
0555                                         UErrorCode& status);
0556 
0557     /**
0558      * Unregister a previously-registered BreakIterator using the key returned from the
0559      * register call.  Key becomes invalid after a successful call and should not be used again.
0560      * The BreakIterator corresponding to the key will be deleted.
0561      * Because ICU may choose to cache BreakIterators internally, this should
0562      * be called during application shutdown, after all calls to
0563      * BreakIterator::createXXXInstance to avoid undefined behavior.
0564      * @param key the registry key returned by a previous call to registerInstance
0565      * @param status the in/out status code, no special meanings are assigned
0566      * @return true if the iterator for the key was successfully unregistered
0567      * @stable ICU 2.4
0568      */
0569     static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
0570 
0571     /**
0572      * Return a StringEnumeration over the locales available at the time of the call,
0573      * including registered locales.
0574      * @return a StringEnumeration over the locales available at the time of the call
0575      * @stable ICU 2.4
0576      */
0577     static StringEnumeration* U_EXPORT2 getAvailableLocales();
0578 #endif
0579 
0580     /**
0581      * Returns the locale for this break iterator. Two flavors are available: valid and
0582      * actual locale.
0583      * @stable ICU 2.8
0584      */
0585     Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
0586 
0587 #ifndef U_HIDE_INTERNAL_API
0588     /** Get the locale for this break iterator object. You can choose between valid and actual locale.
0589      *  @param type type of the locale we're looking for (valid or actual)
0590      *  @param status error code for the operation
0591      *  @return the locale
0592      *  @internal
0593      */
0594     const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const;
0595 #endif  /* U_HIDE_INTERNAL_API */
0596 
0597     /**
0598      *  Set the subject text string upon which the break iterator is operating
0599      *  without changing any other aspect of the matching state.
0600      *  The new and previous text strings must have the same content.
0601      *
0602      *  This function is intended for use in environments where ICU is operating on
0603      *  strings that may move around in memory.  It provides a mechanism for notifying
0604      *  ICU that the string has been relocated, and providing a new UText to access the
0605      *  string in its new position.
0606      *
0607      *  Note that the break iterator implementation never copies the underlying text
0608      *  of a string being processed, but always operates directly on the original text
0609      *  provided by the user. Refreshing simply drops the references to the old text
0610      *  and replaces them with references to the new.
0611      *
0612      *  Caution:  this function is normally used only by very specialized,
0613      *  system-level code.  One example use case is with garbage collection that moves
0614      *  the text in memory.
0615      *
0616      * @param input      The new (moved) text string.
0617      * @param status     Receives errors detected by this function.
0618      * @return           *this
0619      *
0620      * @stable ICU 49
0621      */
0622     virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0;
0623 
0624  private:
0625     static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status);
0626     static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status);
0627     static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status);
0628 
0629     friend class ICUBreakIteratorFactory;
0630     friend class ICUBreakIteratorService;
0631 
0632 protected:
0633     // Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API
0634     // or else the compiler will create a public ones.
0635     /** @internal */
0636     BreakIterator();
0637     /** @internal */
0638     BreakIterator (const BreakIterator &other);
0639 #ifndef U_HIDE_INTERNAL_API
0640     /** @internal */
0641     BreakIterator (const Locale& valid, const Locale &actual);
0642     /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */
0643     BreakIterator &operator = (const BreakIterator &other);
0644 #endif  /* U_HIDE_INTERNAL_API */
0645 
0646 private:
0647 
0648     /** @internal (private) */
0649     char actualLocale[ULOC_FULLNAME_CAPACITY];
0650     char validLocale[ULOC_FULLNAME_CAPACITY];
0651     char requestLocale[ULOC_FULLNAME_CAPACITY];
0652 };
0653 
0654 #ifndef U_HIDE_DEPRECATED_API
0655 
0656 inline UBool BreakIterator::isBufferClone()
0657 {
0658     return false;
0659 }
0660 
0661 #endif /* U_HIDE_DEPRECATED_API */
0662 
0663 U_NAMESPACE_END
0664 
0665 #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
0666 
0667 #endif /* U_SHOW_CPLUSPLUS_API */
0668 
0669 #endif // BRKITER_H
0670 //eof