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