PageRenderTime 18ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/nsIObserverService.h

http://firefox-mac-pdf.googlecode.com/
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. #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 NS_SCRIPTABLE nsIObserverService : public nsISupports {
  31. public:
  32. NS_DECLARE_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_SCRIPTABLE 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_SCRIPTABLE 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_SCRIPTABLE 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_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) = 0;
  81. };
  82. NS_DEFINE_STATIC_IID_ACCESSOR(nsIObserverService, NS_IOBSERVERSERVICE_IID)
  83. /* Use this macro when declaring classes that implement this interface. */
  84. #define NS_DECL_NSIOBSERVERSERVICE \
  85. NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak); \
  86. NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic); \
  87. NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData); \
  88. NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval);
  89. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  90. #define NS_FORWARD_NSIOBSERVERSERVICE(_to) \
  91. NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) { return _to AddObserver(anObserver, aTopic, ownsWeak); } \
  92. NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { return _to RemoveObserver(anObserver, aTopic); } \
  93. NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { return _to NotifyObservers(aSubject, aTopic, someData); } \
  94. NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) { return _to EnumerateObservers(aTopic, _retval); }
  95. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  96. #define NS_FORWARD_SAFE_NSIOBSERVERSERVICE(_to) \
  97. NS_SCRIPTABLE NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(anObserver, aTopic, ownsWeak); } \
  98. NS_SCRIPTABLE NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(anObserver, aTopic); } \
  99. NS_SCRIPTABLE NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifyObservers(aSubject, aTopic, someData); } \
  100. NS_SCRIPTABLE NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateObservers(aTopic, _retval); }
  101. #if 0
  102. /* Use the code below as a template for the implementation class for this interface. */
  103. /* Header file */
  104. class nsObserverService : public nsIObserverService
  105. {
  106. public:
  107. NS_DECL_ISUPPORTS
  108. NS_DECL_NSIOBSERVERSERVICE
  109. nsObserverService();
  110. private:
  111. ~nsObserverService();
  112. protected:
  113. /* additional members */
  114. };
  115. /* Implementation file */
  116. NS_IMPL_ISUPPORTS1(nsObserverService, nsIObserverService)
  117. nsObserverService::nsObserverService()
  118. {
  119. /* member initializers and constructor code */
  120. }
  121. nsObserverService::~nsObserverService()
  122. {
  123. /* destructor code */
  124. }
  125. /* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean ownsWeak); */
  126. NS_IMETHODIMP nsObserverService::AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak)
  127. {
  128. return NS_ERROR_NOT_IMPLEMENTED;
  129. }
  130. /* void removeObserver (in nsIObserver anObserver, in string aTopic); */
  131. NS_IMETHODIMP nsObserverService::RemoveObserver(nsIObserver *anObserver, const char *aTopic)
  132. {
  133. return NS_ERROR_NOT_IMPLEMENTED;
  134. }
  135. /* void notifyObservers (in nsISupports aSubject, in string aTopic, in wstring someData); */
  136. NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
  137. {
  138. return NS_ERROR_NOT_IMPLEMENTED;
  139. }
  140. /* nsISimpleEnumerator enumerateObservers (in string aTopic); */
  141. NS_IMETHODIMP nsObserverService::EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval)
  142. {
  143. return NS_ERROR_NOT_IMPLEMENTED;
  144. }
  145. /* End of implementation class template. */
  146. #endif
  147. #endif /* __gen_nsIObserverService_h__ */