/gecko_api/include/nsIObserverService.h
C++ Header | 181 lines | 74 code | 34 blank | 73 comment | 0 complexity | 694bb4192e02edb37283781cff447754 MD5 | raw file
1/* 2 * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/xpcom/ds/nsIObserverService.idl 3 */ 4 5#ifndef __gen_nsIObserverService_h__ 6#define __gen_nsIObserverService_h__ 7 8 9#ifndef __gen_nsISupports_h__ 10#include "nsISupports.h" 11#endif 12 13/* For IDL files that don't want to include root IDL files. */ 14#ifndef NS_NO_VTABLE 15#define NS_NO_VTABLE 16#endif 17class nsIObserver; /* forward declaration */ 18 19class nsISimpleEnumerator; /* forward declaration */ 20 21 22/* starting interface: nsIObserverService */ 23#define NS_IOBSERVERSERVICE_IID_STR "d07f5192-e3d1-11d2-8acd-00105a1b8860" 24 25#define NS_IOBSERVERSERVICE_IID \ 26 {0xd07f5192, 0xe3d1, 0x11d2, \ 27 { 0x8a, 0xcd, 0x00, 0x10, 0x5a, 0x1b, 0x88, 0x60 }} 28 29/** 30 * nsIObserverService 31 * 32 * Service allows a client listener (nsIObserver) to register and unregister for 33 * notifications of specific string referenced topic. Service also provides a 34 * way to notify registered listeners and a way to enumerate registered client 35 * listeners. 36 * 37 * @status FROZEN 38 */ 39class NS_NO_VTABLE NS_SCRIPTABLE nsIObserverService : public nsISupports { 40 public: 41 42 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IOBSERVERSERVICE_IID) 43 44 /** 45 * AddObserver 46 * 47 * Registers a given listener for a notifications regarding the specified 48 * topic. 49 * 50 * @param anObserve : The interface pointer which will receive notifications. 51 * @param aTopic : The notification topic or subject. 52 * @param ownsWeak : If set to false, the nsIObserverService will hold a 53 * strong reference to |anObserver|. If set to true and 54 * |anObserver| supports the nsIWeakReference interface, 55 * a weak reference will be held. Otherwise an error will be 56 * returned. 57 */ 58 /* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean ownsWeak); */ 59 NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) = 0; 60 61 /** 62 * removeObserver 63 * 64 * Unregisters a given listener from notifications regarding the specified 65 * topic. 66 * 67 * @param anObserver : The interface pointer which will stop recieving 68 * notifications. 69 * @param aTopic : The notification topic or subject. 70 */ 71 /* void removeObserver (in nsIObserver anObserver, in string aTopic); */ 72 NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) = 0; 73 74 /** 75 * notifyObservers 76 * 77 * Notifies all registered listeners of the given topic. 78 * 79 * @param aSubject : Notification specific interface pointer. 80 * @param aTopic : The notification topic or subject. 81 * @param someData : Notification specific wide string. 82 */ 83 /* void notifyObservers (in nsISupports aSubject, in string aTopic, in wstring someData); */ 84 NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) = 0; 85 86 /** 87 * enumerateObservers 88 * 89 * Returns an enumeration of all registered listeners. 90 * 91 * @param aTopic : The notification topic or subject. 92 */ 93 /* nsISimpleEnumerator enumerateObservers (in string aTopic); */ 94 NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) = 0; 95 96}; 97 98 NS_DEFINE_STATIC_IID_ACCESSOR(nsIObserverService, NS_IOBSERVERSERVICE_IID) 99 100/* Use this macro when declaring classes that implement this interface. */ 101#define NS_DECL_NSIOBSERVERSERVICE \ 102 NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak); \ 103 NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic); \ 104 NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData); \ 105 NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval); 106 107/* Use this macro to declare functions that forward the behavior of this interface to another object. */ 108#define NS_FORWARD_NSIOBSERVERSERVICE(_to) \ 109 NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) { return _to AddObserver(anObserver, aTopic, ownsWeak); } \ 110 NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { return _to RemoveObserver(anObserver, aTopic); } \ 111 NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { return _to NotifyObservers(aSubject, aTopic, someData); } \ 112 NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) { return _to EnumerateObservers(aTopic, _retval); } 113 114/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ 115#define NS_FORWARD_SAFE_NSIOBSERVERSERVICE(_to) \ 116 NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(anObserver, aTopic, ownsWeak); } \ 117 NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(anObserver, aTopic); } \ 118 NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifyObservers(aSubject, aTopic, someData); } \ 119 NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateObservers(aTopic, _retval); } 120 121#if 0 122/* Use the code below as a template for the implementation class for this interface. */ 123 124/* Header file */ 125class nsObserverService : public nsIObserverService 126{ 127public: 128 NS_DECL_ISUPPORTS 129 NS_DECL_NSIOBSERVERSERVICE 130 131 nsObserverService(); 132 133private: 134 ~nsObserverService(); 135 136protected: 137 /* additional members */ 138}; 139 140/* Implementation file */ 141NS_IMPL_ISUPPORTS1(nsObserverService, nsIObserverService) 142 143nsObserverService::nsObserverService() 144{ 145 /* member initializers and constructor code */ 146} 147 148nsObserverService::~nsObserverService() 149{ 150 /* destructor code */ 151} 152 153/* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean ownsWeak); */ 154NS_IMETHODIMP nsObserverService::AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) 155{ 156 return NS_ERROR_NOT_IMPLEMENTED; 157} 158 159/* void removeObserver (in nsIObserver anObserver, in string aTopic); */ 160NS_IMETHODIMP nsObserverService::RemoveObserver(nsIObserver *anObserver, const char *aTopic) 161{ 162 return NS_ERROR_NOT_IMPLEMENTED; 163} 164 165/* void notifyObservers (in nsISupports aSubject, in string aTopic, in wstring someData); */ 166NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) 167{ 168 return NS_ERROR_NOT_IMPLEMENTED; 169} 170 171/* nsISimpleEnumerator enumerateObservers (in string aTopic); */ 172NS_IMETHODIMP nsObserverService::EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) 173{ 174 return NS_ERROR_NOT_IMPLEMENTED; 175} 176 177/* End of implementation class template. */ 178#endif 179 180 181#endif /* __gen_nsIObserverService_h__ */