/** * <p>Abstract implementation of a notification facility. Clients add * EventListeners with addListener and remove them with removeListener. * Notifiers call notifyChanged when they wish to notify listeners. * This queues the listener list on the notification thread, which * eventually dequeues the list and calls notifyListener on each * listener in the list.</p> * * <p>Subclasses override acceptsListener and notifyListener * to add type-safe notification. AcceptsListener should return * true if the listener is of the appropriate type; ICUNotifier * itself will ensure the listener is non-null and that the * identical listener is not already registered with the Notifier. * NotifyListener should cast the listener to the appropriate * type and call the appropriate method on the listener.
*/
class U_COMMON_API ICUNotifier : public UMemory { private: UVector* listeners;
public:
ICUNotifier();
virtual ~ICUNotifier();
/** * Add a listener to be notified when notifyChanged is called. * The listener must not be null. AcceptsListener must return * true for the listener. Attempts to concurrently * register the identical listener more than once will be * silently ignored.
*/ virtualvoid addListener(const EventListener* l, UErrorCode& status);
/** * Stop notifying this listener. The listener must * not be null. Attempts to remove a listener that is * not registered will be silently ignored.
*/ virtualvoid removeListener(const EventListener* l, UErrorCode& status);
/** * ICU doesn't spawn its own threads. All listeners are notified in * the thread of the caller. Misbehaved listeners can therefore * indefinitely block the calling thread. Callers should beware of * deadlock situations.
*/ virtualvoid notifyChanged();
protected: /** * Subclasses implement this to return true if the listener is * of the appropriate type.
*/ virtual UBool acceptsListener(const EventListener& l) const = 0;
/** * Subclasses implement this to notify the listener.
*/ virtualvoid notifyListener(EventListener& l) const = 0;
};
U_NAMESPACE_END
/* UCONFIG_NO_SERVICE */ #endif
/* ICUNOTIF_H */ #endif
Messung V0.5
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.