1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/base/nsISupportsBase.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,82 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +// IWYU pragma: private, include "nsISupports.h" 1.8 + 1.9 +#ifndef nsISupportsBase_h__ 1.10 +#define nsISupportsBase_h__ 1.11 + 1.12 +#ifndef nscore_h___ 1.13 +#include "nscore.h" 1.14 +#endif 1.15 + 1.16 +#ifndef nsID_h__ 1.17 +#include "nsID.h" 1.18 +#endif 1.19 + 1.20 + 1.21 +/*@{*/ 1.22 +/** 1.23 + * IID for the nsISupports interface 1.24 + * {00000000-0000-0000-c000-000000000046} 1.25 + * 1.26 + * To maintain binary compatibility with COM's IUnknown, we define the IID 1.27 + * of nsISupports to be the same as that of COM's IUnknown. 1.28 + */ 1.29 +#define NS_ISUPPORTS_IID \ 1.30 + { 0x00000000, 0x0000, 0x0000, \ 1.31 + {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} } 1.32 + 1.33 +/** 1.34 + * Basic component object model interface. Objects which implement 1.35 + * this interface support runtime interface discovery (QueryInterface) 1.36 + * and a reference counted memory model (AddRef/Release). This is 1.37 + * modelled after the win32 IUnknown API. 1.38 + */ 1.39 +class NS_NO_VTABLE nsISupports { 1.40 +public: 1.41 + 1.42 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTS_IID) 1.43 + 1.44 + /** 1.45 + * @name Methods 1.46 + */ 1.47 + 1.48 + //@{ 1.49 + /** 1.50 + * A run time mechanism for interface discovery. 1.51 + * @param aIID [in] A requested interface IID 1.52 + * @param aInstancePtr [out] A pointer to an interface pointer to 1.53 + * receive the result. 1.54 + * @return <b>NS_OK</b> if the interface is supported by the associated 1.55 + * instance, <b>NS_NOINTERFACE</b> if it is not. 1.56 + * 1.57 + * aInstancePtr must not be null. 1.58 + */ 1.59 + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0; 1.60 + /** 1.61 + * Increases the reference count for this interface. 1.62 + * The associated instance will not be deleted unless 1.63 + * the reference count is returned to zero. 1.64 + * 1.65 + * @return The resulting reference count. 1.66 + */ 1.67 + NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0; 1.68 + 1.69 + /** 1.70 + * Decreases the reference count for this interface. 1.71 + * Generally, if the reference count returns to zero, 1.72 + * the associated instance is deleted. 1.73 + * 1.74 + * @return The resulting reference count. 1.75 + */ 1.76 + NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0; 1.77 + 1.78 + //@} 1.79 +}; 1.80 + 1.81 +NS_DEFINE_STATIC_IID_ACCESSOR(nsISupports, NS_ISUPPORTS_IID) 1.82 + 1.83 +/*@}*/ 1.84 + 1.85 +#endif