Imported Upstream version 58.1
[platform/upstream/icu.git] / source / common / unicode / rbbi.h
index d47598a..9f2a1a6 100644 (file)
@@ -1,6 +1,8 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 ***************************************************************************
-*   Copyright (C) 1999-2014 International Business Machines Corporation   *
+*   Copyright (C) 1999-2016 International Business Machines Corporation   *
 *   and others. All rights reserved.                                      *
 ***************************************************************************
 
@@ -56,15 +58,11 @@ struct RBBIStateTable;
  *
  * <p>See the ICU User Guide for information on Break Iterator Rules.</p>
  *
- * <p>This class is not intended to be subclassed.  (Class DictionaryBasedBreakIterator
- *    is a subclass, but that relationship is effectively internal to the ICU
- *    implementation.  The subclassing interface to RulesBasedBreakIterator is
- *    not part of the ICU API, and may not remain stable.</p>
- *
+ * <p>This class is not intended to be subclassed.</p>
  */
 class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
 
-protected:
+private:
     /**
      * The UText through which this BreakIterator accesses the text
      * @internal
@@ -139,7 +137,7 @@ protected:
      * @internal
      */
     int32_t             fPositionInCache;
-    
+
     /**
      *
      * If present, UStack of LanguageBreakEngine objects that might handle
@@ -148,7 +146,7 @@ protected:
      * @internal
      */
     UStack              *fLanguageBreakEngines;
-    
+
     /**
      *
      * If present, the special LanguageBreakEngine used for handling
@@ -157,32 +155,18 @@ protected:
      * @internal
      */
     UnhandledEngine     *fUnhandledBreakEngine;
-    
+
     /**
      *
      * The type of the break iterator, or -1 if it has not been set.
      * @internal
      */
     int32_t             fBreakType;
-    
-protected:
+
     //=======================================================================
     // constructors
     //=======================================================================
 
-#ifndef U_HIDE_INTERNAL_API
-    /**
-     * Constant to be used in the constructor
-     * RuleBasedBreakIterator(RBBIDataHeader*, EDontAdopt, UErrorCode &);
-     * which does not adopt the memory indicated by the RBBIDataHeader*
-     * parameter.
-     *
-     * @internal
-     */
-    enum EDontAdopt {
-        kDontAdopt
-    };
-
     /**
      * Constructor from a flattened set of RBBI data in malloced memory.
      *             RulesBasedBreakIterators built from a custom set of rules
@@ -195,17 +179,6 @@ protected:
      */
     RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status);
 
-    /**
-     * Constructor from a flattened set of RBBI data in memory which need not
-     *             be malloced (e.g. it may be a memory-mapped file, etc.).
-     *
-     *             This version does not adopt the memory, and does not
-     *             free it when done.
-     * @internal
-     */
-    RuleBasedBreakIterator(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status);
-#endif  /* U_HIDE_INTERNAL_API */
-
 
     friend class RBBIRuleBuilder;
     /** @internal */
@@ -248,7 +221,7 @@ public:
      * constuction from source rules.
      *
      * Ownership of the storage containing the compiled rules remains with the
-     * caller of this function.  The compiled rules must not be  modified or 
+     * caller of this function.  The compiled rules must not be  modified or
      * deleted during the life of the break iterator.
      *
      * The compiled rules are not compatible across different major versions of ICU.
@@ -402,6 +375,11 @@ public:
     /**
      * Set the iterator to analyze a new piece of text.  This function resets
      * the current iteration position to the beginning of the text.
+     *
+     * The BreakIterator will retain a reference to the supplied string.
+     * The caller must not modify or delete the text while the BreakIterator
+     * retains the reference.
+     *
      * @param newText The text to analyze.
      *  @stable ICU 2.0
      */
@@ -661,7 +639,7 @@ public:
     virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status);
 
 
-protected:
+private:
     //=======================================================================
     // implementation
     //=======================================================================
@@ -670,41 +648,19 @@ protected:
      * in text or iteration position.
      * @internal
      */
-    virtual void reset(void);
-
-#if 0
-    /**
-      * Return true if the category lookup for this char
-      * indicates that it is in the set of dictionary lookup chars.
-      * This function is intended for use by dictionary based break iterators.
-      * @return true if the category lookup for this char
-      * indicates that it is in the set of dictionary lookup chars.
-      * @internal
-      */
-    virtual UBool isDictionaryChar(UChar32);
-
-    /**
-      * Get the type of the break iterator.
-      * @internal
-      */
-    virtual int32_t getBreakType() const;
-#endif
+    void reset(void);
 
     /**
       * Set the type of the break iterator.
       * @internal
       */
-    virtual void setBreakType(int32_t type);
+    void setBreakType(int32_t type);
 
-#ifndef U_HIDE_INTERNAL_API
     /**
       * Common initialization function, used by constructors and bufferClone.
       * @internal
       */
     void init();
-#endif  /* U_HIDE_INTERNAL_API */
-
-private:
 
     /**
      * This method backs the iterator back up to a "safe position" in the text.
@@ -728,9 +684,7 @@ private:
      */
     int32_t handleNext(const RBBIStateTable *statetable);
 
-protected:
 
-#ifndef U_HIDE_INTERNAL_API
     /**
      * This is the function that actually implements dictionary-based
      * breaking.  Covering at least the range from startPos to endPos,
@@ -746,9 +700,7 @@ protected:
      * @internal
      */
     int32_t checkDictionary(int32_t startPos, int32_t endPos, UBool reverse);
-#endif  /* U_HIDE_INTERNAL_API */
 
-private:
 
     /**
      * This function returns the appropriate LanguageBreakEngine for a