X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..0f5d89e82340278ed3d7d50029f37cab2c41a57e:/icuSources/layoutex/layout/RunArrays.h?ds=inline
diff --git a/icuSources/layoutex/layout/RunArrays.h b/icuSources/layoutex/layout/RunArrays.h
index f745bd54..5cf6c60b 100644
--- a/icuSources/layoutex/layout/RunArrays.h
+++ b/icuSources/layoutex/layout/RunArrays.h
@@ -1,6 +1,8 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
- * Copyright (C) 2003-2004, International Business Machines
+ * Copyright (C) 2003-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@@ -15,12 +17,17 @@
#include "unicode/utypes.h"
#include "unicode/locid.h"
+/**
+ * \file
+ * \brief C++ API: base class for building classes which represent data that is associated with runs of text.
+ */
+
U_NAMESPACE_BEGIN
/**
* The initial size of an array if it is unspecified.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
#define INITIAL_CAPACITY 16
@@ -28,7 +35,7 @@ U_NAMESPACE_BEGIN
* When an array needs to grow, it will double in size until
* it becomes this large, then it will grow by this amount.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
#define CAPACITY_GROW_LIMIT 128
@@ -38,7 +45,7 @@ U_NAMESPACE_BEGIN
* maintains an array of limit indices into the text, subclasses
* provide one or more arrays of data.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
class U_LAYOUTEX_API RunArray : public UObject
{
@@ -52,9 +59,9 @@ public:
*
* @param count is the number of entries in the limit array.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- RunArray(const le_int32 *limits, le_int32 count);
+ inline RunArray(const le_int32 *limits, le_int32 count);
/**
* Construct an empty RunArray
object. Clients can add limit
@@ -65,14 +72,14 @@ public:
*
* @see add
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
RunArray(le_int32 initialCapacity);
/**
* The destructor; virtual so that subclass destructors are invoked as well.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
virtual ~RunArray();
@@ -81,9 +88,19 @@ public:
*
* @return the number of entries in the limit indices array.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
+ */
+ inline le_int32 getCount() const;
+
+ /**
+ * Reset the limit indices array. This method sets the number of entries in the
+ * limit indices array to zero. It does not delete the array.
+ *
+ * Note: Subclass arrays will also be reset and not deleted.
+ *
+ * @stable ICU 3.6
*/
- le_int32 getCount() const;
+ inline void reset();
/**
* Get the last limit index. This is the number of characters in
@@ -91,9 +108,9 @@ public:
*
* @return the last limit index.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- le_int32 getLimit() const;
+ inline le_int32 getLimit() const;
/**
* Get the limit index for a particular run of text.
@@ -102,9 +119,9 @@ public:
*
* @return the limit index for the run, or -1 if run
is out of bounds.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- le_int32 getLimit(le_int32 run) const;
+ inline le_int32 getLimit(le_int32 run) const;
/**
* Add a limit index to the limit indices array and return the run index
@@ -128,23 +145,23 @@ public:
* @see init
* @see grow
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
le_int32 add(le_int32 limit);
/**
- * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ * ICU "poor man's RTTI", returns a UClassID for this class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
+ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
/**
- * ICU "poor man's RTTI", returns a UClassID for this class.
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
+ virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
protected:
/**
@@ -157,7 +174,7 @@ protected:
*
* @see add
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
virtual void init(le_int32 capacity);
@@ -171,7 +188,7 @@ protected:
*
* @see add
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
virtual void grow(le_int32 capacity);
@@ -182,7 +199,7 @@ protected:
* add
method won't change the arrays
* and the destructor won't delete them.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
le_bool fClientArrays;
@@ -195,9 +212,9 @@ private:
le_int32 ensureCapacity();
- RunArray();
- RunArray(const RunArray & /*other*/);
- RunArray &operator=(const RunArray & /*other*/) { return *this; };
+ inline RunArray();
+ inline RunArray(const RunArray & /*other*/);
+ inline RunArray &operator=(const RunArray & /*other*/) { return *this; };
const le_int32 *fLimits;
le_int32 fCount;
@@ -227,6 +244,11 @@ inline le_int32 RunArray::getCount() const
return fCount;
}
+inline void RunArray::reset()
+{
+ fCount = 0;
+}
+
inline le_int32 RunArray::getLimit(le_int32 run) const
{
if (run < 0 || run >= fCount) {
@@ -245,7 +267,7 @@ inline le_int32 RunArray::getLimit() const
* The FontRuns
class associates pointers to LEFontInstance
* objects with runs of text.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
class U_LAYOUTEX_API FontRuns : public RunArray
{
@@ -263,9 +285,9 @@ public:
*
* @param count is the number of entries in the two arrays.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count);
+ inline FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count);
/**
* Construct an empty FontRuns
object. Clients can add font and limit
@@ -276,14 +298,14 @@ public:
*
* @see add
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
FontRuns(le_int32 initialCapacity);
/**
* The destructor; virtual so that subclass destructors are invoked as well.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
virtual ~FontRuns();
@@ -298,7 +320,7 @@ public:
*
* @see RunArray::getLimit
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
const LEFontInstance *getFont(le_int32 run) const;
@@ -323,23 +345,23 @@ public:
*
* @return the run index where the font and limit index were stored, or -1 if the data cannot be stored.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
le_int32 add(const LEFontInstance *font, le_int32 limit);
/**
- * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ * ICU "poor man's RTTI", returns a UClassID for this class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
+ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
/**
- * ICU "poor man's RTTI", returns a UClassID for this class.
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
+ virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
protected:
virtual void init(le_int32 capacity);
@@ -347,9 +369,9 @@ protected:
private:
- FontRuns();
- FontRuns(const FontRuns &other);
- FontRuns &operator=(const FontRuns & /*other*/) { return *this; };
+ inline FontRuns();
+ inline FontRuns(const FontRuns &other);
+ inline FontRuns &operator=(const FontRuns & /*other*/) { return *this; };
/**
* The address of this static class variable serves as this class's ID
@@ -382,7 +404,7 @@ inline FontRuns::FontRuns(const LEFontInstance **fonts, const le_int32 *limits,
* The LocaleRuns
class associates pointers to Locale
* objects with runs of text.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
class U_LAYOUTEX_API LocaleRuns : public RunArray
{
@@ -400,9 +422,9 @@ public:
*
* @param count is the number of entries in the two arrays.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count);
+ inline LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count);
/**
* Construct an empty LocaleRuns
object. Clients can add locale and limit
@@ -413,14 +435,14 @@ public:
*
* @see add
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
LocaleRuns(le_int32 initialCapacity);
/**
* The destructor; virtual so that subclass destructors are invoked as well.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
virtual ~LocaleRuns();
@@ -435,7 +457,7 @@ public:
*
* @see RunArray::getLimit
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
const Locale *getLocale(le_int32 run) const;
@@ -460,41 +482,44 @@ public:
*
* @return the run index where the locale and limit index were stored, or -1 if the data cannot be stored.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
le_int32 add(const Locale *locale, le_int32 limit);
/**
- * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ * ICU "poor man's RTTI", returns a UClassID for this class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
+ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
/**
- * ICU "poor man's RTTI", returns a UClassID for this class.
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
+ virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
protected:
virtual void init(le_int32 capacity);
virtual void grow(le_int32 capacity);
+ /**
+ * @internal
+ */
+ const Locale **fLocales;
+
private:
- LocaleRuns();
- LocaleRuns(const LocaleRuns &other);
- LocaleRuns &operator=(const LocaleRuns & /*other*/) { return *this; };
+ inline LocaleRuns();
+ inline LocaleRuns(const LocaleRuns &other);
+ inline LocaleRuns &operator=(const LocaleRuns & /*other*/) { return *this; };
/**
* The address of this static class variable serves as this class's ID
* for ICU "poor man's RTTI".
*/
static const char fgClassID;
-
- const Locale **fLocales;
};
inline LocaleRuns::LocaleRuns()
@@ -518,7 +543,7 @@ inline LocaleRuns::LocaleRuns(const Locale **locales, const le_int32 *limits, le
/**
* The ValueRuns
class associates integer values with runs of text.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
class U_LAYOUTEX_API ValueRuns : public RunArray
{
@@ -535,9 +560,9 @@ public:
*
* @param count is the number of entries in the two arrays.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count);
+ inline ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count);
/**
* Construct an empty ValueRuns
object. Clients can add value and limit
@@ -548,14 +573,14 @@ public:
*
* @see add
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
ValueRuns(le_int32 initialCapacity);
/**
* The destructor; virtual so that subclass destructors are invoked as well.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
virtual ~ValueRuns();
@@ -570,7 +595,7 @@ public:
*
* @see RunArray::getLimit
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
le_int32 getValue(le_int32 run) const;
@@ -594,23 +619,23 @@ public:
*
* @return the run index where the value and limit index were stored, or -1 if the data cannot be stored.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
le_int32 add(le_int32 value, le_int32 limit);
/**
- * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ * ICU "poor man's RTTI", returns a UClassID for this class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
+ static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
/**
- * ICU "poor man's RTTI", returns a UClassID for this class.
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
*
- * @draft ICU 2.6
+ * @stable ICU 3.2
*/
- static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
+ virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
protected:
virtual void init(le_int32 capacity);
@@ -618,9 +643,9 @@ protected:
private:
- ValueRuns();
- ValueRuns(const ValueRuns &other);
- ValueRuns &operator=(const ValueRuns & /*other*/) { return *this; };
+ inline ValueRuns();
+ inline ValueRuns(const ValueRuns &other);
+ inline ValueRuns &operator=(const ValueRuns & /*other*/) { return *this; };
/**
* The address of this static class variable serves as this class's ID