Bumping manifests a=b2g-bump
[gecko.git] / xpcom / base / nsISupportsBase.h
blobbf5518b81013425a4ebb2a4fe9a6d9f17e1e09df
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 // IWYU pragma: private, include "nsISupports.h"
8 #ifndef nsISupportsBase_h__
9 #define nsISupportsBase_h__
11 #ifndef nscore_h___
12 #include "nscore.h"
13 #endif
15 #ifndef nsID_h__
16 #include "nsID.h"
17 #endif
20 /*@{*/
21 /**
22 * IID for the nsISupports interface
23 * {00000000-0000-0000-c000-000000000046}
25 * To maintain binary compatibility with COM's IUnknown, we define the IID
26 * of nsISupports to be the same as that of COM's IUnknown.
28 #define NS_ISUPPORTS_IID \
29 { 0x00000000, 0x0000, 0x0000, \
30 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
32 /**
33 * Basic component object model interface. Objects which implement
34 * this interface support runtime interface discovery (QueryInterface)
35 * and a reference counted memory model (AddRef/Release). This is
36 * modelled after the win32 IUnknown API.
38 class NS_NO_VTABLE nsISupports
40 public:
42 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTS_IID)
44 /**
45 * @name Methods
48 //@{
49 /**
50 * A run time mechanism for interface discovery.
51 * @param aIID [in] A requested interface IID
52 * @param aInstancePtr [out] A pointer to an interface pointer to
53 * receive the result.
54 * @return <b>NS_OK</b> if the interface is supported by the associated
55 * instance, <b>NS_NOINTERFACE</b> if it is not.
57 * aInstancePtr must not be null.
59 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0;
60 /**
61 * Increases the reference count for this interface.
62 * The associated instance will not be deleted unless
63 * the reference count is returned to zero.
65 * @return The resulting reference count.
67 NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
69 /**
70 * Decreases the reference count for this interface.
71 * Generally, if the reference count returns to zero,
72 * the associated instance is deleted.
74 * @return The resulting reference count.
76 NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
78 //@}
81 NS_DEFINE_STATIC_IID_ACCESSOR(nsISupports, NS_ISUPPORTS_IID)
83 /*@}*/
85 #endif