nsIWeakReference.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/base/nsIWeakReference.idl
  3. */
  4. #ifndef __gen_nsIWeakReference_h__
  5. #define __gen_nsIWeakReference_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: nsIWeakReference */
  14. #define NS_IWEAKREFERENCE_IID_STR "9188bc85-f92e-11d2-81ef-0060083a0bcf"
  15. #define NS_IWEAKREFERENCE_IID \
  16. {0x9188bc85, 0xf92e, 0x11d2, \
  17. { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
  18. /**
  19. * An instance of |nsIWeakReference| is a proxy object that cooperates with
  20. * its referent to give clients a non-owning, non-dangling reference. Clients
  21. * own the proxy, and should generally manage it with an |nsCOMPtr| (see the
  22. * type |nsWeakPtr| for a |typedef| name that stands out) as they would any
  23. * other XPCOM object. The |QueryReferent| member function provides a
  24. * (hopefully short-lived) owning reference on demand, through which clients
  25. * can get useful access to the referent, while it still exists.
  26. *
  27. * @status FROZEN
  28. * @version 1.0
  29. * @see nsISupportsWeakReference
  30. * @see nsWeakReference
  31. * @see nsWeakPtr
  32. */
  33. class NS_NO_VTABLE nsIWeakReference : public nsISupports {
  34. public:
  35. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWEAKREFERENCE_IID)
  36. /**
  37. * |QueryReferent| queries the referent, if it exists, and like |QueryInterface|, produces
  38. * an owning reference to the desired interface. It is designed to look and act exactly
  39. * like (a proxied) |QueryInterface|. Don't hold on to the produced interface permanently;
  40. * that would defeat the purpose of using a non-owning |nsIWeakReference| in the first place.
  41. */
  42. /* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  43. NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) = 0;
  44. };
  45. /* Use this macro when declaring classes that implement this interface. */
  46. #define NS_DECL_NSIWEAKREFERENCE \
  47. NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result);
  48. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  49. #define NS_FORWARD_NSIWEAKREFERENCE(_to) \
  50. NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return _to QueryReferent(uuid, result); }
  51. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  52. #define NS_FORWARD_SAFE_NSIWEAKREFERENCE(_to) \
  53. NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryReferent(uuid, result); }
  54. #if 0
  55. /* Use the code below as a template for the implementation class for this interface. */
  56. /* Header file */
  57. class nsWeakReference : public nsIWeakReference
  58. {
  59. public:
  60. NS_DECL_ISUPPORTS
  61. NS_DECL_NSIWEAKREFERENCE
  62. nsWeakReference();
  63. private:
  64. ~nsWeakReference();
  65. protected:
  66. /* additional members */
  67. };
  68. /* Implementation file */
  69. NS_IMPL_ISUPPORTS1(nsWeakReference, nsIWeakReference)
  70. nsWeakReference::nsWeakReference()
  71. {
  72. /* member initializers and constructor code */
  73. }
  74. nsWeakReference::~nsWeakReference()
  75. {
  76. /* destructor code */
  77. }
  78. /* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  79. NS_IMETHODIMP nsWeakReference::QueryReferent(const nsIID & uuid, void * *result)
  80. {
  81. return NS_ERROR_NOT_IMPLEMENTED;
  82. }
  83. /* End of implementation class template. */
  84. #endif
  85. /* starting interface: nsISupportsWeakReference */
  86. #define NS_ISUPPORTSWEAKREFERENCE_IID_STR "9188bc86-f92e-11d2-81ef-0060083a0bcf"
  87. #define NS_ISUPPORTSWEAKREFERENCE_IID \
  88. {0x9188bc86, 0xf92e, 0x11d2, \
  89. { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
  90. /**
  91. * |nsISupportsWeakReference| is a factory interface which produces appropriate
  92. * instances of |nsIWeakReference|. Weak references in this scheme can only be
  93. * produced for objects that implement this interface.
  94. *
  95. * @status FROZEN
  96. * @version 1.0
  97. * @see nsIWeakReference
  98. * @see nsSupportsWeakReference
  99. */
  100. class NS_NO_VTABLE nsISupportsWeakReference : public nsISupports {
  101. public:
  102. NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISUPPORTSWEAKREFERENCE_IID)
  103. /**
  104. * |GetWeakReference| produces an appropriate instance of |nsIWeakReference|.
  105. * As with all good XPCOM `getters', you own the resulting interface and should
  106. * manage it with an |nsCOMPtr|.
  107. *
  108. * @see nsIWeakReference
  109. * @see nsWeakPtr
  110. * @see nsCOMPtr
  111. */
  112. /* nsIWeakReference GetWeakReference (); */
  113. NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) = 0;
  114. };
  115. /* Use this macro when declaring classes that implement this interface. */
  116. #define NS_DECL_NSISUPPORTSWEAKREFERENCE \
  117. NS_IMETHOD GetWeakReference(nsIWeakReference **_retval);
  118. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  119. #define NS_FORWARD_NSISUPPORTSWEAKREFERENCE(_to) \
  120. NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return _to GetWeakReference(_retval); }
  121. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  122. #define NS_FORWARD_SAFE_NSISUPPORTSWEAKREFERENCE(_to) \
  123. NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWeakReference(_retval); }
  124. #if 0
  125. /* Use the code below as a template for the implementation class for this interface. */
  126. /* Header file */
  127. class nsSupportsWeakReference : public nsISupportsWeakReference
  128. {
  129. public:
  130. NS_DECL_ISUPPORTS
  131. NS_DECL_NSISUPPORTSWEAKREFERENCE
  132. nsSupportsWeakReference();
  133. private:
  134. ~nsSupportsWeakReference();
  135. protected:
  136. /* additional members */
  137. };
  138. /* Implementation file */
  139. NS_IMPL_ISUPPORTS1(nsSupportsWeakReference, nsISupportsWeakReference)
  140. nsSupportsWeakReference::nsSupportsWeakReference()
  141. {
  142. /* member initializers and constructor code */
  143. }
  144. nsSupportsWeakReference::~nsSupportsWeakReference()
  145. {
  146. /* destructor code */
  147. }
  148. /* nsIWeakReference GetWeakReference (); */
  149. NS_IMETHODIMP nsSupportsWeakReference::GetWeakReference(nsIWeakReference **_retval)
  150. {
  151. return NS_ERROR_NOT_IMPLEMENTED;
  152. }
  153. /* End of implementation class template. */
  154. #endif
  155. #ifdef MOZILLA_INTERNAL_API
  156. #include "nsIWeakReferenceUtils.h"
  157. #endif
  158. #endif /* __gen_nsIWeakReference_h__ */