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

void StringList::add ( const UnicodeString string,
UErrorCode status 
)

Add a string to the list.

Parameters:
string- the string to add
status- will be set if any errors occur.

ICU 4.0.1 technology preview

Definition at line 225 of file colldata.cpp.

References UnicodeString::append(), STRING_LIST_BUFFER_SIZE, and U_FAILURE.

Referenced by add().

{
    if (U_FAILURE(status)) {
        return;
    }

#ifdef INSTRUMENT_STRING_LIST
    _strings += 1;
#endif

    if (listSize >= listMax) {
        int32_t newMax = listMax + STRING_LIST_BUFFER_SIZE;

        UnicodeString *newStrings = new UnicodeString[newMax];

        uprv_memcpy(newStrings, strings, listSize * sizeof(UnicodeString));

#ifdef INSTRUMENT_STRING_LIST
        int32_t _h = listSize / STRING_LIST_BUFFER_SIZE;

        if (_h > 100) {
            _h = 100;
        }

        _histogram[_h] += 1;
#endif

        delete[] strings;
        strings = newStrings;
        listMax = newMax;
    }

    // The ctor initialized all the strings in
    // the array to empty strings, so this
    // is the same as copying the source string.
    strings[listSize++].append(*string);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index