Logo Search packages:      
Sourcecode: icu version File versions  Download package

void UVector32::setSize ( int32_t  newSize  ) 

Change the size of this vector as follows: If newSize is smaller, then truncate the array, possibly deleting held elements for i >= newSize. If newSize is larger, grow the array, filling in new slows with zero.

Change the size of this vector as follows: If newSize is smaller, then truncate the array, possibly deleting held elements for i >= newSize. If newSize is larger, grow the array, filling in new slots with NULL.

Definition at line 252 of file uvectr32.cpp.

References U_ZERO_ERROR.

Referenced by assign(), and CompactTrieDictionary::compactMutableTrieDictionary().

                                       {
    int32_t i;
    if (newSize < 0) {
        return;
    }
    if (newSize > count) {
        UErrorCode ec = U_ZERO_ERROR;
        if (!ensureCapacity(newSize, ec)) {
            return;
        }
        for (i=count; i<newSize; ++i) {
            elements[i] = 0;
        }
    } 
    count = newSize;
}


Generated by  Doxygen 1.6.0   Back to index