+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
***************************************************************************
-* Copyright (C) 1999-2012 International Business Machines Corporation *
+* Copyright (C) 1999-2016 International Business Machines Corporation *
* and others. All rights reserved. *
***************************************************************************
struct UTrie;
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/** @internal */
*
* <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 : public BreakIterator {
+class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
+// The following was changed from protected to private per #12071.
+// However Apple code needs these, so change back to protected.
protected:
/**
* The UText through which this BreakIterator accesses the text
* @internal
*/
int32_t fPositionInCache;
-
+
/**
*
* If present, UStack of LanguageBreakEngine objects that might handle
* @internal
*/
UStack *fLanguageBreakEngines;
-
+
/**
*
* If present, the special LanguageBreakEngine used for handling
* @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
/**
+ * Open-source ICU eliminated this enum in #12071, restored here since Apple needs it
* Constant to be used in the constructor
* RuleBasedBreakIterator(RBBIDataHeader*, EDontAdopt, UErrorCode &);
* which does not adopt the memory indicated by the RBBIDataHeader*
RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status);
/**
+ * Open-source ICU eliminated this method in #12071, restored here since Apple needs it
* 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.).
*
* @internal
*/
RuleBasedBreakIterator(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status);
-#endif /* U_HIDE_INTERNAL_API */
friend class RBBIRuleBuilder;
* 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.
/**
* 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
*/
virtual void setText(UText *text, UErrorCode &status);
/**
- * Sets the current iteration position to the beginning of the text.
- * @return The offset of the beginning of the text.
+ * Sets the current iteration position to the beginning of the text, position zero.
+ * @return The offset of the beginning of the text, zero.
* @stable ICU 2.0
*/
virtual int32_t first(void);
*/
static UClassID U_EXPORT2 getStaticClassID(void);
- /*
+ /**
+ * Deprecated functionality. Use clone() instead.
+ *
* Create a clone (copy) of this break iterator in memory provided
* by the caller. The idea is to increase performance by avoiding
* a storage allocation. Use of this functoin is NOT RECOMMENDED.
* @return Pointer to the clone object. This may differ from the stackBuffer
* address if the byte alignment of the stack buffer was not suitable
* or if the stackBuffer was too small to hold the clone.
- * @stable ICU 2.0
+ * @deprecated ICU 52. Use clone() instead.
*/
virtual BreakIterator * createBufferClone(void *stackBuffer,
int32_t &BufferSize,
* @param status Receives errors detected by this function.
* @return *this
*
- * @draft ICU 49
+ * @stable ICU 49
*/
virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status);
+// The following was changed from protected to private per #12071.
+// However Apple code needs these, so change back to protected.
protected:
//=======================================================================
// implementation
* 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.
- * (Also used by DictionaryBasedBreakIterator::createBufferClone().)
* @internal
*/
void init();
-#endif /* U_HIDE_INTERNAL_API */
private:
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,
* @internal
*/
int32_t checkDictionary(int32_t startPos, int32_t endPos, UBool reverse);
-#endif /* U_HIDE_INTERNAL_API */
private:
}
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */