ICU 72.1 72.1
|
The RunArray
class is a base class for building classes which represent data that is associated with runs of text.
More...
#include <RunArrays.h>
Public Member Functions | |
RunArray (const le_int32 *limits, le_int32 count) | |
Construct a RunArray object from a pre-existing array of limit indices. More... | |
RunArray (le_int32 initialCapacity) | |
Construct an empty RunArray object. More... | |
virtual | ~RunArray () |
The destructor; virtual so that subclass destructors are invoked as well. More... | |
le_int32 | getCount () const |
Get the number of entries in the limit indices array. More... | |
void | reset () |
Reset the limit indices array. More... | |
le_int32 | getLimit () const |
Get the last limit index. More... | |
le_int32 | getLimit (le_int32 run) const |
Get the limit index for a particular run of text. More... | |
le_int32 | add (le_int32 limit) |
Add a limit index to the limit indices array and return the run index where it was stored. More... | |
virtual UClassID | getDynamicClassID () const |
ICU "poor man's RTTI", returns a UClassID for the actual class. More... | |
Public Member Functions inherited from icu::UObject | |
virtual | ~UObject () |
Destructor. More... | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More... | |
Static Public Member Functions | |
static UClassID | getStaticClassID () |
ICU "poor man's RTTI", returns a UClassID for this class. More... | |
Protected Member Functions | |
virtual void | init (le_int32 capacity) |
Create a data array with the given initial size. More... | |
virtual void | grow (le_int32 capacity) |
Grow a data array to the given initial size. More... | |
Protected Attributes | |
le_bool | fClientArrays |
Set by the constructors to indicate whether or not the client supplied the data arrays. More... | |
The RunArray
class is a base class for building classes which represent data that is associated with runs of text.
This class maintains an array of limit indices into the text, subclasses provide one or more arrays of data.
Definition at line 50 of file RunArrays.h.
|
inline |
Construct a RunArray
object from a pre-existing array of limit indices.
limits | is an array of limit indices. This array must remain valid until the RunArray object is destroyed. |
count | is the number of entries in the limit array. |
Definition at line 236 of file RunArrays.h.
icu::RunArray::RunArray | ( | le_int32 | initialCapacity | ) |
|
virtual |
The destructor; virtual so that subclass destructors are invoked as well.
le_int32 icu::RunArray::add | ( | le_int32 | limit | ) |
Add a limit index to the limit indices array and return the run index where it was stored.
If the array does not exist, it will be created by calling the init
method. If it is full, it will be grown by calling the grow
method.
If the RunArray
object was created with a client-supplied limit indices array, this method will return a run index of -1.
Subclasses should not override this method. Rather they should provide a new add
method which takes a limit index along with whatever other data they implement. The new add
method should first call this method to grow the data arrays, and use the return value to store the data in their own arrays.
limit | is the limit index to add to the array. |
|
inline |
Get the number of entries in the limit indices array.
Definition at line 242 of file RunArrays.h.
|
inlinevirtual |
ICU "poor man's RTTI", returns a UClassID for the actual class.
Reimplemented from icu::UObject.
Reimplemented in icu::FontRuns, icu::LocaleRuns, and icu::ValueRuns.
Definition at line 164 of file RunArrays.h.
|
inline |
Get the last limit index.
This is the number of characters in the text.
Definition at line 261 of file RunArrays.h.
References getLimit().
Referenced by getLimit().
|
inline |
Get the limit index for a particular run of text.
run | is the run. This is an index into the limit index array. |
run
is out of bounds.Definition at line 252 of file RunArrays.h.
|
inlinestatic |
ICU "poor man's RTTI", returns a UClassID for this class.
Definition at line 157 of file RunArrays.h.
|
protectedvirtual |
Grow a data array to the given initial size.
This method will be called by the add
method if the limit indices array is full. Subclasses which override this method must also call it from the overriding method to grow the limit indices array.
capacity | is the initial size of the data array. |
Reimplemented in icu::FontRuns, icu::LocaleRuns, and icu::ValueRuns.
|
protectedvirtual |
Create a data array with the given initial size.
This method will be called by the add
method if there is no limit indices array. Subclasses which override this method must also call it from the overriding method to create the limit indices array.
capacity | is the initial size of the data array. |
Reimplemented in icu::FontRuns, icu::LocaleRuns, and icu::ValueRuns.
|
inline |
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.
Definition at line 247 of file RunArrays.h.
|
protected |
Set by the constructors to indicate whether or not the client supplied the data arrays.
If they were supplied by the client, the add
method won't change the arrays and the destructor won't delete them.
Definition at line 204 of file RunArrays.h.