Use NS_IMPL_ISUPPPORTS macros where possible. b=387211 r=neil sr=dbaron a19=pavlov

This commit is contained in:
mats.palmgren@bredband.net 2007-08-07 08:18:36 -07:00
parent 3e1121fbf6
commit 07a2d5f8f3
16 changed files with 29 additions and 273 deletions

View File

@ -271,8 +271,6 @@ public:
{
}
NS_DECL_ISUPPORTS_INHERITED
// nsIFormSubmission
virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource,
const nsAString& aName,
@ -320,10 +318,6 @@ private:
PRBool mWarnedFileControl;
};
NS_IMPL_RELEASE_INHERITED(nsFSURLEncoded, nsFormSubmission)
NS_IMPL_ADDREF_INHERITED(nsFSURLEncoded, nsFormSubmission)
NS_IMPL_QUERY_INTERFACE_INHERITED0(nsFSURLEncoded, nsFormSubmission)
nsresult
nsFSURLEncoded::AddNameValuePair(nsIDOMHTMLElement* aSource,
const nsAString& aName,
@ -611,8 +605,6 @@ public:
PRInt32 aBidiOptions);
virtual ~nsFSMultipartFormData() { }
NS_DECL_ISUPPORTS_INHERITED
// nsIFormSubmission
virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource,
const nsAString& aName,
@ -692,10 +684,6 @@ private:
nsCString mBoundary;
};
NS_IMPL_RELEASE_INHERITED(nsFSMultipartFormData, nsFormSubmission)
NS_IMPL_ADDREF_INHERITED(nsFSMultipartFormData, nsFormSubmission)
NS_IMPL_QUERY_INTERFACE_INHERITED0(nsFSMultipartFormData, nsFormSubmission)
//
// Constructor
//
@ -937,8 +925,6 @@ public:
{
}
NS_DECL_ISUPPORTS_INHERITED
// nsIFormSubmission
virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource,
const nsAString& aName,
@ -965,10 +951,6 @@ private:
nsString mBody;
};
NS_IMPL_RELEASE_INHERITED(nsFSTextPlain, nsFormSubmission)
NS_IMPL_ADDREF_INHERITED(nsFSTextPlain, nsFormSubmission)
NS_IMPL_QUERY_INTERFACE_INHERITED0(nsFSTextPlain, nsFormSubmission)
nsresult
nsFSTextPlain::AddNameValuePair(nsIDOMHTMLElement* aSource,
const nsAString& aName,

View File

@ -569,11 +569,7 @@ private:
PRUint32 mDelay;
};
NS_IMPL_ADDREF(nsAutoScrollTimer)
NS_IMPL_RELEASE(nsAutoScrollTimer)
NS_IMPL_QUERY_INTERFACE1(nsAutoScrollTimer, nsITimerCallback)
nsresult NS_NewSelection(nsFrameSelection **aFrameSelection);
NS_IMPL_ISUPPORTS1(nsAutoScrollTimer, nsITimerCallback)
nsresult NS_NewSelection(nsFrameSelection **aFrameSelection)
{
@ -585,8 +581,6 @@ nsresult NS_NewSelection(nsFrameSelection **aFrameSelection)
return NS_OK;
}
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
nsresult NS_NewDomSelection(nsISelection **aDomSelection)
{
nsTypedSelection *rlist = new nsTypedSelection;

View File

@ -45,47 +45,27 @@
#include "nsMenuBarListener.h"
#include "nsMenuFrame.h"
#include "nsMenuPopupFrame.h"
#include "nsPopupSetFrame.h"
class nsMenuBoxObject : public nsIMenuBoxObject, public nsBoxObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIMENUBOXOBJECT
nsMenuBoxObject();
virtual ~nsMenuBoxObject();
protected:
};
/* Implementation file */
NS_IMPL_ADDREF(nsMenuBoxObject)
NS_IMPL_RELEASE(nsMenuBoxObject)
NS_IMETHODIMP
nsMenuBoxObject::QueryInterface(REFNSIID iid, void** aResult)
{
NS_PRECONDITION(aResult, "null out param");
if (iid.Equals(NS_GET_IID(nsIMenuBoxObject))) {
*aResult = static_cast<nsIMenuBoxObject*>(this);
NS_ADDREF(this);
return NS_OK;
}
return nsBoxObject::QueryInterface(iid, aResult);
}
nsMenuBoxObject::nsMenuBoxObject()
{
}
nsMenuBoxObject::~nsMenuBoxObject()
{
/* destructor code */
}
NS_IMPL_ISUPPORTS_INHERITED1(nsMenuBoxObject, nsBoxObject, nsIMenuBoxObject)
/* void openMenu (in boolean openFlag); */
NS_IMETHODIMP nsMenuBoxObject::OpenMenu(PRBool aOpenFlag)
{

View File

@ -79,58 +79,16 @@ GlobalPrinters GlobalPrinters::mGlobalPrinters;
nsStringArray* GlobalPrinters::mGlobalPrinterList = nsnull;
int GlobalPrinters::mGlobalNumPrinters = 0;
/** -------------------------------------------------------
* Construct the nsDeviceContextSpecBeOS
* @update dc 12/02/98
*/
nsDeviceContextSpecBeOS :: nsDeviceContextSpecBeOS()
nsDeviceContextSpecBeOS::nsDeviceContextSpecBeOS()
{
}
/** -------------------------------------------------------
* Destroy the nsDeviceContextSpecBeOS
* @update dc 2/15/98
*/
nsDeviceContextSpecBeOS :: ~nsDeviceContextSpecBeOS()
nsDeviceContextSpecBeOS::~nsDeviceContextSpecBeOS()
{
}
static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID);
#if 0
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecBeOS, nsIDeviceContextSpec)
#endif
NS_IMETHODIMP nsDeviceContextSpecBeOS :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kIDeviceContextSpecIID))
{
nsIDeviceContextSpec* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))
{
nsIDeviceContextSpec* tmp = this;
nsISupports* tmp2 = tmp;
*aInstancePtr = (void*) tmp2;
NS_ADDREF_THIS();
return NS_OK;
}
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
NS_IMPL_ADDREF(nsDeviceContextSpecBeOS)
NS_IMPL_RELEASE(nsDeviceContextSpecBeOS)
/** -------------------------------------------------------
* Initialize the nsDeviceContextSpecBeOS
* @update dc 2/15/98

View File

@ -61,9 +61,6 @@ public:
nsDragService();
virtual ~nsDragService();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDragService
NS_IMETHOD InvokeDragSession(nsIDOMNode *aDOMNode, nsISupportsArray * anArrayTransferables,
nsIScriptableRegion * aRegion, PRUint32 aActionType);

View File

@ -75,23 +75,15 @@ nsISupportsArray *gDraggedTransferables = nsnull;
NSString* const kWildcardPboardType = @"MozillaWildcard";
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_QUERY_INTERFACE2(nsDragService, nsIDragService, nsIDragSession)
nsDragService::nsDragService()
{
}
nsDragService::~nsDragService()
{
}
static nsresult SetUpDragClipboard(nsISupportsArray* aTransferableArray)
{
if (!aTransferableArray)

View File

@ -50,7 +50,6 @@
#include "nsISupportsPrimitives.h"
#include "prlog.h"
#include "nsVoidArray.h"
#include "nsXPIDLString.h"
#include "nsPrimitiveHelpers.h"
#include "prtime.h"
#include "prthread.h"
@ -67,14 +66,6 @@ static const char gMimeListType[] = "application/x-moz-internal-item-list";
static const char gMozUrlType[] = "_NETSCAPE_URL";
static const char gTextUriListType[] = "text/uri-list";
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_QUERY_INTERFACE4(nsDragService,
nsIDragService,
nsIDragSession,
nsIDragSessionGTK,
nsIObserver)
static void
invisibleSourceDragEnd(GtkWidget *aWidget,
GdkDragContext *aContext,
@ -126,6 +117,9 @@ nsDragService::~nsDragService()
PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::~nsDragService"));
}
NS_IMPL_ISUPPORTS_INHERITED2(nsDragService, nsBaseDragService,
nsIDragSessionGTK, nsIObserver)
// nsIObserver
NS_IMETHODIMP

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -90,26 +91,18 @@ nsStringArray* GlobalPrinters::mGlobalPrinterList = nsnull;
ULONG GlobalPrinters::mGlobalNumPrinters = 0;
//---------------
/** -------------------------------------------------------
* Construct the nsDeviceContextSpecOS2
* @update dc 12/02/98
*/
nsDeviceContextSpecOS2 :: nsDeviceContextSpecOS2()
nsDeviceContextSpecOS2::nsDeviceContextSpecOS2()
: mQueue(nsnull)
{
mQueue = nsnull;
}
/** -------------------------------------------------------
* Destroy the nsDeviceContextSpecOS2
* @update dc 2/15/98
*/
nsDeviceContextSpecOS2 :: ~nsDeviceContextSpecOS2()
nsDeviceContextSpecOS2::~nsDeviceContextSpecOS2()
{
if( mQueue)
PrnClosePrinter( mQueue);
if (mQueue)
PrnClosePrinter(mQueue);
}
static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID);
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecOS2, nsIDeviceContextSpec)
void SetupDevModeFromSettings(ULONG printer, nsIPrintSettings* aPrintSettings)
{
@ -219,36 +212,6 @@ nsresult nsDeviceContextSpecOS2::SetPrintSettingsFromDevMode(nsIPrintSettings* a
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextSpecOS2 :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kIDeviceContextSpecIID))
{
nsIDeviceContextSpec* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))
{
nsIDeviceContextSpec* tmp = this;
nsISupports* tmp2 = tmp;
*aInstancePtr = (void*) tmp2;
NS_ADDREF_THIS();
return NS_OK;
}
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
NS_IMPL_ADDREF(nsDeviceContextSpecOS2)
NS_IMPL_RELEASE(nsDeviceContextSpecOS2)
NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIWidget *aWidget,
nsIPrintSettings* aPS,
PRBool aIsPrintPreview)

View File

@ -56,11 +56,6 @@
#include "nsIDocument.h"
#include "nsGUIEvent.h"
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_QUERY_INTERFACE3(nsDragService, nsIDragService, nsIDragSession, \
nsIDragSessionOS2)
// --------------------------------------------------------------------------
// Local defines
@ -135,6 +130,8 @@ nsDragService::~nsDragService()
}
}
NS_IMPL_ISUPPORTS_INHERITED1(nsDragService, nsBaseDragService, nsIDragSessionOS2)
// --------------------------------------------------------------------------
NS_IMETHODIMP nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,

View File

@ -47,20 +47,11 @@
#include "nsWidgetsCID.h"
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_QUERY_INTERFACE2(nsDragService, nsIDragService, nsIDragSession)
char *nsDragService::mDndEvent = NULL;
int nsDragService::mDndEventLen;
#define kMimeCustom "text/_moz_htmlcontext"
//-------------------------------------------------------------------------
//
// DragService constructor
//
//-------------------------------------------------------------------------
nsDragService::nsDragService()
{
mDndWidget = nsnull;
@ -71,11 +62,6 @@ nsDragService::nsDragService()
mTransportFile = nsnull;
}
//-------------------------------------------------------------------------
//
// DragService destructor
//
//-------------------------------------------------------------------------
nsDragService::~nsDragService()
{
if( mNativeCtrl ) PtReleaseTransportCtrl( mNativeCtrl );

View File

@ -55,8 +55,6 @@ public:
nsDragService();
virtual ~nsDragService();
NS_DECL_ISUPPORTS_INHERITED
/* photon dependent stuff */
NS_IMETHOD SetNativeDndData( PtWidget_t * widget, PhEvent_t *event );

View File

@ -752,26 +752,6 @@ void nsWindow::GlobalMsgWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
// End of the methods to dispatch global messages
//-------------------------------------------------------------------------
//
// nsISupport stuff
//
//-------------------------------------------------------------------------
NS_IMPL_ADDREF(nsWindow)
NS_IMPL_RELEASE(nsWindow)
NS_IMETHODIMP
nsWindow::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIKBStateControl))) {
*aInstancePtr = static_cast<nsIKBStateControl*>(this);
NS_ADDREF(static_cast<nsBaseWidget*>(this));
return NS_OK;
}
return nsBaseWidget::QueryInterface(aIID,aInstancePtr);
}
//-------------------------------------------------------------------------
//
// nsWindow constructor
@ -919,6 +899,7 @@ nsWindow::~nsWindow()
}
NS_IMPL_ISUPPORTS_INHERITED1(nsWindow, nsBaseWidget, nsIKBStateControl)
NS_METHOD nsWindow::CaptureMouse(PRBool aCapture)
{

View File

@ -120,10 +120,7 @@ public:
nsWindow();
virtual ~nsWindow();
// nsISupports
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget interface
NS_IMETHOD Create(nsIWidget *aParent,

View File

@ -38,25 +38,11 @@
#include "nsBaseClipboard.h"
#include "nsIClipboardOwner.h"
#include "nsString.h"
#include "nsIWidget.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
NS_IMPL_ADDREF(nsBaseClipboard)
NS_IMPL_RELEASE(nsBaseClipboard)
NS_IMPL_QUERY_INTERFACE1(nsBaseClipboard, nsIClipboard)
//-------------------------------------------------------------------------
//
// nsBaseClipboard constructor
//
//-------------------------------------------------------------------------
nsBaseClipboard::nsBaseClipboard()
{
mClipboardOwner = nsnull;
@ -65,17 +51,13 @@ nsBaseClipboard::nsBaseClipboard()
}
//-------------------------------------------------------------------------
//
// nsBaseClipboard destructor
//
//-------------------------------------------------------------------------
nsBaseClipboard::~nsBaseClipboard()
{
EmptyClipboard(kSelectionClipboard);
EmptyClipboard(kGlobalClipboard);
}
NS_IMPL_ISUPPORTS1(nsBaseClipboard, nsIClipboard)
/**
* Sets the transferable object
@ -130,11 +112,6 @@ NS_IMETHODIMP nsBaseClipboard::GetData(nsITransferable * aTransferable, PRInt32
return NS_ERROR_FAILURE;
}
/**
*
*
*/
NS_IMETHODIMP nsBaseClipboard::EmptyClipboard(PRInt32 aWhichClipboard)
{
PRBool selectClipPresent;
@ -155,21 +132,17 @@ NS_IMETHODIMP nsBaseClipboard::EmptyClipboard(PRInt32 aWhichClipboard)
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP
nsBaseClipboard :: HasDataMatchingFlavors ( nsISupportsArray* aFlavorList, PRInt32 aWhichClipboard, PRBool * outResult )
nsBaseClipboard::HasDataMatchingFlavors(nsISupportsArray* aFlavorList,
PRInt32 aWhichClipboard,
PRBool* outResult)
{
*outResult = PR_TRUE; // say we always do.
return NS_OK;
}
NS_IMETHODIMP
nsBaseClipboard :: SupportsSelectionClipboard ( PRBool *_retval )
nsBaseClipboard::SupportsSelectionClipboard(PRBool* _retval)
{
*_retval = PR_FALSE; // we don't support the selection clipboard by default.
return NS_OK;

View File

@ -79,16 +79,6 @@
#define DRAGIMAGES_PREF "nglayout.enable_drag_images"
NS_IMPL_ADDREF(nsBaseDragService)
NS_IMPL_RELEASE(nsBaseDragService)
NS_IMPL_QUERY_INTERFACE2(nsBaseDragService, nsIDragService, nsIDragSession)
//-------------------------------------------------------------------------
//
// DragService constructor
//
//-------------------------------------------------------------------------
nsBaseDragService::nsBaseDragService()
: mCanDrop(PR_FALSE), mDoingDrag(PR_FALSE), mHasImage(PR_FALSE),
mDragAction(DRAGDROP_ACTION_NONE), mTargetSize(0,0),
@ -96,15 +86,11 @@ nsBaseDragService::nsBaseDragService()
{
}
//-------------------------------------------------------------------------
//
// DragService destructor
//
//-------------------------------------------------------------------------
nsBaseDragService::~nsBaseDragService()
{
}
NS_IMPL_ISUPPORTS2(nsBaseDragService, nsIDragService, nsIDragSession)
//---------------------------------------------------------
NS_IMETHODIMP

View File

@ -36,14 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsString.h"
#include "nsHTMLFormatConverter.h"
#include "nsCRT.h"
#include "nsISupportsArray.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsXPIDLString.h"
#include "nsITransferable.h" // for mime defs, this is BAD
@ -52,39 +52,21 @@
#include "nsIDTD.h"
#include "nsParserCIID.h"
#include "nsIContentSink.h"
#include "nsString.h"
#include "nsWidgetsCID.h"
#include "nsHTMLFormatConverter.h"
#include "nsPrimitiveHelpers.h"
#include "nsIDocumentEncoder.h"
#include "nsIHTMLToTextSink.h"
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
NS_IMPL_ADDREF(nsHTMLFormatConverter)
NS_IMPL_RELEASE(nsHTMLFormatConverter)
NS_IMPL_QUERY_INTERFACE1(nsHTMLFormatConverter, nsIFormatConverter)
//-------------------------------------------------------------------------
//
// HTMLFormatConverter constructor
//
//-------------------------------------------------------------------------
nsHTMLFormatConverter::nsHTMLFormatConverter()
{
}
//-------------------------------------------------------------------------
//
// HTMLFormatConverter destructor
//
//-------------------------------------------------------------------------
nsHTMLFormatConverter::~nsHTMLFormatConverter()
{
}
NS_IMPL_ISUPPORTS1(nsHTMLFormatConverter, nsIFormatConverter)
//
// GetInputDataFlavors
@ -319,10 +301,6 @@ nsHTMLFormatConverter::ConvertFromHTMLToUnicode(const nsAutoString & aFromStr, n
} // ConvertFromHTMLToUnicode
/**
*
*
*/
NS_IMETHODIMP
nsHTMLFormatConverter::ConvertFromHTMLToAOLMail(const nsAutoString & aFromStr,
nsAutoString & aToStr)