00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __RUNARRAYS_H
00011
00012 #define __RUNARRAYS_H
00013
00014 #include "layout/LETypes.h"
00015 #include "layout/LEFontInstance.h"
00016
00017 #include "unicode/utypes.h"
00018 #include "unicode/locid.h"
00019
00025 U_NAMESPACE_BEGIN
00026
00032 #define INITIAL_CAPACITY 16
00033
00040 #define CAPACITY_GROW_LIMIT 128
00041
00050 class U_LAYOUTEX_API RunArray : public UObject
00051 {
00052 public:
00064 inline RunArray(const le_int32 *limits, le_int32 count);
00065
00077 RunArray(le_int32 initialCapacity);
00078
00084 virtual ~RunArray();
00085
00093 inline le_int32 getCount() const;
00094
00103 inline void reset();
00104
00113 inline le_int32 getLimit() const;
00114
00124 inline le_int32 getLimit(le_int32 run) const;
00125
00150 le_int32 add(le_int32 limit);
00151
00157 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00158
00164 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00165
00166 protected:
00179 virtual void init(le_int32 capacity);
00180
00193 virtual void grow(le_int32 capacity);
00194
00204 le_bool fClientArrays;
00205
00206 private:
00211 static const char fgClassID;
00212
00213 le_int32 ensureCapacity();
00214
00215 inline RunArray();
00216 inline RunArray(const RunArray & );
00217 inline RunArray &operator=(const RunArray & ) { return *this; };
00218
00219 const le_int32 *fLimits;
00220 le_int32 fCount;
00221 le_int32 fCapacity;
00222 };
00223
00224 inline RunArray::RunArray()
00225 : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
00226 {
00227
00228 }
00229
00230 inline RunArray::RunArray(const RunArray & )
00231 : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
00232 {
00233
00234 }
00235
00236 inline RunArray::RunArray(const le_int32 *limits, le_int32 count)
00237 : UObject(), fClientArrays(TRUE), fLimits(limits), fCount(count), fCapacity(count)
00238 {
00239
00240 }
00241
00242 inline le_int32 RunArray::getCount() const
00243 {
00244 return fCount;
00245 }
00246
00247 inline void RunArray::reset()
00248 {
00249 fCount = 0;
00250 }
00251
00252 inline le_int32 RunArray::getLimit(le_int32 run) const
00253 {
00254 if (run < 0 || run >= fCount) {
00255 return -1;
00256 }
00257
00258 return fLimits[run];
00259 }
00260
00261 inline le_int32 RunArray::getLimit() const
00262 {
00263 return getLimit(fCount - 1);
00264 }
00265
00272 class U_LAYOUTEX_API FontRuns : public RunArray
00273 {
00274 public:
00290 inline FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count);
00291
00303 FontRuns(le_int32 initialCapacity);
00304
00310 virtual ~FontRuns();
00311
00325 const LEFontInstance *getFont(le_int32 run) const;
00326
00327
00350 le_int32 add(const LEFontInstance *font, le_int32 limit);
00351
00357 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00358
00364 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00365
00366 protected:
00367 virtual void init(le_int32 capacity);
00368 virtual void grow(le_int32 capacity);
00369
00370 private:
00371
00372 inline FontRuns();
00373 inline FontRuns(const FontRuns &other);
00374 inline FontRuns &operator=(const FontRuns & ) { return *this; };
00375
00380 static const char fgClassID;
00381
00382 const LEFontInstance **fFonts;
00383 };
00384
00385 inline FontRuns::FontRuns()
00386 : RunArray(0), fFonts(NULL)
00387 {
00388
00389 }
00390
00391 inline FontRuns::FontRuns(const FontRuns & )
00392 : RunArray(0), fFonts(NULL)
00393 {
00394
00395 }
00396
00397 inline FontRuns::FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count)
00398 : RunArray(limits, count), fFonts(fonts)
00399 {
00400
00401 }
00402
00409 class U_LAYOUTEX_API LocaleRuns : public RunArray
00410 {
00411 public:
00427 inline LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count);
00428
00440 LocaleRuns(le_int32 initialCapacity);
00441
00447 virtual ~LocaleRuns();
00448
00462 const Locale *getLocale(le_int32 run) const;
00463
00464
00487 le_int32 add(const Locale *locale, le_int32 limit);
00488
00494 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00495
00501 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00502
00503 protected:
00504 virtual void init(le_int32 capacity);
00505 virtual void grow(le_int32 capacity);
00506
00510 const Locale **fLocales;
00511
00512 private:
00513
00514 inline LocaleRuns();
00515 inline LocaleRuns(const LocaleRuns &other);
00516 inline LocaleRuns &operator=(const LocaleRuns & ) { return *this; };
00517
00522 static const char fgClassID;
00523 };
00524
00525 inline LocaleRuns::LocaleRuns()
00526 : RunArray(0), fLocales(NULL)
00527 {
00528
00529 }
00530
00531 inline LocaleRuns::LocaleRuns(const LocaleRuns & )
00532 : RunArray(0), fLocales(NULL)
00533 {
00534
00535 }
00536
00537 inline LocaleRuns::LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count)
00538 : RunArray(limits, count), fLocales(locales)
00539 {
00540
00541 }
00542
00548 class U_LAYOUTEX_API ValueRuns : public RunArray
00549 {
00550 public:
00565 inline ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count);
00566
00578 ValueRuns(le_int32 initialCapacity);
00579
00585 virtual ~ValueRuns();
00586
00600 le_int32 getValue(le_int32 run) const;
00601
00602
00624 le_int32 add(le_int32 value, le_int32 limit);
00625
00631 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00632
00638 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00639
00640 protected:
00641 virtual void init(le_int32 capacity);
00642 virtual void grow(le_int32 capacity);
00643
00644 private:
00645
00646 inline ValueRuns();
00647 inline ValueRuns(const ValueRuns &other);
00648 inline ValueRuns &operator=(const ValueRuns & ) { return *this; };
00649
00654 static const char fgClassID;
00655
00656 const le_int32 *fValues;
00657 };
00658
00659 inline ValueRuns::ValueRuns()
00660 : RunArray(0), fValues(NULL)
00661 {
00662
00663 }
00664
00665 inline ValueRuns::ValueRuns(const ValueRuns & )
00666 : RunArray(0), fValues(NULL)
00667 {
00668
00669 }
00670
00671 inline ValueRuns::ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count)
00672 : RunArray(limits, count), fValues(values)
00673 {
00674
00675 }
00676
00677 U_NAMESPACE_END
00678 #endif