« XPCOM API Reference

Summary

Inherit from this C++ class to add canonical support for nsISupportsWeakReference.

See Weak reference for detailed description of weak references.

#include "nsWeakReference.h"

class nsSupportsWeakReference { ... };

Remarks

In addition to inheriting from this class, you will need to ensure that your nsISupports::QueryInterface implementation exposes nsISupportsWeakReference as a supported interface.

To use this class, you must link your component or application against the XPCOM Glue library.

Example code

 // Supporting weak references to a hypothetical implementation
 // of the nsIFoo interface...

 #include "nsWeakReference.h"
 #include "nsIFoo.h"

 class MyFoo : public nsIFoo, public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFOO

   ...
 };

 NS_IMPL_ISUPPORTS2(MyFoo, nsIFoo, nsISupportsWeakReference)

 ...

See also

nsISupports::QueryInterface , nsISupportsWeakReference