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

TransliterationRuleSet::TransliterationRuleSet ( const TransliterationRuleSet other  ) 

Copy constructor.

Definition at line 178 of file rbt_set.cpp.

References UVector::addElement(), UVector::elementAt(), freeze(), index, NULL, rules, ruleVector, UVector::size(), U_FAILURE, U_MEMORY_ALLOCATION_ERROR, U_SUCCESS, and U_ZERO_ERROR.

                                                                                  :
    UMemory(other),
    ruleVector(0),
    rules(0),
    maxContextLength(other.maxContextLength) {

    int32_t i, len;
    uprv_memcpy(index, other.index, sizeof(index));
    UErrorCode status = U_ZERO_ERROR;
    ruleVector = new UVector(&_deleteRule, NULL, status);
    if (other.ruleVector != 0 && ruleVector != 0 && U_SUCCESS(status)) {
        len = other.ruleVector->size();
        for (i=0; i<len && U_SUCCESS(status); ++i) {
            TransliterationRule *tempTranslitRule = new TransliterationRule(*(TransliterationRule*)other.ruleVector->elementAt(i));
            // Null pointer test
            if (tempTranslitRule == NULL) {
                status = U_MEMORY_ALLOCATION_ERROR;
                break;
            }
            ruleVector->addElement(tempTranslitRule, status);
            if (U_FAILURE(status)) {
                break;
            }
        }
    }
    if (other.rules != 0 && U_SUCCESS(status)) {
        UParseError p;
        freeze(p, status);
    }
}


Generated by  Doxygen 1.6.0   Back to index