Logo Search packages:      
Sourcecode: icu version File versions

TransliteratorIDParser::SingleID * TransliteratorIDParser::specsToID ( const Specs specs,
int32_t  dir 
) [static, private]

Givens a Spec object, convert it to a SingleID object. The Spec object is a more unprocessed parse result. The SingleID object contains information about canonical and basic IDs.

Returns:
a SingleID; never returns null. Returned object always has 'filter' field of null.
Givens a Spec object, convert it to a SingleID object. The Spec object is a more unprocessed parse result. The SingleID object contains information about canonical and basic IDs.
Returns:
a SingleID; never returns NULL. Returned object always has 'filter' field of NULL.

Definition at line 756 of file tridpars.cpp.

References UnicodeString::append(), TransliteratorIDParser::Specs::filter, UnicodeString::insert(), UnicodeString::length(), NULL, TransliteratorIDParser::Specs::sawSource, TransliteratorIDParser::Specs::source, TransliteratorIDParser::Specs::target, and TransliteratorIDParser::Specs::variant.

Referenced by parseSingleID().

                                                                 {
    UnicodeString canonID;
    UnicodeString basicID;
    UnicodeString basicPrefix;
    if (specs != NULL) {
        UnicodeString buf;
        if (dir == FORWARD) {
            if (specs->sawSource) {
                buf.append(specs->source).append(TARGET_SEP);
            } else {
                basicPrefix = specs->source;
                basicPrefix.append(TARGET_SEP);
            }
            buf.append(specs->target);
        } else {
            buf.append(specs->target).append(TARGET_SEP).append(specs->source);
        }
        if (specs->variant.length() != 0) {
            buf.append(VARIANT_SEP).append(specs->variant);
        }
        basicID = basicPrefix;
        basicID.append(buf);
        if (specs->filter.length() != 0) {
            buf.insert(0, specs->filter);
        }
        canonID = buf;
    }
    return new SingleID(canonID, basicID);
}


Generated by  Doxygen 1.6.0   Back to index