ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunArrays.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 2003-2008, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 */
7
8 #ifndef __RUNARRAYS_H
9
10 #define __RUNARRAYS_H
11
12 #include "layout/LETypes.h"
13 #include "layout/LEFontInstance.h"
14
15 #include "unicode/utypes.h"
16 #include "unicode/locid.h"
17
23 U_NAMESPACE_BEGIN
24
30 #define INITIAL_CAPACITY 16
31
38 #define CAPACITY_GROW_LIMIT 128
39
48 class U_LAYOUTEX_API RunArray : public UObject
49 {
50 public:
62 inline RunArray(const le_int32 *limits, le_int32 count);
63
75 RunArray(le_int32 initialCapacity);
76
82 virtual ~RunArray();
83
91 inline le_int32 getCount() const;
92
101 inline void reset();
102
111 inline le_int32 getLimit() const;
112
122 inline le_int32 getLimit(le_int32 run) const;
123
148 le_int32 add(le_int32 limit);
149
155 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
156
162 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
163
164 protected:
177 virtual void init(le_int32 capacity);
178
191 virtual void grow(le_int32 capacity);
192
202 le_bool fClientArrays;
203
204 private:
209 static const char fgClassID;
210
211 le_int32 ensureCapacity();
212
213 inline RunArray();
214 inline RunArray(const RunArray & /*other*/);
215 inline RunArray &operator=(const RunArray & /*other*/) { return *this; };
216
217 const le_int32 *fLimits;
218 le_int32 fCount;
219 le_int32 fCapacity;
220 };
221
222 inline RunArray::RunArray()
223 : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
224 {
225 // nothing else to do...
226 }
227
228 inline RunArray::RunArray(const RunArray & /*other*/)
229 : UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
230 {
231 // nothing else to do...
232 }
233
234 inline RunArray::RunArray(const le_int32 *limits, le_int32 count)
235 : UObject(), fClientArrays(TRUE), fLimits(limits), fCount(count), fCapacity(count)
236 {
237 // nothing else to do...
238 }
239
240 inline le_int32 RunArray::getCount() const
241 {
242 return fCount;
243 }
244
245 inline void RunArray::reset()
246 {
247 fCount = 0;
248 }
249
250 inline le_int32 RunArray::getLimit(le_int32 run) const
251 {
252 if (run < 0 || run >= fCount) {
253 return -1;
254 }
255
256 return fLimits[run];
257 }
258
259 inline le_int32 RunArray::getLimit() const
260 {
261 return getLimit(fCount - 1);
262 }
263
270 class U_LAYOUTEX_API FontRuns : public RunArray
271 {
272 public:
288 inline FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count);
289
301 FontRuns(le_int32 initialCapacity);
302
308 virtual ~FontRuns();
309
323 const LEFontInstance *getFont(le_int32 run) const;
324
325
348 le_int32 add(const LEFontInstance *font, le_int32 limit);
349
355 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
356
362 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
363
364 protected:
365 virtual void init(le_int32 capacity);
366 virtual void grow(le_int32 capacity);
367
368 private:
369
370 inline FontRuns();
371 inline FontRuns(const FontRuns &other);
372 inline FontRuns &operator=(const FontRuns & /*other*/) { return *this; };
373
378 static const char fgClassID;
379
380 const LEFontInstance **fFonts;
381 };
382
383 inline FontRuns::FontRuns()
384 : RunArray(0), fFonts(NULL)
385 {
386 // nothing else to do...
387 }
388
389 inline FontRuns::FontRuns(const FontRuns & /*other*/)
390 : RunArray(0), fFonts(NULL)
391 {
392 // nothing else to do...
393 }
394
395 inline FontRuns::FontRuns(const LEFontInstance **fonts, const le_int32 *limits, le_int32 count)
396 : RunArray(limits, count), fFonts(fonts)
397 {
398 // nothing else to do...
399 }
400
407 class U_LAYOUTEX_API LocaleRuns : public RunArray
408 {
409 public:
425 inline LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count);
426
438 LocaleRuns(le_int32 initialCapacity);
439
445 virtual ~LocaleRuns();
446
460 const Locale *getLocale(le_int32 run) const;
461
462
485 le_int32 add(const Locale *locale, le_int32 limit);
486
492 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
493
499 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
500
501 protected:
502 virtual void init(le_int32 capacity);
503 virtual void grow(le_int32 capacity);
504
508 const Locale **fLocales;
509
510 private:
511
512 inline LocaleRuns();
513 inline LocaleRuns(const LocaleRuns &other);
514 inline LocaleRuns &operator=(const LocaleRuns & /*other*/) { return *this; };
515
520 static const char fgClassID;
521 };
522
523 inline LocaleRuns::LocaleRuns()
524 : RunArray(0), fLocales(NULL)
525 {
526 // nothing else to do...
527 }
528
529 inline LocaleRuns::LocaleRuns(const LocaleRuns & /*other*/)
530 : RunArray(0), fLocales(NULL)
531 {
532 // nothing else to do...
533 }
534
535 inline LocaleRuns::LocaleRuns(const Locale **locales, const le_int32 *limits, le_int32 count)
536 : RunArray(limits, count), fLocales(locales)
537 {
538 // nothing else to do...
539 }
540
546 class U_LAYOUTEX_API ValueRuns : public RunArray
547 {
548 public:
563 inline ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count);
564
576 ValueRuns(le_int32 initialCapacity);
577
583 virtual ~ValueRuns();
584
598 le_int32 getValue(le_int32 run) const;
599
600
622 le_int32 add(le_int32 value, le_int32 limit);
623
629 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
630
636 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
637
638 protected:
639 virtual void init(le_int32 capacity);
640 virtual void grow(le_int32 capacity);
641
642 private:
643
644 inline ValueRuns();
645 inline ValueRuns(const ValueRuns &other);
646 inline ValueRuns &operator=(const ValueRuns & /*other*/) { return *this; };
647
652 static const char fgClassID;
653
654 const le_int32 *fValues;
655 };
656
657 inline ValueRuns::ValueRuns()
658 : RunArray(0), fValues(NULL)
659 {
660 // nothing else to do...
661 }
662
663 inline ValueRuns::ValueRuns(const ValueRuns & /*other*/)
664 : RunArray(0), fValues(NULL)
665 {
666 // nothing else to do...
667 }
668
669 inline ValueRuns::ValueRuns(const le_int32 *values, const le_int32 *limits, le_int32 count)
670 : RunArray(limits, count), fValues(values)
671 {
672 // nothing else to do...
673 }
674
675 U_NAMESPACE_END
676 #endif