view modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/common/servnotf.h @ 11038:20a8447c71c6

8207159: Update ICU to version 62.1 Reviewed-by: mbilla, kcr, ghb
author arajkumar
date Fri, 24 Aug 2018 15:06:40 +0530
parents fee4ef5c87df
line wrap: on
line source
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use:
 * Copyright (C) 2001-2014, International Business Machines Corporation and    *
 * others. All Rights Reserved.                                                *
#ifndef ICUNOTIF_H
#define ICUNOTIF_H

#include "unicode/utypes.h"



 * Allow the declaration of APIs with pointers to BreakIterator
 * even when break iteration is removed from the build.
class ICUNotifier;



#include "unicode/uobject.h"
#include "unicode/unistr.h"

#include "mutex.h"
#include "uvector.h"


class U_COMMON_API EventListener : public UObject {
    virtual ~EventListener();

    static UClassID U_EXPORT2 getStaticClassID();

    virtual UClassID getDynamicClassID() const;

    virtual UnicodeString& debug(UnicodeString& result) const {
      return debugClass(result);

    virtual UnicodeString& debugClass(UnicodeString& result) const {
      return result.append((UnicodeString)"Key");

 * <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;


    virtual ~ICUNotifier(void);

     * 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.
    virtual void addListener(const EventListener* l, UErrorCode& status);

     * Stop notifying this listener.  The listener must
     * not be null.  Attemps to remove a listener that is
     * not registered will be silently ignored.
    virtual void 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.
    virtual void notifyChanged(void);

     * 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.
    virtual void notifyListener(EventListener& l) const = 0;