Bug 45797: replace remaining uses of deprecated macros NS_IMPL_QUERY_INTERFACE and friends with NS_IMPL_QUERY_INTERFACE1 and friends and remove the deprecated macros. r=jag sr=alecf

This commit is contained in:
dbaron@fas.harvard.edu
2001-10-02 03:18:08 +00:00
parent c4f90e00ea
commit 552e3b971c
29 changed files with 160 additions and 188 deletions

View File

@@ -111,7 +111,7 @@ public:
PRBool mOpen; PRBool mOpen;
}; };
NS_IMPL_ISUPPORTS_INHERITED(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener) NS_IMPL_ISUPPORTS_INHERITED1(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
/** /**
* A class that represents the button inside the Select to the right of the text field * A class that represents the button inside the Select to the right of the text field

View File

@@ -76,7 +76,7 @@ nsHTMLComboboxAccessible::~nsHTMLComboboxAccessible()
} }
/** Inherit the ISupports impl from nsAccessible -- handle nsIDOMXULListener ourself */ /** Inherit the ISupports impl from nsAccessible -- handle nsIDOMXULListener ourself */
NS_IMPL_ISUPPORTS_INHERITED(nsHTMLComboboxAccessible, nsAccessible, nsIDOMXULListener) NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLComboboxAccessible, nsAccessible, nsIDOMXULListener)
/** /**
* Tell our caller we are a combobox * Tell our caller we are a combobox

View File

@@ -111,7 +111,7 @@ public:
PRBool mOpen; PRBool mOpen;
}; };
NS_IMPL_ISUPPORTS_INHERITED(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener) NS_IMPL_ISUPPORTS_INHERITED1(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
/** /**
* A class that represents the button inside the Select to the right of the text field * A class that represents the button inside the Select to the right of the text field

View File

@@ -146,7 +146,7 @@ public:
BodyFixupRule* mInlineStyleRule; BodyFixupRule* mInlineStyleRule;
}; };
NS_IMPL_ISUPPORTS_INHERITED(nsBodySuper, nsGenericHTMLContainerElement, nsIBodySuper) NS_IMPL_ISUPPORTS_INHERITED1(nsBodySuper, nsGenericHTMLContainerElement, nsIBodySuper)
nsBodySuper::nsBodySuper() : nsGenericHTMLContainerElement(), nsBodySuper::nsBodySuper() : nsGenericHTMLContainerElement(),
mContentStyleRule(nsnull), mContentStyleRule(nsnull),

View File

@@ -524,7 +524,7 @@ private:
MOZ_DECL_CTOR_COUNTER(nsAnonymousContentList); MOZ_DECL_CTOR_COUNTER(nsAnonymousContentList);
NS_IMPL_ISUPPORTS_INHERITED(nsAnonymousContentList, nsGenericDOMNodeList, nsIAnonymousContentList) NS_IMPL_ISUPPORTS_INHERITED1(nsAnonymousContentList, nsGenericDOMNodeList, nsIAnonymousContentList)
nsAnonymousContentList::nsAnonymousContentList(nsISupportsArray* aElements) nsAnonymousContentList::nsAnonymousContentList(nsISupportsArray* aElements)
{ {

View File

@@ -247,7 +247,7 @@ NS_IMETHODIMP_(nsrefcnt) EditAggregateTxn::Release(void)
return EditTxn::Release(); return EditTxn::Release();
} }
//NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) //NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, AdditionalInterface)
NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{ {
if (!aInstancePtr) return NS_ERROR_NULL_POINTER; if (!aInstancePtr) return NS_ERROR_NULL_POINTER;

View File

@@ -70,7 +70,7 @@ PlaceholderTxn::~PlaceholderTxn()
NS_IMPL_ADDREF_INHERITED(PlaceholderTxn, EditAggregateTxn) NS_IMPL_ADDREF_INHERITED(PlaceholderTxn, EditAggregateTxn)
NS_IMPL_RELEASE_INHERITED(PlaceholderTxn, EditAggregateTxn) NS_IMPL_RELEASE_INHERITED(PlaceholderTxn, EditAggregateTxn)
//NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) //NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, AdditionalInterface)
NS_IMETHODIMP PlaceholderTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP PlaceholderTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{ {
if (!aInstancePtr) return NS_ERROR_NULL_POINTER; if (!aInstancePtr) return NS_ERROR_NULL_POINTER;

View File

@@ -67,7 +67,7 @@ nsHTMLEditorLog::~nsHTMLEditorLog()
StopLogging(); StopLogging();
} }
NS_IMPL_ISUPPORTS_INHERITED(nsHTMLEditorLog, nsHTMLEditor, nsIEditorLogging); NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLEditorLog, nsHTMLEditor, nsIEditorLogging)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLEditorLog::SetInlineProperty(nsIAtom *aProperty, const nsAReadableString &aAttribute, const nsAReadableString &aValue) nsHTMLEditorLog::SetInlineProperty(nsIAtom *aProperty, const nsAReadableString &aAttribute, const nsAReadableString &aValue)

View File

@@ -247,7 +247,7 @@ NS_IMETHODIMP_(nsrefcnt) EditAggregateTxn::Release(void)
return EditTxn::Release(); return EditTxn::Release();
} }
//NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) //NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, AdditionalInterface)
NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{ {
if (!aInstancePtr) return NS_ERROR_NULL_POINTER; if (!aInstancePtr) return NS_ERROR_NULL_POINTER;

View File

@@ -70,7 +70,7 @@ PlaceholderTxn::~PlaceholderTxn()
NS_IMPL_ADDREF_INHERITED(PlaceholderTxn, EditAggregateTxn) NS_IMPL_ADDREF_INHERITED(PlaceholderTxn, EditAggregateTxn)
NS_IMPL_RELEASE_INHERITED(PlaceholderTxn, EditAggregateTxn) NS_IMPL_RELEASE_INHERITED(PlaceholderTxn, EditAggregateTxn)
//NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) //NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, AdditionalInterface)
NS_IMETHODIMP PlaceholderTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP PlaceholderTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{ {
if (!aInstancePtr) return NS_ERROR_NULL_POINTER; if (!aInstancePtr) return NS_ERROR_NULL_POINTER;

View File

@@ -67,7 +67,7 @@ nsHTMLEditorLog::~nsHTMLEditorLog()
StopLogging(); StopLogging();
} }
NS_IMPL_ISUPPORTS_INHERITED(nsHTMLEditorLog, nsHTMLEditor, nsIEditorLogging); NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLEditorLog, nsHTMLEditor, nsIEditorLogging)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLEditorLog::SetInlineProperty(nsIAtom *aProperty, const nsAReadableString &aAttribute, const nsAReadableString &aValue) nsHTMLEditorLog::SetInlineProperty(nsIAtom *aProperty, const nsAReadableString &aAttribute, const nsAReadableString &aValue)

View File

@@ -46,7 +46,7 @@ inDOMRDFResource::~inDOMRDFResource()
{ {
} }
NS_IMPL_ISUPPORTS_INHERITED(inDOMRDFResource, nsRDFResource, inIDOMRDFResource) NS_IMPL_ISUPPORTS_INHERITED1(inDOMRDFResource, nsRDFResource, inIDOMRDFResource)
NS_IMETHODIMP NS_IMETHODIMP
inDOMRDFResource::SetObject(nsISupports* object) inDOMRDFResource::SetObject(nsISupports* object)

View File

@@ -45,9 +45,7 @@ PyXPCOM_GatewayWeakReference::~PyXPCOM_GatewayWeakReference()
m_pBase = NULL; m_pBase = NULL;
} }
NS_IMPL_THREADSAFE_ADDREF(PyXPCOM_GatewayWeakReference); NS_IMPL_THREADSAFE_ISUPPORTS1(PyXPCOM_GatewayWeakReference, nsIWeakReference)
NS_IMPL_THREADSAFE_RELEASE(PyXPCOM_GatewayWeakReference);
NS_IMPL_THREADSAFE_QUERY_INTERFACE(PyXPCOM_GatewayWeakReference, NS_GET_IID(nsIWeakReference));
NS_IMETHODIMP NS_IMETHODIMP
PyXPCOM_GatewayWeakReference::QueryReferent(REFNSIID iid, void * *ret) PyXPCOM_GatewayWeakReference::QueryReferent(REFNSIID iid, void * *ret)

View File

@@ -75,9 +75,9 @@ nsDeviceContextPS :: SetSpec(nsIDeviceContextSpec* aSpec)
return NS_OK; return NS_OK;
} }
NS_IMPL_ISUPPORTS_INHERITED(nsDeviceContextPS, NS_IMPL_ISUPPORTS_INHERITED1(nsDeviceContextPS,
DeviceContextImpl, DeviceContextImpl,
nsIDeviceContextPS) nsIDeviceContextPS)
/** --------------------------------------------------- /** ---------------------------------------------------
* See documentation in nsDeviceContextPS.h * See documentation in nsDeviceContextPS.h

View File

@@ -93,9 +93,9 @@ nsDeviceContextXp :: SetSpec(nsIDeviceContextSpec* aSpec)
return rv; return rv;
} }
NS_IMPL_ISUPPORTS_INHERITED(nsDeviceContextXp, NS_IMPL_ISUPPORTS_INHERITED1(nsDeviceContextXp,
DeviceContextImpl, DeviceContextImpl,
nsIDeviceContextXp) nsIDeviceContextXp)
/** --------------------------------------------------- /** ---------------------------------------------------
* See documentation in nsDeviceContextXp.h * See documentation in nsDeviceContextXp.h

View File

@@ -49,7 +49,6 @@
/* define CID & IID */ /* define CID & IID */
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
NS_DEFINE_IID(kAcceptLangCID, NS_ACCEPTLANG_CID);
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
@@ -79,7 +78,7 @@ nsAcceptLang::~nsAcceptLang()
/* destructor code */ /* destructor code */
} }
// NS_IMPL_THREADSAFE_ISUPPORTS(nsAcceptLang, NS_GET_IID(nsIAcceptLang)) // NS_IMPL_THREADSAFE_ISUPPORTS1(nsAcceptLang, nsIAcceptLang)
/* wstring getAcceptLangFromLocale ([const] in wstring aLocale); */ /* wstring getAcceptLangFromLocale ([const] in wstring aLocale); */
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -76,7 +76,7 @@ NS_IMETHODIMP xpctestOther::Method3(PRInt16 i, PRInt16 j, PRInt16 k)
return NS_OK; return NS_OK;
} }
NS_IMPL_ISUPPORTS_INHERITED(xpctestChild, xpctestOther, nsIXPCTestChild) NS_IMPL_ISUPPORTS_INHERITED1(xpctestChild, xpctestOther, nsIXPCTestChild)
xpctestChild::xpctestChild() xpctestChild::xpctestChild()
{ {

View File

@@ -60,7 +60,7 @@ protected:
}; };
/* Implementation file */ /* Implementation file */
NS_IMPL_ISUPPORTS_INHERITED(nsEditorBoxObject, nsBoxObject, nsIEditorBoxObject) NS_IMPL_ISUPPORTS_INHERITED1(nsEditorBoxObject, nsBoxObject, nsIEditorBoxObject)
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -64,7 +64,7 @@ public:
}; };
/* Implementation file */ /* Implementation file */
NS_IMPL_ISUPPORTS_INHERITED(nsOutlinerBoxObject, nsBoxObject, nsIOutlinerBoxObject) NS_IMPL_ISUPPORTS_INHERITED1(nsOutlinerBoxObject, nsBoxObject, nsIOutlinerBoxObject)
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -64,7 +64,7 @@ public:
}; };
/* Implementation file */ /* Implementation file */
NS_IMPL_ISUPPORTS_INHERITED(nsOutlinerBoxObject, nsBoxObject, nsIOutlinerBoxObject) NS_IMPL_ISUPPORTS_INHERITED1(nsOutlinerBoxObject, nsBoxObject, nsIOutlinerBoxObject)
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -124,4 +124,4 @@ void EmbeddedFramePluginInstance::setFrame(EmbeddedFrame* frame)
mFrame = frame; mFrame = frame;
} }
NS_IMPL_ISUPPORTS(EmbeddedFramePluginInstance, NS_GET_IID(nsIPluginInstance)) NS_IMPL_ISUPPORTS1(EmbeddedFramePluginInstance, nsIPluginInstance)

View File

@@ -63,7 +63,7 @@ JSEvaluator::~JSEvaluator()
delete mJSMonitor; delete mJSMonitor;
} }
NS_IMPL_ISUPPORTS(JSEvaluator, NS_GET_IID(nsIPluginStreamListener)) NS_IMPL_ISUPPORTS1(JSEvaluator, nsIPluginStreamListener)
const char* JSEvaluator::eval(const char* script) const char* JSEvaluator::eval(const char* script)
{ {

View File

@@ -28,7 +28,7 @@ nsRDFDOMViewerElement::~nsRDFDOMViewerElement()
{ {
} }
NS_IMPL_ISUPPORTS_INHERITED(nsRDFDOMViewerElement, nsRDFResource, nsIDOMViewerElement) NS_IMPL_ISUPPORTS_INHERITED1(nsRDFDOMViewerElement, nsRDFResource, nsIDOMViewerElement)
NS_IMETHODIMP NS_IMETHODIMP
nsRDFDOMViewerElement::SetObject(nsISupports* object) nsRDFDOMViewerElement::SetObject(nsISupports* object)

View File

@@ -56,9 +56,7 @@ static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
NS_IMPL_ADDREF_INHERITED(nsButton, nsWidget) NS_IMPL_ISUPPORTS_INHERITED1(nsButton, nsWidget, nsIButton)
NS_IMPL_RELEASE_INHERITED(nsButton, nsWidget)
NS_IMPL_QUERY_INTERFACE_INHERITED(nsButton, nsWidget, nsIButton)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// //
// nsButton constructor // nsButton constructor

View File

@@ -166,7 +166,7 @@ nsWidget::~nsWidget( ) {
// nsISupport stuff // nsISupport stuff
// //
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED(nsWidget, nsBaseWidget, nsIKBStateControl) NS_IMPL_ISUPPORTS_INHERITED1(nsWidget, nsBaseWidget, nsIKBStateControl)
NS_METHOD nsWidget::WidgetToScreen( const nsRect& aOldRect, nsRect& aNewRect ) { NS_METHOD nsWidget::WidgetToScreen( const nsRect& aOldRect, nsRect& aNewRect ) {
if( mWidget ) { if( mWidget ) {

View File

@@ -703,7 +703,7 @@ NS_IMETHODIMP nsWidget::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
return NS_OK; return NS_OK;
} }
NS_IMPL_ISUPPORTS_INHERITED(nsWidget, nsBaseWidget, nsISupportsWeakReference) NS_IMPL_ISUPPORTS_INHERITED1(nsWidget, nsBaseWidget, nsISupportsWeakReference)
NS_IMETHODIMP nsWidget::WidgetToScreen(const nsRect& aOldRect, NS_IMETHODIMP nsWidget::WidgetToScreen(const nsRect& aOldRect,
nsRect& aNewRect) nsRect& aNewRect)

View File

@@ -460,8 +460,71 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
NS_IMPL_QUERY_BODY(i6) \ NS_IMPL_QUERY_BODY(i6) \
NS_IMPL_QUERY_TAIL_INHERITING(Super) \ NS_IMPL_QUERY_TAIL_INHERITING(Super) \
#define NS_IMPL_ISUPPORTS_INHERITED(Class, Super, i1) \ /**
NS_IMPL_ISUPPORTS_INHERITED1(Class, Super, i1) \ * Convenience macros for implementing all nsISupports methods for
* a simple class.
* @param _class The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*/
#define NS_IMPL_ISUPPORTS0(_class) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE0(_class)
#define NS_IMPL_ISUPPORTS1(_class, _interface) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE1(_class, _interface)
#define NS_IMPL_ISUPPORTS2(_class, _i1, _i2) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2)
#define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
#define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
#define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
#define NS_IMPL_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
#define NS_IMPL_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
#define NS_IMPL_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
#define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9)
#define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9, _i10) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9, _i10)
#define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \ #define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \
NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \ NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
@@ -544,23 +607,6 @@ nsrefcnt _class::Release(void) \
return count; \ return count; \
} }
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
if (NULL == aInstancePtr) { \
return NS_ERROR_NULL_POINTER; \
} \
\
*aInstancePtr = NULL; \
\
if (aIID.Equals(NS_GET_IID(nsISupports))) { \
*aInstancePtr = (void*) ((nsISupports*)this); \
NS_ADDREF_THIS(); \
return NS_OK; \
} \
return NS_NOINTERFACE; \
}
#else // defined(NS_MT_SUPPORTED) #else // defined(NS_MT_SUPPORTED)
/** /**
@@ -575,9 +621,6 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
#define NS_IMPL_THREADSAFE_RELEASE(_class) NS_IMPL_RELEASE(_class) #define NS_IMPL_THREADSAFE_RELEASE(_class) NS_IMPL_RELEASE(_class)
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \
NS_IMPL_QUERY_INTERFACE(_class, _classiiddef)
#endif /* !NS_MT_SUPPORTED */ #endif /* !NS_MT_SUPPORTED */
#define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \ #define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \

View File

@@ -295,118 +295,9 @@ NS_IMPL_SETTER_STR(_class::Set##_postfix, _member)
#define NS_VERIFY_THREADSAFE_INTERFACE(_iface) #define NS_VERIFY_THREADSAFE_INTERFACE(_iface)
#endif #endif
#define NS_IMPL_THREADSAFE_ISUPPORTS(_class,_classiiddef) \
NS_IMPL_THREADSAFE_ADDREF(_class) \
NS_IMPL_THREADSAFE_RELEASE(_class) \
NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef)
/*
The following macro is deprecated. We need to switch all instances
to |NS_IMPL_QUERY_INTERFACE1|, or |NS_IMPL_QUERY_INTERFACE0| depending
on how they were using it.
*/
#define NS_IMPL_QUERY_INTERFACE(_class,_classiiddef) \
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
if (NULL == aInstancePtr) { \
return NS_ERROR_NULL_POINTER; \
} \
\
*aInstancePtr = NULL; \
\
static NS_DEFINE_IID(kClassIID, _classiiddef); \
if (aIID.Equals(kClassIID)) { \
*aInstancePtr = (void*) this; \
NS_ADDREF_THIS(); \
return NS_OK; \
} \
if (aIID.Equals(NS_GET_IID(nsISupports))) { \
*aInstancePtr = (void*) ((nsISupports*)this); \
NS_ADDREF_THIS(); \
return NS_OK; \
} \
return NS_NOINTERFACE; \
}
/**
* Convenience macro for implementing all nsISupports methods for
* a simple class.
* @param _class The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*/
#define NS_IMPL_ISUPPORTS(_class,_classiiddef) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE(_class,_classiiddef)
#define NS_IMPL_ISUPPORTS0(_class) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE0(_class)
#define NS_IMPL_ISUPPORTS1(_class, _interface) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE1(_class, _interface)
#define NS_IMPL_ISUPPORTS2(_class, _i1, _i2) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2)
#define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
#define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
#define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
#define NS_IMPL_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
#define NS_IMPL_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
#define NS_IMPL_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
#define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9)
#define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9, _i10) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9, _i10)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#define NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, i1) \
NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1)
// below should go into nsIMemoryUtils.h or something similar. // below should go into nsIMemoryUtils.h or something similar.
/** /**

View File

@@ -460,8 +460,71 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
NS_IMPL_QUERY_BODY(i6) \ NS_IMPL_QUERY_BODY(i6) \
NS_IMPL_QUERY_TAIL_INHERITING(Super) \ NS_IMPL_QUERY_TAIL_INHERITING(Super) \
#define NS_IMPL_ISUPPORTS_INHERITED(Class, Super, i1) \ /**
NS_IMPL_ISUPPORTS_INHERITED1(Class, Super, i1) \ * Convenience macros for implementing all nsISupports methods for
* a simple class.
* @param _class The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*/
#define NS_IMPL_ISUPPORTS0(_class) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE0(_class)
#define NS_IMPL_ISUPPORTS1(_class, _interface) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE1(_class, _interface)
#define NS_IMPL_ISUPPORTS2(_class, _i1, _i2) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2)
#define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
#define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
#define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
#define NS_IMPL_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
#define NS_IMPL_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
#define NS_IMPL_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
#define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9)
#define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9, _i10) \
NS_IMPL_ADDREF(_class) \
NS_IMPL_RELEASE(_class) \
NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
_i9, _i10)
#define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \ #define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \
NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \ NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
@@ -544,23 +607,6 @@ nsrefcnt _class::Release(void) \
return count; \ return count; \
} }
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
{ \
if (NULL == aInstancePtr) { \
return NS_ERROR_NULL_POINTER; \
} \
\
*aInstancePtr = NULL; \
\
if (aIID.Equals(NS_GET_IID(nsISupports))) { \
*aInstancePtr = (void*) ((nsISupports*)this); \
NS_ADDREF_THIS(); \
return NS_OK; \
} \
return NS_NOINTERFACE; \
}
#else // defined(NS_MT_SUPPORTED) #else // defined(NS_MT_SUPPORTED)
/** /**
@@ -575,9 +621,6 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
#define NS_IMPL_THREADSAFE_RELEASE(_class) NS_IMPL_RELEASE(_class) #define NS_IMPL_THREADSAFE_RELEASE(_class) NS_IMPL_RELEASE(_class)
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \
NS_IMPL_QUERY_INTERFACE(_class, _classiiddef)
#endif /* !NS_MT_SUPPORTED */ #endif /* !NS_MT_SUPPORTED */
#define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \ #define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \