ICU-1096 Made changes per Ram's request.

X-SVN-Rev: 6704
This commit is contained in:
George Rhoten 2001-11-09 02:04:35 +00:00
parent 14b757eeb9
commit a2e0a0733d
3 changed files with 55 additions and 14 deletions

View File

@ -13,23 +13,45 @@
U_NAMESPACE_BEGIN
UVector::UVector(UErrorCode &status, int32_t initialCapacity) :
#define DEFUALT_CAPACITY 8
UVector::UVector(UErrorCode &status) :
count(0),
capacity(0),
elements(0),
deleter(0),
comparer(0) {
comparer(0)
{
_init(DEFUALT_CAPACITY, status);
}
UVector::UVector(int32_t initialCapacity, UErrorCode &status) :
count(0),
capacity(0),
elements(0),
deleter(0),
comparer(0)
{
_init(initialCapacity, status);
}
UVector::UVector(UObjectDeleter d, UKeyComparator c, UErrorCode &status, int32_t initialCapacity) :
UVector::UVector(UObjectDeleter d, UKeyComparator c, UErrorCode &status) :
count(0),
capacity(0),
elements(0),
deleter(d),
comparer(c) {
comparer(c)
{
_init(DEFUALT_CAPACITY, status);
}
UVector::UVector(UObjectDeleter d, UKeyComparator c, int32_t initialCapacity, UErrorCode &status) :
count(0),
capacity(0),
elements(0),
deleter(d),
comparer(c)
{
_init(initialCapacity, status);
}
@ -237,12 +259,24 @@ void* UVector::orphanElementAt(int32_t index) {
return e;
}
UStack::UStack(UErrorCode &status, int32_t initialCapacity) :
UVector(status, initialCapacity) {
UStack::UStack(UErrorCode &status) :
UVector(status)
{
}
UStack::UStack(UObjectDeleter d, UKeyComparator c, UErrorCode &status, int32_t initialCapacity) :
UVector(d, c, status, initialCapacity) {
UStack::UStack(int32_t initialCapacity, UErrorCode &status) :
UVector(initialCapacity, status)
{
}
UStack::UStack(UObjectDeleter d, UKeyComparator c, UErrorCode &status) :
UVector(d, c, status)
{
}
UStack::UStack(UObjectDeleter d, UKeyComparator c, int32_t initialCapacity, UErrorCode &status) :
UVector(d, c, initialCapacity, status)
{
}
void* UStack::pop(void) {

View File

@ -87,10 +87,13 @@ private:
UKeyComparator comparer;
public:
UVector(UErrorCode &status, int32_t initialCapacity = 8);
UVector(UErrorCode &status);
UVector(UObjectDeleter d, UKeyComparator c, UErrorCode &status, int32_t initialCapacity = 8);
UVector(int32_t initialCapacity, UErrorCode &status);
UVector(UObjectDeleter d, UKeyComparator c, UErrorCode &status);
UVector(UObjectDeleter d, UKeyComparator c, int32_t initialCapacity, UErrorCode &status);
~UVector();
//------------------------------------------------------------
@ -194,9 +197,13 @@ private:
*/
class U_COMMON_API UStack : public UVector {
public:
UStack(UErrorCode &status, int32_t initialCapacity = 8);
UStack(UErrorCode &status);
UStack(UObjectDeleter d, UKeyComparator c, UErrorCode &status, int32_t initialCapacity = 8);
UStack(int32_t initialCapacity, UErrorCode &status);
UStack(UObjectDeleter d, UKeyComparator c, UErrorCode &status);
UStack(UObjectDeleter d, UKeyComparator c, int32_t initialCapacity, UErrorCode &status);
// It's okay not to have a virtual destructor (in UVector)
// because UStack has no special cleanup to do.

View File

@ -293,7 +293,7 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
int32_t n = ruleVector->size();
int32_t j;
int16_t x;
UVector v(status, 2*n); // heuristic; adjust as needed
UVector v(2*n, status); // heuristic; adjust as needed
if (U_FAILURE(status)) {
return;