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

const Transliterator & Transliterator::getElement ( int32_t  index,
UErrorCode ec 
) const [inherited]

Return an element that makes up this transliterator. For example, if the transliterator "NFD;Jamo-Latin;Latin-Greek" were created, the return value of this method would be one of the three transliterator objects that make up that transliterator: [NFD, Jamo-Latin, Latin-Greek].

If this transliterator is not composed of other transliterators, then this method will return a reference to this transliterator when given the index 0.

index a value from 0..countElements()-1 indicating the transliterator to return
ec input-output error code
one of the transliterators that makes up this transliterator, if this transliterator is made up of multiple transliterators, otherwise a reference to this object if given an index of 0 ICU 3.0

Definition at line 1164 of file translit.cpp.

References CompoundTransliterator::getCount(), Transliterator::getDynamicClassID(), CompoundTransliterator::getStaticClassID(), CompoundTransliterator::getTransliterator(), NULL, U_FAILURE, and U_INDEX_OUTOFBOUNDS_ERROR.

Referenced by TransliteratorTest::TestNewEngine().

    if (U_FAILURE(ec)) {
        return *this;
    const CompoundTransliterator* cpd =
        (this->getDynamicClassID() == CompoundTransliterator::getStaticClassID()) ?
        (const CompoundTransliterator*) this : 0;
    int32_t n = (cpd == NULL) ? 1 : cpd->getCount();
    if (index < 0 || index >= n) {
        return *this;
    } else {
        return (n == 1) ? *this : cpd->getTransliterator(index);

Generated by  Doxygen 1.6.0   Back to index