/gecko_api/include/nsIWeakReference.h

http://firefox-mac-pdf.googlecode.com/ · C Header · 207 lines · 90 code · 47 blank · 70 comment · 0 complexity · 4cd991c7dfc31668dbe81df0945d8458 MD5 · raw file

  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/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 NS_SCRIPTABLE nsIWeakReference : public nsISupports {
  34. public:
  35. NS_DECLARE_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_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) = 0;
  44. };
  45. NS_DEFINE_STATIC_IID_ACCESSOR(nsIWeakReference, NS_IWEAKREFERENCE_IID)
  46. /* Use this macro when declaring classes that implement this interface. */
  47. #define NS_DECL_NSIWEAKREFERENCE \
  48. NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result);
  49. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  50. #define NS_FORWARD_NSIWEAKREFERENCE(_to) \
  51. NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return _to QueryReferent(uuid, result); }
  52. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  53. #define NS_FORWARD_SAFE_NSIWEAKREFERENCE(_to) \
  54. NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryReferent(uuid, result); }
  55. #if 0
  56. /* Use the code below as a template for the implementation class for this interface. */
  57. /* Header file */
  58. class nsWeakReference : public nsIWeakReference
  59. {
  60. public:
  61. NS_DECL_ISUPPORTS
  62. NS_DECL_NSIWEAKREFERENCE
  63. nsWeakReference();
  64. private:
  65. ~nsWeakReference();
  66. protected:
  67. /* additional members */
  68. };
  69. /* Implementation file */
  70. NS_IMPL_ISUPPORTS1(nsWeakReference, nsIWeakReference)
  71. nsWeakReference::nsWeakReference()
  72. {
  73. /* member initializers and constructor code */
  74. }
  75. nsWeakReference::~nsWeakReference()
  76. {
  77. /* destructor code */
  78. }
  79. /* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  80. NS_IMETHODIMP nsWeakReference::QueryReferent(const nsIID & uuid, void * *result)
  81. {
  82. return NS_ERROR_NOT_IMPLEMENTED;
  83. }
  84. /* End of implementation class template. */
  85. #endif
  86. /* starting interface: nsISupportsWeakReference */
  87. #define NS_ISUPPORTSWEAKREFERENCE_IID_STR "9188bc86-f92e-11d2-81ef-0060083a0bcf"
  88. #define NS_ISUPPORTSWEAKREFERENCE_IID \
  89. {0x9188bc86, 0xf92e, 0x11d2, \
  90. { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
  91. /**
  92. * |nsISupportsWeakReference| is a factory interface which produces appropriate
  93. * instances of |nsIWeakReference|. Weak references in this scheme can only be
  94. * produced for objects that implement this interface.
  95. *
  96. * @status FROZEN
  97. * @version 1.0
  98. * @see nsIWeakReference
  99. * @see nsSupportsWeakReference
  100. */
  101. class NS_NO_VTABLE NS_SCRIPTABLE nsISupportsWeakReference : public nsISupports {
  102. public:
  103. NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTSWEAKREFERENCE_IID)
  104. /**
  105. * |GetWeakReference| produces an appropriate instance of |nsIWeakReference|.
  106. * As with all good XPCOM `getters', you own the resulting interface and should
  107. * manage it with an |nsCOMPtr|.
  108. *
  109. * @see nsIWeakReference
  110. * @see nsWeakPtr
  111. * @see nsCOMPtr
  112. */
  113. /* nsIWeakReference GetWeakReference (); */
  114. NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) = 0;
  115. };
  116. NS_DEFINE_STATIC_IID_ACCESSOR(nsISupportsWeakReference, NS_ISUPPORTSWEAKREFERENCE_IID)
  117. /* Use this macro when declaring classes that implement this interface. */
  118. #define NS_DECL_NSISUPPORTSWEAKREFERENCE \
  119. NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval);
  120. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  121. #define NS_FORWARD_NSISUPPORTSWEAKREFERENCE(_to) \
  122. NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return _to GetWeakReference(_retval); }
  123. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  124. #define NS_FORWARD_SAFE_NSISUPPORTSWEAKREFERENCE(_to) \
  125. NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWeakReference(_retval); }
  126. #if 0
  127. /* Use the code below as a template for the implementation class for this interface. */
  128. /* Header file */
  129. class nsSupportsWeakReference : public nsISupportsWeakReference
  130. {
  131. public:
  132. NS_DECL_ISUPPORTS
  133. NS_DECL_NSISUPPORTSWEAKREFERENCE
  134. nsSupportsWeakReference();
  135. private:
  136. ~nsSupportsWeakReference();
  137. protected:
  138. /* additional members */
  139. };
  140. /* Implementation file */
  141. NS_IMPL_ISUPPORTS1(nsSupportsWeakReference, nsISupportsWeakReference)
  142. nsSupportsWeakReference::nsSupportsWeakReference()
  143. {
  144. /* member initializers and constructor code */
  145. }
  146. nsSupportsWeakReference::~nsSupportsWeakReference()
  147. {
  148. /* destructor code */
  149. }
  150. /* nsIWeakReference GetWeakReference (); */
  151. NS_IMETHODIMP nsSupportsWeakReference::GetWeakReference(nsIWeakReference **_retval)
  152. {
  153. return NS_ERROR_NOT_IMPLEMENTED;
  154. }
  155. /* End of implementation class template. */
  156. #endif
  157. #ifdef MOZILLA_INTERNAL_API
  158. #include "nsIWeakReferenceUtils.h"
  159. #endif
  160. #endif /* __gen_nsIWeakReference_h__ */