X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..f59164e3d128c7675a4d3934206346a3384e53a5:/icuSources/layoutex/RunArrays.cpp?ds=sidebyside diff --git a/icuSources/layoutex/RunArrays.cpp b/icuSources/layoutex/RunArrays.cpp index 9e660361..574282ba 100644 --- a/icuSources/layoutex/RunArrays.cpp +++ b/icuSources/layoutex/RunArrays.cpp @@ -16,6 +16,22 @@ U_NAMESPACE_BEGIN const char RunArray::fgClassID = 0; +RunArray::RunArray(le_int32 initialCapacity) + : fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(initialCapacity) +{ + if (initialCapacity > 0) { + fLimits = LE_NEW_ARRAY(le_int32, fCapacity); + } +} + +RunArray::~RunArray() +{ + if (! fClientArrays) { + LE_DELETE_ARRAY(fLimits); + fLimits = NULL; + } +} + le_int32 RunArray::ensureCapacity() { if (fCount >= fCapacity) { @@ -57,6 +73,22 @@ le_int32 RunArray::add(le_int32 limit) const char FontRuns::fgClassID = 0; +FontRuns::FontRuns(le_int32 initialCapacity) + : RunArray(initialCapacity), fFonts(NULL) +{ + if (initialCapacity > 0) { + fFonts = LE_NEW_ARRAY(const LEFontInstance *, initialCapacity); + } +} + +FontRuns::~FontRuns() +{ + if (! fClientArrays) { + LE_DELETE_ARRAY(fFonts); + fFonts = NULL; + } +} + void FontRuns::init(le_int32 capacity) { RunArray::init(capacity); @@ -93,6 +125,22 @@ const LEFontInstance *FontRuns::getFont(le_int32 run) const const char LocaleRuns::fgClassID = 0; +LocaleRuns::LocaleRuns(le_int32 initialCapacity) + : RunArray(initialCapacity), fLocales(NULL) +{ + if (initialCapacity > 0) { + fLocales = LE_NEW_ARRAY(const Locale *, initialCapacity); + } +} + +LocaleRuns::~LocaleRuns() +{ + if (! fClientArrays) { + LE_DELETE_ARRAY(fLocales); + fLocales = NULL; + } +} + void LocaleRuns::init(le_int32 capacity) { RunArray::init(capacity); @@ -129,6 +177,22 @@ const Locale *LocaleRuns::getLocale(le_int32 run) const const char ValueRuns::fgClassID = 0; +ValueRuns::ValueRuns(le_int32 initialCapacity) + : RunArray(initialCapacity), fValues(NULL) +{ + if (initialCapacity > 0) { + fValues = LE_NEW_ARRAY(le_int32, initialCapacity); + } +} + +ValueRuns::~ValueRuns() +{ + if (! fClientArrays) { + LE_DELETE_ARRAY(fValues); + fValues = NULL; + } +} + void ValueRuns::init(le_int32 capacity) { RunArray::init(capacity);