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

void ICUNotifier::removeListener ( const EventListener l,
UErrorCode status 
) [virtual, inherited]

Stop notifying this listener. The listener must not be null. Attemps to remove a listener that is not registered will be silently ignored.

Definition at line 72 of file servnotf.cpp.

References UVector::elementAt(), NULL, UVector::removeElementAt(), UVector::size(), U_ILLEGAL_ARGUMENT_ERROR, and U_SUCCESS.

{
    if (U_SUCCESS(status)) {
        if (l == NULL) {
            status = U_ILLEGAL_ARGUMENT_ERROR;
            return;
        }

        {
            Mutex lmx(&notifyLock);
            if (listeners != NULL) {
                // identity equality check
                for (int i = 0, e = listeners->size(); i < e; ++i) {
                    const EventListener* el = (const EventListener*)listeners->elementAt(i);
                    if (l == el) {
                        listeners->removeElementAt(i);
                        if (listeners->size() == 0) {
                            delete listeners;
                            listeners = NULL;
                        }
                        return;
                    }
                }
            }
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index