nsIObserverService.h 6.7 KB

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