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

UnicodeSet & Transliterator::getSourceSet ( UnicodeSet result  )  const [inherited]

Returns the set of all characters that may be modified in the input text by this Transliterator. This incorporates this object's current filter; if the filter is changed, the return value of this function will change. The default implementation returns an empty set. Some subclasses may override handleGetSourceSet to return a more precise result. The return result is approximate in any case and is intended for use by tests, tools, or utilities.

Parameters:
result receives result set; previous contents lost
Returns:
a reference to result
See also:
getTargetSet

handleGetSourceSet ICU 2.4

Definition at line 1180 of file translit.cpp.

References UnicodeMatcher::addMatchSetTo(), FALSE, Transliterator::filter, UnicodeFilter::getDynamicClassID(), UnicodeSet::getStaticClassID(), Transliterator::handleGetSourceSet(), NULL, UnicodeSet::retainAll(), and TRUE.

Referenced by CompoundTransliterator::handleGetSourceSet(), and TransliteratorTest::TestSourceTargetSet().

                                                                 {
    handleGetSourceSet(result);
    if (filter != NULL) {
        UnicodeSet* filterSet;
        UBool deleteFilterSet = FALSE;
        // Most, but not all filters will be UnicodeSets.  Optimize for
        // the high-runner case.
        if (filter->getDynamicClassID() == UnicodeSet::getStaticClassID()) {
            filterSet = (UnicodeSet*) filter;
        } else {
            filterSet = new UnicodeSet();
            // Check null pointer
            if (filterSet == NULL) {
                return result;
            }
            deleteFilterSet = TRUE;
            filter->addMatchSetTo(*filterSet);
        }
        result.retainAll(*filterSet);
        if (deleteFilterSet) {
            delete filterSet;
        }
    }
    return result;
}


Generated by  Doxygen 1.6.0   Back to index