X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/layoutex/RunArrays.cpp diff --git a/icuSources/layoutex/RunArrays.cpp b/icuSources/layoutex/RunArrays.cpp index 9e660361..f6e51af1 100644 --- a/icuSources/layoutex/RunArrays.cpp +++ b/icuSources/layoutex/RunArrays.cpp @@ -1,3 +1,5 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 2003, International Business Machines @@ -16,6 +18,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 +75,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 +127,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 +179,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);