michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0: // IWYU pragma: private, include "nsISupports.h"
michael@0:
michael@0: #ifndef nsISupportsBase_h__
michael@0: #define nsISupportsBase_h__
michael@0:
michael@0: #ifndef nscore_h___
michael@0: #include "nscore.h"
michael@0: #endif
michael@0:
michael@0: #ifndef nsID_h__
michael@0: #include "nsID.h"
michael@0: #endif
michael@0:
michael@0:
michael@0: /*@{*/
michael@0: /**
michael@0: * IID for the nsISupports interface
michael@0: * {00000000-0000-0000-c000-000000000046}
michael@0: *
michael@0: * To maintain binary compatibility with COM's IUnknown, we define the IID
michael@0: * of nsISupports to be the same as that of COM's IUnknown.
michael@0: */
michael@0: #define NS_ISUPPORTS_IID \
michael@0: { 0x00000000, 0x0000, 0x0000, \
michael@0: {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
michael@0:
michael@0: /**
michael@0: * Basic component object model interface. Objects which implement
michael@0: * this interface support runtime interface discovery (QueryInterface)
michael@0: * and a reference counted memory model (AddRef/Release). This is
michael@0: * modelled after the win32 IUnknown API.
michael@0: */
michael@0: class NS_NO_VTABLE nsISupports {
michael@0: public:
michael@0:
michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTS_IID)
michael@0:
michael@0: /**
michael@0: * @name Methods
michael@0: */
michael@0:
michael@0: //@{
michael@0: /**
michael@0: * A run time mechanism for interface discovery.
michael@0: * @param aIID [in] A requested interface IID
michael@0: * @param aInstancePtr [out] A pointer to an interface pointer to
michael@0: * receive the result.
michael@0: * @return NS_OK if the interface is supported by the associated
michael@0: * instance, NS_NOINTERFACE if it is not.
michael@0: *
michael@0: * aInstancePtr must not be null.
michael@0: */
michael@0: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0;
michael@0: /**
michael@0: * Increases the reference count for this interface.
michael@0: * The associated instance will not be deleted unless
michael@0: * the reference count is returned to zero.
michael@0: *
michael@0: * @return The resulting reference count.
michael@0: */
michael@0: NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
michael@0:
michael@0: /**
michael@0: * Decreases the reference count for this interface.
michael@0: * Generally, if the reference count returns to zero,
michael@0: * the associated instance is deleted.
michael@0: *
michael@0: * @return The resulting reference count.
michael@0: */
michael@0: NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
michael@0:
michael@0: //@}
michael@0: };
michael@0:
michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsISupports, NS_ISUPPORTS_IID)
michael@0:
michael@0: /*@}*/
michael@0:
michael@0: #endif