2003-04-23 23:03:45 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
|
|
|
* Copyright (C) 2003, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RUNARRAYS_H
|
|
|
|
|
|
|
|
#define __RUNARRAYS_H
|
|
|
|
|
|
|
|
#include "layout/LETypes.h"
|
|
|
|
#include "layout/LEFontInstance.h"
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#include "unicode/locid.h"
|
|
|
|
|
2003-04-29 18:41:56 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
/**
|
|
|
|
* The initial size of an array if it is unspecified.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
#define INITIAL_CAPACITY 16
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
#define CAPACITY_GROW_LIMIT 128
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The <code>RunArray</code> 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.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
class U_LAYOUTEX_API RunArray : public UObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct a <code>RunArray</code> object from a pre-existing
|
|
|
|
* array of limit indices.
|
|
|
|
*
|
|
|
|
* @param limits is an array of limit indices.
|
|
|
|
*
|
|
|
|
* @param count is the number of entries in the limit array.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
RunArray(const le_int32 *limits, le_int32 count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct an empty <code>RunArray</code> object. Clients can add limit
|
|
|
|
* indices array using the <code>add</code> method.
|
|
|
|
*
|
|
|
|
* @param initialCapacity is the initial size of the limit indices array. If
|
|
|
|
* this value is zero, no array will be allocated.
|
|
|
|
*
|
|
|
|
* @see add
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
RunArray(le_int32 initalCapacity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The destructor; virtual so that subclass destructors are invoked as well.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual ~RunArray();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of entries in the limit indices array.
|
|
|
|
*
|
|
|
|
* @return the number of entries in the limit indices array.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 getCount() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the last limit index. This is the number of characters in
|
|
|
|
* the text.
|
|
|
|
*
|
|
|
|
* @return the last limit index.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 getLimit() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the limit index for a particular run of text.
|
|
|
|
*
|
|
|
|
* @param run is the run. This is an index into the limit index array.
|
|
|
|
*
|
|
|
|
* @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 getLimit(le_int32 run) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 <code>init</code> method. If it is full, it will be grown by
|
|
|
|
* calling the <code>grow</code> method.
|
|
|
|
*
|
|
|
|
* If the <code>RunArray</code> 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 <code>add</code> method which takes a limit index along with whatever
|
|
|
|
* other data they implement. The new <code>add</code> method should
|
|
|
|
* first call this method to grow the data arrays, and use the return value
|
|
|
|
* to store the data in their own arrays.
|
|
|
|
*
|
|
|
|
* @param limit is the limit index to add to the array.
|
|
|
|
*
|
|
|
|
* @return the run index where the limit index was stored, or -1 if the limit index cannt be stored.
|
|
|
|
*
|
|
|
|
* @see init
|
|
|
|
* @see grow
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 add(le_int32 limit);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Create a data array with the given initial size. This method will be
|
|
|
|
* called by the <code>add</code> 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.
|
|
|
|
*
|
|
|
|
* @param capacity is the initial size of the data array.
|
|
|
|
*
|
|
|
|
* @see add
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual void init(le_int32 capacity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Grow a data array to the given initial size. This method will be
|
|
|
|
* called by the <code>add</code> 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.
|
|
|
|
*
|
|
|
|
* @param capacity is the initial size of the data array.
|
|
|
|
*
|
|
|
|
* @see add
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual void grow(le_int32 capacity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set by the constructors to indicate whether
|
|
|
|
* or not the client supplied the data arrays.
|
|
|
|
* If they were supplied by the client, the
|
|
|
|
* <code>add</code> method won't change the arrays
|
|
|
|
* and the destructor won't delete them.
|
2003-06-10 18:17:08 +00:00
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
2003-04-23 23:03:45 +00:00
|
|
|
*/
|
|
|
|
le_bool fClientArrays;
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* The address of this static class variable serves as this class's ID
|
|
|
|
* for ICU "poor man's RTTI".
|
|
|
|
*/
|
|
|
|
static const char fgClassID;
|
|
|
|
|
|
|
|
le_int32 ensureCapacity();
|
|
|
|
|
2003-05-09 20:37:58 +00:00
|
|
|
RunArray();
|
2003-05-22 21:56:57 +00:00
|
|
|
RunArray(const RunArray & /*other*/);
|
|
|
|
RunArray &operator=(const RunArray & /*other*/) { return *this; };
|
2003-05-09 20:37:58 +00:00
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
const le_int32 *fLimits;
|
|
|
|
le_int32 fCount;
|
|
|
|
le_int32 fCapacity;
|
|
|
|
};
|
|
|
|
|
2003-05-09 20:37:58 +00:00
|
|
|
inline RunArray::RunArray()
|
2003-12-08 23:00:58 +00:00
|
|
|
: UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
|
2003-05-09 20:37:58 +00:00
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
2003-05-22 21:56:57 +00:00
|
|
|
inline RunArray::RunArray(const RunArray & /*other*/)
|
2003-12-08 23:00:58 +00:00
|
|
|
: UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
|
2003-05-09 20:37:58 +00:00
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
inline RunArray::RunArray(const le_int32 *limits, le_int32 count)
|
2003-12-08 23:00:58 +00:00
|
|
|
: UObject(), fClientArrays(TRUE), fLimits(limits), fCount(count), fCapacity(count)
|
2003-04-23 23:03:45 +00:00
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
|
|
|
inline le_int32 RunArray::getCount() const
|
|
|
|
{
|
|
|
|
return fCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline le_int32 RunArray::getLimit(le_int32 run) const
|
|
|
|
{
|
|
|
|
if (run < 0 || run >= fCount) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return fLimits[run];
|
|
|
|
}
|
|
|
|
|
2003-05-22 21:56:57 +00:00
|
|
|
inline le_int32 RunArray::getLimit() const
|
|
|
|
{
|
|
|
|
return getLimit(fCount - 1);
|
|
|
|
}
|
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
/**
|
|
|
|
* The <code>FontRuns</code> class associates pointers to <code>LEFontInstance</code>
|
|
|
|
* objects with runs of text.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
class U_LAYOUTEX_API FontRuns : public RunArray
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct a <code>FontRuns</code> object from pre-existing arrays of fonts
|
|
|
|
* and limit indices.
|
|
|
|
*
|
|
|
|
* @param fonts is the address of an array of pointers to <code>LEFontInstance</code> objects.
|
|
|
|
*
|
|
|
|
* @param limits is the address of an array of limit indices.
|
|
|
|
*
|
|
|
|
* @param count is the number of entries in the two arrays.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct an empty <code>FontRuns</code> object. Clients can add font and limit
|
|
|
|
* indices arrays using the <code>add</code> method.
|
|
|
|
*
|
|
|
|
* @param initialCapacity is the initial size of the font and limit indices arrays. If
|
|
|
|
* this value is zero, no arrays will be allocated.
|
|
|
|
*
|
|
|
|
* @see add
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
FontRuns(le_int32 initialCapacity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The destructor; virtual so that subclass destructors are invoked as well.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual ~FontRuns();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the <code>LEFontInstance</code> object assoicated with the given run
|
|
|
|
* of text. Use <code>RunArray::getLimit(run)</code> to get the corresponding
|
|
|
|
* limit index.
|
|
|
|
*
|
|
|
|
* @param run is the index into the font and limit indices arrays.
|
|
|
|
*
|
|
|
|
* @return the <code>LEFontInstance</code> associated with the given text run.
|
|
|
|
*
|
|
|
|
* @see RunArray::getLimit
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
const LEFontInstance *getFont(le_int32 run) const;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an <code>LEFontInstance</code> and limit index pair to the data arrays and return
|
|
|
|
* the run index where the data was stored. This method calls
|
|
|
|
* <code>RunArray::add(limit)</code> which will create or grow the arrays as needed.
|
|
|
|
*
|
|
|
|
* If the <code>FontRuns</code> object was created with a client-supplied
|
|
|
|
* font and limit indices arrays, this method will return a run index of -1.
|
|
|
|
*
|
|
|
|
* Subclasses should not override this method. Rather they should provide a new <code>add</code>
|
|
|
|
* method which takes a font and a limit index along with whatever other data they implement.
|
|
|
|
* The new <code>add</code> method should first call this method to grow the font and limit indices
|
|
|
|
* arrays, and use the returned run index to store data their own arrays.
|
|
|
|
*
|
|
|
|
* @param font is the address of the <code>LEFontInstance</code> to add
|
|
|
|
*
|
|
|
|
* @param limit is the limit index to add
|
|
|
|
*
|
|
|
|
* @return the run index where the font and limit index were stored, or -1 if the data cannot be stored.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 add(const LEFontInstance *font, le_int32 limit);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void init(le_int32 capacity);
|
|
|
|
virtual void grow(le_int32 capacity);
|
|
|
|
|
|
|
|
private:
|
2003-05-09 20:37:58 +00:00
|
|
|
|
|
|
|
FontRuns();
|
|
|
|
FontRuns(const FontRuns &other);
|
2003-05-22 21:56:57 +00:00
|
|
|
FontRuns &operator=(const FontRuns & /*other*/) { return *this; };
|
2003-05-09 20:37:58 +00:00
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
/**
|
|
|
|
* The address of this static class variable serves as this class's ID
|
|
|
|
* for ICU "poor man's RTTI".
|
|
|
|
*/
|
|
|
|
static const char fgClassID;
|
|
|
|
|
|
|
|
const LEFontInstance **fFonts;
|
|
|
|
};
|
|
|
|
|
2003-05-09 20:37:58 +00:00
|
|
|
inline FontRuns::FontRuns()
|
|
|
|
: RunArray(0), fFonts(NULL)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
2003-05-22 21:56:57 +00:00
|
|
|
inline FontRuns::FontRuns(const FontRuns & /*other*/)
|
2003-05-09 20:37:58 +00:00
|
|
|
: RunArray(0), fFonts(NULL)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
2003-04-23 23:03:45 +00:00
|
|
|
|
|
|
|
inline FontRuns::FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count)
|
|
|
|
: RunArray(limits, count), fFonts(fonts)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The <code>LocaleRuns</code> class associates pointers to <code>Locale</code>
|
|
|
|
* objects with runs of text.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
class U_LAYOUTEX_API LocaleRuns : public RunArray
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct a <code>LocaleRuns</code> object from pre-existing arrays of locales
|
|
|
|
* and limit indices.
|
|
|
|
*
|
|
|
|
* @param locales is the address of an array of pointers to <code>Locale</code> objects.
|
|
|
|
*
|
|
|
|
* @param limits is the address of an array of limit indices.
|
|
|
|
*
|
|
|
|
* @param count is the number of entries in the two arrays.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct an empty <code>LocaleRuns</code> object. Clients can add locale and limit
|
|
|
|
* indices arrays using the <code>add</code> method.
|
|
|
|
*
|
|
|
|
* @param initialCapacity is the initial size of the locale and limit indices arrays. If
|
|
|
|
* this value is zero, no arrays will be allocated.
|
|
|
|
*
|
|
|
|
* @see add
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
LocaleRuns(le_int32 initialCapacity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The destructor; virtual so that subclass destructors are invoked as well.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual ~LocaleRuns();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the <code>Locale</code> object assoicated with the given run
|
|
|
|
* of text. Use <code>RunArray::getLimit(run)</code> to get the corresponding
|
|
|
|
* limit index.
|
|
|
|
*
|
|
|
|
* @param run is the index into the font and limit indices arrays.
|
|
|
|
*
|
|
|
|
* @return the <code>Locale</code> associated with the given text run.
|
|
|
|
*
|
|
|
|
* @see RunArray::getLimit
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
const Locale *getLocale(le_int32 run) const;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a <code>Locale</code> and limit index pair to the data arrays and return
|
|
|
|
* the run index where the data was stored. This method calls
|
|
|
|
* <code>RunArray::add(limit)</code> which will create or grow the arrays as needed.
|
|
|
|
*
|
|
|
|
* If the <code>LocaleRuns</code> object was created with a client-supplied
|
|
|
|
* locale and limit indices arrays, this method will return a run index of -1.
|
|
|
|
*
|
|
|
|
* Subclasses should not override this method. Rather they should provide a new <code>add</code>
|
|
|
|
* method which takes a locale and a limit index along with whatever other data they implement.
|
|
|
|
* The new <code>add</code> method should first call this method to grow the font and limit indices
|
|
|
|
* arrays, and use the returned run index to store data their own arrays.
|
|
|
|
*
|
|
|
|
* @param locale is the address of the <code>Locale</code> to add
|
|
|
|
*
|
|
|
|
* @param limit is the limit index to add
|
|
|
|
*
|
|
|
|
* @return the run index where the locale and limit index were stored, or -1 if the data cannot be stored.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 add(const Locale *locale, le_int32 limit);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void init(le_int32 capacity);
|
|
|
|
virtual void grow(le_int32 capacity);
|
|
|
|
|
|
|
|
private:
|
2003-05-09 20:37:58 +00:00
|
|
|
|
|
|
|
LocaleRuns();
|
|
|
|
LocaleRuns(const LocaleRuns &other);
|
2003-05-22 21:56:57 +00:00
|
|
|
LocaleRuns &operator=(const LocaleRuns & /*other*/) { return *this; };
|
2003-05-09 20:37:58 +00:00
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
};
|
|
|
|
|
2003-05-09 20:37:58 +00:00
|
|
|
inline LocaleRuns::LocaleRuns()
|
|
|
|
: RunArray(0), fLocales(NULL)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
2003-05-22 21:56:57 +00:00
|
|
|
inline LocaleRuns::LocaleRuns(const LocaleRuns & /*other*/)
|
2003-05-09 20:37:58 +00:00
|
|
|
: RunArray(0), fLocales(NULL)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
2003-04-23 23:03:45 +00:00
|
|
|
|
|
|
|
inline LocaleRuns::LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count)
|
|
|
|
: RunArray(limits, count), fLocales(locales)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The <code>ValueRuns</code> class associates integer values with runs of text.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
class U_LAYOUTEX_API ValueRuns : public RunArray
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct a <code>ValueRuns</code> object from pre-existing arrays of values
|
|
|
|
* and limit indices.
|
|
|
|
*
|
|
|
|
* @param values is the address of an array of integer.
|
|
|
|
*
|
|
|
|
* @param limits is the address of an array of limit indices.
|
|
|
|
*
|
|
|
|
* @param count is the number of entries in the two arrays.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct an empty <code>ValueRuns</code> object. Clients can add value and limit
|
|
|
|
* indices arrays using the <code>add</code> method.
|
|
|
|
*
|
|
|
|
* @param initialCapacity is the initial size of the value and limit indices arrays. If
|
|
|
|
* this value is zero, no arrays will be allocated.
|
|
|
|
*
|
|
|
|
* @see add
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
ValueRuns(le_int32 initialCapacity);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The destructor; virtual so that subclass destructors are invoked as well.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual ~ValueRuns();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the integer value assoicated with the given run
|
|
|
|
* of text. Use <code>RunArray::getLimit(run)</code> to get the corresponding
|
|
|
|
* limit index.
|
|
|
|
*
|
|
|
|
* @param run is the index into the font and limit indices arrays.
|
|
|
|
*
|
|
|
|
* @return the integer value associated with the given text run.
|
|
|
|
*
|
|
|
|
* @see RunArray::getLimit
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 getValue(le_int32 run) const;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an integer value and limit index pair to the data arrays and return
|
|
|
|
* the run index where the data was stored. This method calls
|
|
|
|
* <code>RunArray::add(limit)</code> which will create or grow the arrays as needed.
|
|
|
|
*
|
|
|
|
* If the <code>ValueRuns</code> object was created with a client-supplied
|
|
|
|
* font and limit indices arrays, this method will return a run index of -1.
|
|
|
|
*
|
|
|
|
* Subclasses should not override this method. Rather they should provide a new <code>add</code>
|
|
|
|
* method which takes an integer value and a limit index along with whatever other data they implement.
|
|
|
|
* The new <code>add</code> method should first call this method to grow the font and limit indices
|
|
|
|
* arrays, and use the returned run index to store data their own arrays.
|
|
|
|
*
|
|
|
|
* @param value is the integer value to add
|
|
|
|
*
|
|
|
|
* @param limit is the limit index to add
|
|
|
|
*
|
|
|
|
* @return the run index where the value and limit index were stored, or -1 if the data cannot be stored.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
le_int32 add(le_int32 value, le_int32 limit);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
|
|
*
|
|
|
|
* @draft ICU 2.6
|
|
|
|
*/
|
|
|
|
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void init(le_int32 capacity);
|
|
|
|
virtual void grow(le_int32 capacity);
|
|
|
|
|
|
|
|
private:
|
2003-05-09 20:37:58 +00:00
|
|
|
|
|
|
|
ValueRuns();
|
|
|
|
ValueRuns(const ValueRuns &other);
|
2003-05-22 21:56:57 +00:00
|
|
|
ValueRuns &operator=(const ValueRuns & /*other*/) { return *this; };
|
2003-05-09 20:37:58 +00:00
|
|
|
|
2003-04-23 23:03:45 +00:00
|
|
|
/**
|
|
|
|
* The address of this static class variable serves as this class's ID
|
|
|
|
* for ICU "poor man's RTTI".
|
|
|
|
*/
|
|
|
|
static const char fgClassID;
|
|
|
|
|
|
|
|
const le_int32 *fValues;
|
|
|
|
};
|
|
|
|
|
2003-05-09 20:37:58 +00:00
|
|
|
inline ValueRuns::ValueRuns()
|
|
|
|
: RunArray(0), fValues(NULL)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
2003-05-22 21:56:57 +00:00
|
|
|
inline ValueRuns::ValueRuns(const ValueRuns & /*other*/)
|
2003-05-09 20:37:58 +00:00
|
|
|
: RunArray(0), fValues(NULL)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
2003-04-23 23:03:45 +00:00
|
|
|
|
|
|
|
inline ValueRuns::ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count)
|
|
|
|
: RunArray(limits, count), fValues(values)
|
|
|
|
{
|
|
|
|
// nothing else to do...
|
|
|
|
}
|
|
|
|
|
2003-04-29 18:41:56 +00:00
|
|
|
U_NAMESPACE_END
|
2003-04-23 23:03:45 +00:00
|
|
|
#endif
|