xpcom/base/nsISupportsBase.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     4 // IWYU pragma: private, include "nsISupports.h"
     6 #ifndef nsISupportsBase_h__
     7 #define nsISupportsBase_h__
     9 #ifndef nscore_h___
    10 #include "nscore.h"
    11 #endif
    13 #ifndef nsID_h__
    14 #include "nsID.h"
    15 #endif
    18 /*@{*/
    19 /**
    20  * IID for the nsISupports interface
    21  * {00000000-0000-0000-c000-000000000046}
    22  *
    23  * To maintain binary compatibility with COM's IUnknown, we define the IID
    24  * of nsISupports to be the same as that of COM's IUnknown.
    25  */
    26 #define NS_ISUPPORTS_IID                                                      \
    27   { 0x00000000, 0x0000, 0x0000,                                               \
    28     {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
    30 /**
    31  * Basic component object model interface. Objects which implement
    32  * this interface support runtime interface discovery (QueryInterface)
    33  * and a reference counted memory model (AddRef/Release). This is
    34  * modelled after the win32 IUnknown API.
    35  */
    36 class NS_NO_VTABLE nsISupports {
    37 public:
    39   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTS_IID)
    41   /**
    42    * @name Methods
    43    */
    45   //@{
    46   /**
    47    * A run time mechanism for interface discovery.
    48    * @param aIID [in] A requested interface IID
    49    * @param aInstancePtr [out] A pointer to an interface pointer to
    50    * receive the result.
    51    * @return <b>NS_OK</b> if the interface is supported by the associated
    52    * instance, <b>NS_NOINTERFACE</b> if it is not.
    53    *
    54    * aInstancePtr must not be null.
    55    */
    56   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) = 0;
    57   /**
    58    * Increases the reference count for this interface.
    59    * The associated instance will not be deleted unless
    60    * the reference count is returned to zero.
    61    *
    62    * @return The resulting reference count.
    63    */
    64   NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
    66   /**
    67    * Decreases the reference count for this interface.
    68    * Generally, if the reference count returns to zero,
    69    * the associated instance is deleted.
    70    *
    71    * @return The resulting reference count.
    72    */
    73   NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
    75   //@}
    76 };
    78 NS_DEFINE_STATIC_IID_ACCESSOR(nsISupports, NS_ISUPPORTS_IID)
    80 /*@}*/
    82 #endif

mercurial