RunArrays.h

Go to the documentation of this file.
00001 /*
00002  **********************************************************************
00003  *   Copyright (C) 2003-2005, International Business Machines
00004  *   Corporation and others.  All Rights Reserved.
00005  **********************************************************************
00006  */
00007 
00008 #ifndef __RUNARRAYS_H
00009 
00010 #define __RUNARRAYS_H
00011 
00012 #include "layout/LETypes.h"
00013 #include "layout/LEFontInstance.h"
00014 
00015 #include "unicode/utypes.h"
00016 #include "unicode/locid.h"
00017 
00023 U_NAMESPACE_BEGIN
00024 
00030 #define INITIAL_CAPACITY 16
00031 
00038 #define CAPACITY_GROW_LIMIT 128
00039 
00048 class U_LAYOUTEX_API RunArray : public UObject
00049 {
00050 public:
00062     inline RunArray(const le_int32 *limits, le_int32 count);
00063 
00075     RunArray(le_int32 initialCapacity);
00076 
00082     virtual ~RunArray();
00083 
00091     inline le_int32 getCount() const;
00092 
00101     inline void reset();
00102 
00111     inline le_int32 getLimit() const;
00112 
00122     inline le_int32 getLimit(le_int32 run) const;
00123 
00148     le_int32 add(le_int32 limit);
00149 
00155     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00156 
00162     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00163 
00164 protected:
00177     virtual void init(le_int32 capacity);
00178 
00191     virtual void grow(le_int32 capacity);
00192 
00202     le_bool fClientArrays;
00203 
00204 private:
00209     static const char fgClassID;
00210 
00211     le_int32 ensureCapacity();
00212 
00213     inline RunArray();
00214     inline RunArray(const RunArray & /*other*/);
00215     inline RunArray &operator=(const RunArray & /*other*/) { return *this; };
00216 
00217     const le_int32 *fLimits;
00218           le_int32  fCount;
00219           le_int32  fCapacity;
00220 };
00221 
00222 inline RunArray::RunArray()
00223     : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
00224 {
00225     // nothing else to do...
00226 }
00227 
00228 inline RunArray::RunArray(const RunArray & /*other*/)
00229     : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
00230 {
00231     // nothing else to do...
00232 }
00233 
00234 inline RunArray::RunArray(const le_int32 *limits, le_int32 count)
00235     : UObject(), fClientArrays(TRUE), fLimits(limits), fCount(count), fCapacity(count)
00236 {
00237     // nothing else to do...
00238 }
00239 
00240 inline le_int32 RunArray::getCount() const
00241 {
00242     return fCount;
00243 }
00244 
00245 inline void RunArray::reset()
00246 {
00247     fCount = 0;
00248 }
00249 
00250 inline le_int32 RunArray::getLimit(le_int32 run) const
00251 {
00252     if (run < 0 || run >= fCount) {
00253         return -1;
00254     }
00255 
00256     return fLimits[run];
00257 }
00258 
00259 inline le_int32 RunArray::getLimit() const
00260 {
00261     return getLimit(fCount - 1);
00262 }
00263 
00270 class U_LAYOUTEX_API FontRuns : public RunArray
00271 {
00272 public:
00288     inline FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count);
00289 
00301     FontRuns(le_int32 initialCapacity);
00302 
00308     virtual ~FontRuns();
00309 
00323     const LEFontInstance *getFont(le_int32 run) const;
00324 
00325 
00348     le_int32 add(const LEFontInstance *font, le_int32 limit);
00349 
00355     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00356 
00362     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00363 
00364 protected:
00365     virtual void init(le_int32 capacity);
00366     virtual void grow(le_int32 capacity);
00367 
00368 private:
00369 
00370     inline FontRuns();
00371     inline FontRuns(const FontRuns &other);
00372     inline FontRuns &operator=(const FontRuns & /*other*/) { return *this; };
00373 
00378     static const char fgClassID;
00379 
00380     const LEFontInstance **fFonts;
00381 };
00382 
00383 inline FontRuns::FontRuns()
00384     : RunArray(0), fFonts(NULL)
00385 {
00386     // nothing else to do...
00387 }
00388 
00389 inline FontRuns::FontRuns(const FontRuns & /*other*/)
00390     : RunArray(0), fFonts(NULL)
00391 {
00392     // nothing else to do...
00393 }
00394 
00395 inline FontRuns::FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count)
00396     : RunArray(limits, count), fFonts(fonts)
00397 {
00398     // nothing else to do...
00399 }
00400 
00407 class U_LAYOUTEX_API LocaleRuns : public RunArray
00408 {
00409 public:
00425     inline LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count);
00426 
00438     LocaleRuns(le_int32 initialCapacity);
00439 
00445     virtual ~LocaleRuns();
00446 
00460     const Locale *getLocale(le_int32 run) const;
00461 
00462 
00485     le_int32 add(const Locale *locale, le_int32 limit);
00486 
00492     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00493 
00499     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00500 
00501 protected:
00502     virtual void init(le_int32 capacity);
00503     virtual void grow(le_int32 capacity);
00504 
00505 private:
00506 
00507     inline LocaleRuns();
00508     inline LocaleRuns(const LocaleRuns &other);
00509     inline LocaleRuns &operator=(const LocaleRuns & /*other*/) { return *this; };
00510 
00515     static const char fgClassID;
00516 
00517     const Locale **fLocales;
00518 };
00519 
00520 inline LocaleRuns::LocaleRuns()
00521     : RunArray(0), fLocales(NULL)
00522 {
00523     // nothing else to do...
00524 }
00525 
00526 inline LocaleRuns::LocaleRuns(const LocaleRuns & /*other*/)
00527     : RunArray(0), fLocales(NULL)
00528 {
00529     // nothing else to do...
00530 }
00531 
00532 inline LocaleRuns::LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count)
00533     : RunArray(limits, count), fLocales(locales)
00534 {
00535     // nothing else to do...
00536 }
00537 
00543 class U_LAYOUTEX_API ValueRuns : public RunArray
00544 {
00545 public:
00560     inline ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count);
00561 
00573     ValueRuns(le_int32 initialCapacity);
00574 
00580     virtual ~ValueRuns();
00581 
00595     le_int32 getValue(le_int32 run) const;
00596 
00597 
00619     le_int32 add(le_int32 value, le_int32 limit);
00620 
00626     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00627 
00633     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00634 
00635 protected:
00636     virtual void init(le_int32 capacity);
00637     virtual void grow(le_int32 capacity);
00638 
00639 private:
00640 
00641     inline ValueRuns();
00642     inline ValueRuns(const ValueRuns &other);
00643     inline ValueRuns &operator=(const ValueRuns & /*other*/) { return *this; };
00644 
00649     static const char fgClassID;
00650 
00651     const le_int32 *fValues;
00652 };
00653 
00654 inline ValueRuns::ValueRuns()
00655     : RunArray(0), fValues(NULL)
00656 {
00657     // nothing else to do...
00658 }
00659 
00660 inline ValueRuns::ValueRuns(const ValueRuns & /*other*/)
00661     : RunArray(0), fValues(NULL)
00662 {
00663     // nothing else to do...
00664 }
00665 
00666 inline ValueRuns::ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count)
00667     : RunArray(limits, count), fValues(values)
00668 {
00669     // nothing else to do...
00670 }
00671 
00672 U_NAMESPACE_END
00673 #endif

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2