nsIObserver.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/ds/nsIObserver.idl
  3. */
  4. #ifndef __gen_nsIObserver_h__
  5. #define __gen_nsIObserver_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. /* starting interface: nsIObserver */
  14. #define NS_IOBSERVER_IID_STR "db242e01-e4d9-11d2-9dde-000064657374"
  15. #define NS_IOBSERVER_IID \
  16. {0xdb242e01, 0xe4d9, 0x11d2, \
  17. { 0x9d, 0xde, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 }}
  18. /**
  19. * This interface is implemented by an object that wants
  20. * to observe an event corresponding to a topic.
  21. *
  22. * @status FROZEN
  23. */
  24. class NS_NO_VTABLE nsIObserver : public nsISupports {
  25. public:
  26. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOBSERVER_IID)
  27. /**
  28. * Observe will be called when there is a notification for the
  29. * topic |aTopic|. This assumes that the object implementing
  30. * this interface has been registered with an observer service
  31. * such as the nsIObserverService.
  32. *
  33. * If you expect multiple topics/subjects, the impl is
  34. * responsible for filtering.
  35. *
  36. * You should not modify, add, remove, or enumerate
  37. * notifications in the implemention of observe.
  38. *
  39. * @param aSubject : Notification specific interface pointer.
  40. * @param aTopic : The notification topic or subject.
  41. * @param aData : Notification specific wide string.
  42. * subject event.
  43. */
  44. /* void observe (in nsISupports aSubject, in string aTopic, in wstring aData); */
  45. NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) = 0;
  46. };
  47. /* Use this macro when declaring classes that implement this interface. */
  48. #define NS_DECL_NSIOBSERVER \
  49. NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData);
  50. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  51. #define NS_FORWARD_NSIOBSERVER(_to) \
  52. NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) { return _to Observe(aSubject, aTopic, aData); }
  53. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  54. #define NS_FORWARD_SAFE_NSIOBSERVER(_to) \
  55. NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) { return !_to ? NS_ERROR_NULL_POINTER : _to->Observe(aSubject, aTopic, aData); }
  56. #if 0
  57. /* Use the code below as a template for the implementation class for this interface. */
  58. /* Header file */
  59. class nsObserver : public nsIObserver
  60. {
  61. public:
  62. NS_DECL_ISUPPORTS
  63. NS_DECL_NSIOBSERVER
  64. nsObserver();
  65. private:
  66. ~nsObserver();
  67. protected:
  68. /* additional members */
  69. };
  70. /* Implementation file */
  71. NS_IMPL_ISUPPORTS1(nsObserver, nsIObserver)
  72. nsObserver::nsObserver()
  73. {
  74. /* member initializers and constructor code */
  75. }
  76. nsObserver::~nsObserver()
  77. {
  78. /* destructor code */
  79. }
  80. /* void observe (in nsISupports aSubject, in string aTopic, in wstring aData); */
  81. NS_IMETHODIMP nsObserver::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
  82. {
  83. return NS_ERROR_NOT_IMPLEMENTED;
  84. }
  85. /* End of implementation class template. */
  86. #endif
  87. #endif /* __gen_nsIObserver_h__ */