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

void MessageFormat::setFormats ( const Format **  newFormats,
int32_t  cnt 
) [virtual]

Sets subformats. See the class description about format numbering. Each item in the array is cloned into the internal array. If the call fails because memory cannot be allocated, then this object will remain unchanged.

If this format uses named arguments, the new formats are discarded and this format remains unchanged.

ICU 2.0

newFormats the new format to be set.
cnt the size of the array.

Definition at line 900 of file msgfmt.cpp.

References allocateSubformats(), Format::clone(), NULL, and subformats.

    if (newFormats == NULL || count < 0) {

    if (allocateSubformats(count)) {
        int32_t i; 
        for (i=0; i<subformatCount; ++i) {
            delete subformats[i].format;
        subformatCount = 0;

        for (i=0; i<count; ++i) {
            subformats[i].format = newFormats[i] ? newFormats[i]->clone() : NULL;
        subformatCount = count;

    // TODO: What about the .offset and .arg fields?

Generated by  Doxygen 1.6.0   Back to index