RunArrays.h revision 85bf2e2fbc60a9f938064abc8127d61da7d19882
1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************** 385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Copyright (C) 2003-2008, International Business Machines 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Corporation and others. All Rights Reserved. 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************** 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef __RUNARRAYS_H 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define __RUNARRAYS_H 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "layout/LETypes.h" 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "layout/LEFontInstance.h" 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/locid.h" 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: base class for building classes which represent data that is associated with runs of text. 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The initial size of an array if it is unspecified. 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define INITIAL_CAPACITY 16 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * When an array needs to grow, it will double in size until 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * it becomes this large, then it will grow by this amount. 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define CAPACITY_GROW_LIMIT 128 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The <code>RunArray</code> class is a base class for building classes 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * which represent data that is associated with runs of text. This class 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maintains an array of limit indices into the text, subclasses 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * provide one or more arrays of data. 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_LAYOUTEX_API RunArray : public UObject 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a <code>RunArray</code> object from a pre-existing 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * array of limit indices. 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limits is an array of limit indices. This array must remain 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * valid until the <code>RunArray</code> object is destroyed. 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param count is the number of entries in the limit array. 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline RunArray(const le_int32 *limits, le_int32 count); 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct an empty <code>RunArray</code> object. Clients can add limit 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indices array using the <code>add</code> method. 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param initialCapacity is the initial size of the limit indices array. If 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this value is zero, no array will be allocated. 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see add 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru RunArray(le_int32 initialCapacity); 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The destructor; virtual so that subclass destructors are invoked as well. 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~RunArray(); 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the number of entries in the limit indices array. 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of entries in the limit indices array. 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline le_int32 getCount() const; 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Reset the limit indices array. This method sets the number of entries in the 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * limit indices array to zero. It does not delete the array. 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note: Subclass arrays will also be reset and not deleted. 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.6 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline void reset(); 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the last limit index. This is the number of characters in 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the text. 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the last limit index. 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline le_int32 getLimit() const; 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the limit index for a particular run of text. 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param run is the run. This is an index into the limit index array. 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the limit index for the run, or -1 if <code>run</code> is out of bounds. 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline le_int32 getLimit(le_int32 run) const; 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Add a limit index to the limit indices array and return the run index 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * where it was stored. If the array does not exist, it will be created by 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * calling the <code>init</code> method. If it is full, it will be grown by 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * calling the <code>grow</code> method. 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If the <code>RunArray</code> object was created with a client-supplied 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * limit indices array, this method will return a run index of -1. 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses should not override this method. Rather they should provide 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a new <code>add</code> method which takes a limit index along with whatever 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * other data they implement. The new <code>add</code> method should 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * first call this method to grow the data arrays, and use the return value 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to store the data in their own arrays. 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limit is the limit index to add to the array. 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the run index where the limit index was stored, or -1 if the limit index cannt be stored. 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see init 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see grow 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 add(le_int32 limit); 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected: 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a data array with the given initial size. This method will be 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * called by the <code>add</code> method if there is no limit indices 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * array. Subclasses which override this method must also call it from 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the overriding method to create the limit indices array. 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param capacity is the initial size of the data array. 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see add 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void init(le_int32 capacity); 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Grow a data array to the given initial size. This method will be 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * called by the <code>add</code> method if the limit indices 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * array is full. Subclasses which override this method must also call it from 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the overriding method to grow the limit indices array. 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param capacity is the initial size of the data array. 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see add 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void grow(le_int32 capacity); 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set by the constructors to indicate whether 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * or not the client supplied the data arrays. 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If they were supplied by the client, the 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>add</code> method won't change the arrays 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and the destructor won't delete them. 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_bool fClientArrays; 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The address of this static class variable serves as this class's ID 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for ICU "poor man's RTTI". 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const char fgClassID; 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 ensureCapacity(); 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline RunArray(); 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline RunArray(const RunArray & /*other*/); 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline RunArray &operator=(const RunArray & /*other*/) { return *this; }; 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const le_int32 *fLimits; 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 fCount; 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 fCapacity; 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline RunArray::RunArray() 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0) 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline RunArray::RunArray(const RunArray & /*other*/) 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0) 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline RunArray::RunArray(const le_int32 *limits, le_int32 count) 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : UObject(), fClientArrays(TRUE), fLimits(limits), fCount(count), fCapacity(count) 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline le_int32 RunArray::getCount() const 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fCount; 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline void RunArray::reset() 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fCount = 0; 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline le_int32 RunArray::getLimit(le_int32 run) const 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (run < 0 || run >= fCount) { 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return -1; 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fLimits[run]; 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline le_int32 RunArray::getLimit() const 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return getLimit(fCount - 1); 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The <code>FontRuns</code> class associates pointers to <code>LEFontInstance</code> 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * objects with runs of text. 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_LAYOUTEX_API FontRuns : public RunArray 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a <code>FontRuns</code> object from pre-existing arrays of fonts 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and limit indices. 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param fonts is the address of an array of pointers to <code>LEFontInstance</code> objects. This 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * array, and the <code>LEFontInstance</code> objects to which it points must remain 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * valid until the <code>FontRuns</code> object is destroyed. 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limits is the address of an array of limit indices. This array must remain valid until 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the <code>FontRuns</code> object is destroyed. 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param count is the number of entries in the two arrays. 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count); 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct an empty <code>FontRuns</code> object. Clients can add font and limit 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indices arrays using the <code>add</code> method. 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param initialCapacity is the initial size of the font and limit indices arrays. If 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this value is zero, no arrays will be allocated. 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see add 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FontRuns(le_int32 initialCapacity); 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The destructor; virtual so that subclass destructors are invoked as well. 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~FontRuns(); 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the <code>LEFontInstance</code> object assoicated with the given run 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of text. Use <code>RunArray::getLimit(run)</code> to get the corresponding 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * limit index. 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param run is the index into the font and limit indices arrays. 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the <code>LEFontInstance</code> associated with the given text run. 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see RunArray::getLimit 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const LEFontInstance *getFont(le_int32 run) const; 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Add an <code>LEFontInstance</code> and limit index pair to the data arrays and return 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the run index where the data was stored. This method calls 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>RunArray::add(limit)</code> which will create or grow the arrays as needed. 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If the <code>FontRuns</code> object was created with a client-supplied 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font and limit indices arrays, this method will return a run index of -1. 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses should not override this method. Rather they should provide a new <code>add</code> 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method which takes a font and a limit index along with whatever other data they implement. 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The new <code>add</code> method should first call this method to grow the font and limit indices 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * arrays, and use the returned run index to store data their own arrays. 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param font is the address of the <code>LEFontInstance</code> to add. This object must 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * remain valid until the <code>FontRuns</code> object is destroyed. 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limit is the limit index to add 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the run index where the font and limit index were stored, or -1 if the data cannot be stored. 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 add(const LEFontInstance *font, le_int32 limit); 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected: 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void init(le_int32 capacity); 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void grow(le_int32 capacity); 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline FontRuns(); 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline FontRuns(const FontRuns &other); 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline FontRuns &operator=(const FontRuns & /*other*/) { return *this; }; 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The address of this static class variable serves as this class's ID 376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for ICU "poor man's RTTI". 377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const char fgClassID; 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const LEFontInstance **fFonts; 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline FontRuns::FontRuns() 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(0), fFonts(NULL) 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline FontRuns::FontRuns(const FontRuns & /*other*/) 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(0), fFonts(NULL) 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline FontRuns::FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count) 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(limits, count), fFonts(fonts) 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The <code>LocaleRuns</code> class associates pointers to <code>Locale</code> 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * objects with runs of text. 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_LAYOUTEX_API LocaleRuns : public RunArray 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a <code>LocaleRuns</code> object from pre-existing arrays of locales 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and limit indices. 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param locales is the address of an array of pointers to <code>Locale</code> objects. This array, 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and the <code>Locale</code> objects to which it points, must remain valid until 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the <code>LocaleRuns</code> object is destroyed. 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limits is the address of an array of limit indices. This array must remain valid until the 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>LocaleRuns</code> object is destroyed. 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param count is the number of entries in the two arrays. 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count); 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct an empty <code>LocaleRuns</code> object. Clients can add locale and limit 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indices arrays using the <code>add</code> method. 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param initialCapacity is the initial size of the locale and limit indices arrays. If 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this value is zero, no arrays will be allocated. 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see add 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LocaleRuns(le_int32 initialCapacity); 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The destructor; virtual so that subclass destructors are invoked as well. 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~LocaleRuns(); 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the <code>Locale</code> object assoicated with the given run 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of text. Use <code>RunArray::getLimit(run)</code> to get the corresponding 450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * limit index. 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param run is the index into the font and limit indices arrays. 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the <code>Locale</code> associated with the given text run. 455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see RunArray::getLimit 457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const Locale *getLocale(le_int32 run) const; 461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Add a <code>Locale</code> and limit index pair to the data arrays and return 465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the run index where the data was stored. This method calls 466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>RunArray::add(limit)</code> which will create or grow the arrays as needed. 467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If the <code>LocaleRuns</code> object was created with a client-supplied 469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale and limit indices arrays, this method will return a run index of -1. 470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses should not override this method. Rather they should provide a new <code>add</code> 472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method which takes a locale and a limit index along with whatever other data they implement. 473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The new <code>add</code> method should first call this method to grow the font and limit indices 474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * arrays, and use the returned run index to store data their own arrays. 475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param locale is the address of the <code>Locale</code> to add. This object must remain valid 477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * until the <code>LocaleRuns</code> object is destroyed. 478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limit is the limit index to add 480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the run index where the locale and limit index were stored, or -1 if the data cannot be stored. 482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 add(const Locale *locale, le_int32 limit); 486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } 493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } 500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected: 502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void init(le_int32 capacity); 503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void grow(le_int32 capacity); 504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 50585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 50685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @internal 50785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const Locale **fLocales; 509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline LocaleRuns(); 513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline LocaleRuns(const LocaleRuns &other); 514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline LocaleRuns &operator=(const LocaleRuns & /*other*/) { return *this; }; 515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The address of this static class variable serves as this class's ID 518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for ICU "poor man's RTTI". 519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const char fgClassID; 521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline LocaleRuns::LocaleRuns() 524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(0), fLocales(NULL) 525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline LocaleRuns::LocaleRuns(const LocaleRuns & /*other*/) 530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(0), fLocales(NULL) 531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline LocaleRuns::LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count) 536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(limits, count), fLocales(locales) 537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The <code>ValueRuns</code> class associates integer values with runs of text. 543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_LAYOUTEX_API ValueRuns : public RunArray 547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a <code>ValueRuns</code> object from pre-existing arrays of values 551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and limit indices. 552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param values is the address of an array of integer. This array must remain valid until 554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the <code>ValueRuns</code> object is destroyed. 555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limits is the address of an array of limit indices. This array must remain valid until 557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the <code>ValueRuns</code> object is destroyed. 558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param count is the number of entries in the two arrays. 560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count); 564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct an empty <code>ValueRuns</code> object. Clients can add value and limit 567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indices arrays using the <code>add</code> method. 568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param initialCapacity is the initial size of the value and limit indices arrays. If 570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this value is zero, no arrays will be allocated. 571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see add 573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ValueRuns(le_int32 initialCapacity); 577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The destructor; virtual so that subclass destructors are invoked as well. 580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~ValueRuns(); 584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the integer value assoicated with the given run 587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of text. Use <code>RunArray::getLimit(run)</code> to get the corresponding 588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * limit index. 589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param run is the index into the font and limit indices arrays. 591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the integer value associated with the given text run. 593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see RunArray::getLimit 595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 getValue(le_int32 run) const; 599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Add an integer value and limit index pair to the data arrays and return 603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the run index where the data was stored. This method calls 604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>RunArray::add(limit)</code> which will create or grow the arrays as needed. 605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If the <code>ValueRuns</code> object was created with a client-supplied 607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * font and limit indices arrays, this method will return a run index of -1. 608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Subclasses should not override this method. Rather they should provide a new <code>add</code> 610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method which takes an integer value and a limit index along with whatever other data they implement. 611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The new <code>add</code> method should first call this method to grow the font and limit indices 612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * arrays, and use the returned run index to store data their own arrays. 613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param value is the integer value to add 615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param limit is the limit index to add 617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the run index where the value and limit index were stored, or -1 if the data cannot be stored. 619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru le_int32 add(le_int32 value, le_int32 limit); 623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for this class. 626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } 630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ICU "poor man's RTTI", returns a UClassID for the actual class. 633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.2 635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } 637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected: 639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void init(le_int32 capacity); 640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void grow(le_int32 capacity); 641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline ValueRuns(); 645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline ValueRuns(const ValueRuns &other); 646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline ValueRuns &operator=(const ValueRuns & /*other*/) { return *this; }; 647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The address of this static class variable serves as this class's ID 650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for ICU "poor man's RTTI". 651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const char fgClassID; 653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const le_int32 *fValues; 655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline ValueRuns::ValueRuns() 658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(0), fValues(NULL) 659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline ValueRuns::ValueRuns(const ValueRuns & /*other*/) 664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(0), fValues(NULL) 665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline ValueRuns::ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count) 670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru : RunArray(limits, count), fValues(values) 671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do... 673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 677