OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/builds/tinderbox/XR-Mozilla1.8.0
-Release/WINNT_5.2_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 |
| 17 class nsIObserver; /* forward declaration */ |
| 18 |
| 19 class 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 */ |
| 39 class NS_NO_VTABLE nsIObserverService : public nsISupports { |
| 40 public: |
| 41 |
| 42 NS_DEFINE_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 wil
l be |
| 56 * returned. |
| 57 */ |
| 58 /* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean o
wnsWeak); */ |
| 59 NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool own
sWeak) = 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_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_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PR
Unichar *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_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retva
l) = 0; |
| 95 |
| 96 }; |
| 97 |
| 98 /* Use this macro when declaring classes that implement this interface. */ |
| 99 #define NS_DECL_NSIOBSERVERSERVICE \ |
| 100 NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool own
sWeak); \ |
| 101 NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic); \ |
| 102 NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PR
Unichar *someData); \ |
| 103 NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retva
l); |
| 104 |
| 105 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object. */ |
| 106 #define NS_FORWARD_NSIOBSERVERSERVICE(_to) \ |
| 107 NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool own
sWeak) { return _to AddObserver(anObserver, aTopic, ownsWeak); } \ |
| 108 NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { retur
n _to RemoveObserver(anObserver, aTopic); } \ |
| 109 NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PR
Unichar *someData) { return _to NotifyObservers(aSubject, aTopic, someData); } \ |
| 110 NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retva
l) { return _to EnumerateObservers(aTopic, _retval); } |
| 111 |
| 112 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object in a safe way. */ |
| 113 #define NS_FORWARD_SAFE_NSIOBSERVERSERVICE(_to) \ |
| 114 NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool own
sWeak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(anObserver, aTop
ic, ownsWeak); } \ |
| 115 NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { retur
n !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(anObserver, aTopic); } \ |
| 116 NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PR
Unichar *someData) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifyObservers(
aSubject, aTopic, someData); } \ |
| 117 NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retva
l) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateObservers(aTopic, _retv
al); } |
| 118 |
| 119 #if 0 |
| 120 /* Use the code below as a template for the implementation class for this interf
ace. */ |
| 121 |
| 122 /* Header file */ |
| 123 class nsObserverService : public nsIObserverService |
| 124 { |
| 125 public: |
| 126 NS_DECL_ISUPPORTS |
| 127 NS_DECL_NSIOBSERVERSERVICE |
| 128 |
| 129 nsObserverService(); |
| 130 |
| 131 private: |
| 132 ~nsObserverService(); |
| 133 |
| 134 protected: |
| 135 /* additional members */ |
| 136 }; |
| 137 |
| 138 /* Implementation file */ |
| 139 NS_IMPL_ISUPPORTS1(nsObserverService, nsIObserverService) |
| 140 |
| 141 nsObserverService::nsObserverService() |
| 142 { |
| 143 /* member initializers and constructor code */ |
| 144 } |
| 145 |
| 146 nsObserverService::~nsObserverService() |
| 147 { |
| 148 /* destructor code */ |
| 149 } |
| 150 |
| 151 /* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean own
sWeak); */ |
| 152 NS_IMETHODIMP nsObserverService::AddObserver(nsIObserver *anObserver, const char
*aTopic, PRBool ownsWeak) |
| 153 { |
| 154 return NS_ERROR_NOT_IMPLEMENTED; |
| 155 } |
| 156 |
| 157 /* void removeObserver (in nsIObserver anObserver, in string aTopic); */ |
| 158 NS_IMETHODIMP nsObserverService::RemoveObserver(nsIObserver *anObserver, const c
har *aTopic) |
| 159 { |
| 160 return NS_ERROR_NOT_IMPLEMENTED; |
| 161 } |
| 162 |
| 163 /* void notifyObservers (in nsISupports aSubject, in string aTopic, in wstring s
omeData); */ |
| 164 NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports *aSubject, const ch
ar *aTopic, const PRUnichar *someData) |
| 165 { |
| 166 return NS_ERROR_NOT_IMPLEMENTED; |
| 167 } |
| 168 |
| 169 /* nsISimpleEnumerator enumerateObservers (in string aTopic); */ |
| 170 NS_IMETHODIMP nsObserverService::EnumerateObservers(const char *aTopic, nsISimpl
eEnumerator **_retval) |
| 171 { |
| 172 return NS_ERROR_NOT_IMPLEMENTED; |
| 173 } |
| 174 |
| 175 /* End of implementation class template. */ |
| 176 #endif |
| 177 |
| 178 |
| 179 #endif /* __gen_nsIObserverService_h__ */ |
OLD | NEW |