Bug 412320 - Try code-generation for QI impls, r=roc+luser

This commit is contained in:
benjamin@smedbergs.us 2008-01-25 09:14:48 -08:00
Родитель 4740654de5
Коммит ecfc3818e1
58 изменённых файлов: 2016 добавлений и 814 удалений

Просмотреть файл

@ -520,7 +520,7 @@ JAVA_GEN_DIR = _javagen
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
REQ_INCLUDES = $(foreach d,$(REQUIRES),-I$(DIST)/include/$d) -I$(DIST)/include
REQ_INCLUDES = -I$(srcdir) -I. $(foreach d,$(REQUIRES),-I$(DIST)/include/$d) -I$(DIST)/include
ifdef LIBXUL_SDK
REQ_INCLUDES_SDK = $(foreach d,$(REQUIRES),-I$(LIBXUL_SDK)/include/$d) -I$(LIBXUL_SDK)/include
endif

Просмотреть файл

@ -117,6 +117,10 @@ ifdef EXTRA_DSO_LIBS
EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
endif
ifdef GQI_SRCS
CPPSRCS += $(GQI_SRCS:.gqi=QI.cpp)
endif
#
# Library rules
#
@ -1188,6 +1192,9 @@ endif # COMPILER_DEPEND
endif # MOZ_AUTO_DEPS
%QI.cpp: %.gqi $(topsrcdir)/xpcom/base/gqi.py
$(PYTHON) $(topsrcdir)/xpcom/base/gqi.py $(INCLUDES) -I $(IDL_DIR) -o $@ -D $(MDDEPDIR)/$(@F).pp $<
# Rules for building native targets must come first because of the host_ prefix
host_%.$(OBJ_SUFFIX): %.c Makefile Makefile.in
$(REPORT_BUILD)

Просмотреть файл

@ -165,6 +165,8 @@ CPPSRCS = \
nsXMLNameSpaceMap.cpp \
$(NULL)
GQI_SRCS = contentbase.gqi
# we don't want the shared lib, but we want to force the creation of a
# static lib.
FORCE_STATIC_LIB = 1

Просмотреть файл

@ -0,0 +1,99 @@
%import-idl "nsIDOM3Node.idl"
%import-idl "nsIDOMNSElement.idl"
%import-idl "nsIDOMEventTarget.idl"
%import-idl "nsIDOM3EventTarget.idl"
%import-idl "nsIDOMNSEventTarget.idl"
%import-idl "nsIWeakReference.idl"
%import-idl "nsIDOMDocument.idl"
%import-idl "nsIDOM3Document.idl"
%import-idl "nsIDOMNSDocument.idl"
%import-idl "nsIDOMDocumentEvent.idl"
%import-idl "nsIDOM3DocumentEvent.idl"
%import-idl "nsIDOMDocumentStyle.idl"
%import-idl "nsIDOMNSDocumentStyle.idl"
%import-idl "nsIDOMDocumentView.idl"
%import-idl "nsIDOMDocumentRange.idl"
%import-idl "nsIDOMDocumentTraversal.idl"
%import-idl "nsIDOMDocumentXBL.idl"
%import-idl "nsIDOMXPathEvaluator.idl"
%pseudo-iid nsIContent fba9aa39-016e-4d5d-ab62-22a1b84a3c7b
%pseudo-iid nsINode cf677826-d7f1-4ec5-bf3a-d41811ac5846
%pseudo-iid nsPIDOMEventTarget 44a6597b-9fc3-4a8d-b7a4-d9009abf9d15
%pseudo-iid nsIDocument 626d86d2-615f-4a12-94d8-e3db3a298372
%pseudo-iid nsIScriptObjectPrincipal 3eedba38-8d22-41e1-817a-0e43e165b664
%pseudo-iid nsIMutationObserver 32e68316-67d4-44a5-8d35-0d390fa9df11
%pseudo-iid nsIXPathEvaluatorInternal b4b72daa-65d6-440f-b608-e2ee9a82f313
%pseudo-iid nsIRadioGroupContainer 06de7839-d0db-47d3-8290-3cb8622ed966
%{C++
#include "nsGenericElement.h"
#include "nsDocument.h"
#include "nsIXPathEvaluatorInternal.h"
#include "nsDOMCID.h"
#include "nsComponentManagerUtils.h"
%}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericElement)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSElement, new nsNSElementTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
// nsNodeSH::PreCreate() depends on the identity pointer being the
// same as nsINode (which nsIContent inherits), so if you change the
// below line, make sure nsNodeSH::PreCreate() still does the right
// thing!
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocument)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOM3DocumentEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentStyle)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSDocumentStyle)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentView)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentRange)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentTraversal)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Document)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIRadioGroupContainer)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
// nsNodeSH::PreCreate() depends on the identity pointer being the
// same as nsINode (which nsIDocument inherits), so if you change
// the below line, make sure nsNodeSH::PreCreate() still does the
// right thing!
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocument)
NS_INTERFACE_MAP_ENTRY_LITERAL(nsIDOMXPathEvaluator, nsIXPathEvaluatorInternal)
if (!mXPathEvaluatorTearoff) {
nsresult rv;
mXPathEvaluatorTearoff =
do_CreateInstance(NS_XPATH_EVALUATOR_CONTRACTID,
static_cast<nsIDocument *>(this), &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
return mXPathEvaluatorTearoff->QueryInterface(aIID, aResult);
END
NS_INTERFACE_MAP_END

Просмотреть файл

@ -883,54 +883,6 @@ nsDocument::~nsDocument()
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument)
NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_INTERFACE_TABLE_BEGIN
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsINode)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentEvent)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3DocumentEvent)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentView)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentRange)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentTraversal)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentXBL)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMEventTarget)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3EventTarget)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSEventTarget)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNode)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsPIDOMEventTarget)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3Node)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3Document)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsISupportsWeakReference)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIRadioGroupContainer)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
// nsNodeSH::PreCreate() depends on the identity pointer being the
// same as nsINode (which nsIDocument inherits), so if you change
// the below line, make sure nsNodeSH::PreCreate() still does the
// right thing!
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsDocument, nsISupports, nsIDocument)
NS_INTERFACE_TABLE_END
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDocument)
if (aIID.Equals(NS_GET_IID(nsIDOMXPathEvaluator)) ||
aIID.Equals(NS_GET_IID(nsIXPathEvaluatorInternal))) {
if (!mXPathEvaluatorTearoff) {
nsresult rv;
mXPathEvaluatorTearoff =
do_CreateInstance(NS_XPATH_EVALUATOR_CONTRACTID,
static_cast<nsIDocument *>(this), &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
return mXPathEvaluatorTearoff->QueryInterface(aIID, aInstancePtr);
}
else
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDocument, nsIDocument)
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS_WITH_DESTROY(nsDocument,
nsIDocument,

Просмотреть файл

@ -798,7 +798,7 @@ protected:
// Our update nesting level
PRUint32 mUpdateNestLevel;
private:
protected:
friend class nsUnblockOnloadEvent;
void PostUnblockOnloadEvent();

Просмотреть файл

@ -3449,28 +3449,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericElement)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSElement, new nsNSElementTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
// nsNodeSH::PreCreate() depends on the identity pointer being the
// same as nsINode (which nsIContent inherits), so if you change the
// below line, make sure nsNodeSH::PreCreate() still does the right
// thing!
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsGenericElement, nsIContent)
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS_WITH_DESTROY(nsGenericElement,
nsIContent,

Просмотреть файл

@ -40,6 +40,7 @@
#define nsIFramesetElement_h___
#include "nsISupports.h"
#include "nsCoord.h"
// IID for the nsIFramesetElement interface
#define NS_IFRAMESETELEMENT_IID \

Просмотреть файл

@ -133,6 +133,8 @@ CPPSRCS = \
nsTextRectangle.cpp \
$(NULL)
GQI_SRCS = htmlcontent.gqi
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1

Просмотреть файл

@ -0,0 +1,55 @@
%import "htmlgenericelement.gqi"
%import-idl "nsIDOMHTMLAnchorElement.idl"
%import-idl "nsIDOMNSHTMLAnchorElement2.idl"
%import-idl "nsIDOMHTMLDivElement.idl"
%import-idl "nsIDOMHTMLFrameElement.idl"
%import-idl "nsIDOMHTMLFrameSetElement.idl"
%import-idl "nsIDOMHTMLIFrameElement.idl"
%{C++
#include "nsHTMLAnchorElement.h"
#include "nsHTMLDivElement.h"
#include "nsHTMLSpanElement.h"
#include "nsHTMLFrameElement.h"
#include "nsHTMLFrameSetElement.h"
#include "nsHTMLIFrameElement.h"
%}
%pseudo-iid nsILink 0c212bc4-fcd7-479d-8c3f-3be8e6787450
%pseudo-iid nsIFrameSetElement eefe0fe5-44ac-4d7f-a751-f4aa5f22b0bf
NS_INTERFACE_MAP_BEGIN(nsHTMLAnchorElement, nsGenericHTMLElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLAnchorElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLAnchorElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLAnchorElement2)
NS_INTERFACE_MAP_ENTRY(nsILink)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLAnchorElement)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN(nsHTMLDivElement, nsGenericHTMLElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDivElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLDivElement)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN(nsHTMLSpanElement, nsGenericHTMLElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLSpanElement)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN(nsHTMLFrameElement, nsGenericHTMLFrameElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFrameElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLFrameElement)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN(nsHTMLFrameSetElement, nsGenericHTMLElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFrameSetElement)
NS_INTERFACE_MAP_ENTRY(nsIFrameSetElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLFrameSetElement)
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameElement, nsGenericHTMLFrameElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLIFrameElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLIFrameElement)
NS_INTERFACE_MAP_END

Просмотреть файл

@ -0,0 +1,35 @@
// Note: nsGenericHTMLElement does not implement QI directly... this declaration is here only
// so that subclasses have the correct list
%import "contentbase.gqi"
%import-idl "nsIDOMNSHTMLElement.idl"
%import-idl "nsIDOMElementCSSInlineStyle.idl"
%import-idl "nsIDOMHTMLElement.idl"
%import-idl "nsIDOMNSHTMLFrameElement.idl"
%import-idl "nsIFrameLoader.idl"
%{C++
#include "nsGenericHTMLElement.h"
%}
NS_INTERFACE_MAP_BEGIN(nsGenericHTMLElement, nsGenericElement)
// nsGenericHTMLElement doesn't implement nsIDOMHTMLElement, but all
// subclasses do, and we only use this declaration for subclasses
NS_FUTURE_INTERFACE_MAP_ENTRY(nsIDOMHTMLElement)
NS_FUTURE_INTERFACE_MAP_ENTRY(nsIDOMNode)
NS_FUTURE_INTERFACE_MAP_ENTRY(nsIDOMElement)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSHTMLElement,
new nsGenericHTMLElementTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMElementCSSInlineStyle,
new nsGenericHTMLElementTearoff(this))
NS_INTERFACE_MAP_UNFOUND
return PostQueryInterface(aIID, aResult);
END
NS_INTERFACE_MAP_END
NS_INTERFACE_MAP_BEGIN(nsGenericHTMLFrameElement, nsGenericHTMLElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLFrameElement)
NS_INTERFACE_MAP_ENTRY(nsIFrameLoaderOwner)
NS_INTERFACE_MAP_END

Просмотреть файл

@ -179,30 +179,6 @@ nsGenericHTMLElement::Init(nsINodeInfo *aNodeInfo)
#endif
class nsGenericHTMLElementTearoff : public nsIDOMNSHTMLElement,
public nsIDOMElementCSSInlineStyle
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
nsGenericHTMLElementTearoff(nsGenericHTMLElement *aElement)
: mElement(aElement)
{
}
virtual ~nsGenericHTMLElementTearoff()
{
}
NS_FORWARD_NSIDOMNSHTMLELEMENT(mElement->)
NS_FORWARD_NSIDOMELEMENTCSSINLINESTYLE(mElement->)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGenericHTMLElementTearoff,
nsIDOMNSHTMLElement)
private:
nsCOMPtr<nsGenericHTMLElement> mElement;
};
NS_IMPL_CYCLE_COLLECTION_1(nsGenericHTMLElementTearoff, mElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsGenericHTMLElementTearoff,
@ -2879,13 +2855,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFrameElement,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFrameLoader)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_TABLE_HEAD(nsGenericHTMLFrameElement)
NS_INTERFACE_TABLE_INHERITED2(nsGenericHTMLFrameElement,
nsIDOMNSHTMLFrameElement,
nsIFrameLoaderOwner)
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLFrameElement)
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
nsresult
nsGenericHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{

Просмотреть файл

@ -45,6 +45,8 @@
#include "nsIDOMNSHTMLFrameElement.h"
#include "nsFrameLoader.h"
#include "nsGkAtoms.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMNSHTMLElement.h"
class nsIDOMAttr;
class nsIDOMEventListener;
@ -897,9 +899,6 @@ public:
}
virtual ~nsGenericHTMLFrameElement();
// nsISupports
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
// nsIDOMNSHTMLFrameElement
NS_DECL_NSIDOMNSHTMLFRAMEELEMENT
@ -940,6 +939,30 @@ protected:
nsCOMPtr<nsIFrameLoader> mFrameLoader;
};
class nsGenericHTMLElementTearoff : public nsIDOMNSHTMLElement,
public nsIDOMElementCSSInlineStyle
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
nsGenericHTMLElementTearoff(nsGenericHTMLElement *aElement)
: mElement(aElement)
{
}
virtual ~nsGenericHTMLElementTearoff()
{
}
NS_FORWARD_NSIDOMNSHTMLELEMENT(mElement->)
NS_FORWARD_NSIDOMELEMENTCSSINLINESTYLE(mElement->)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGenericHTMLElementTearoff,
nsIDOMNSHTMLElement)
private:
nsCOMPtr<nsGenericHTMLElement> mElement;
};
//----------------------------------------------------------------------
/**

Просмотреть файл

@ -36,6 +36,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLAnchorElement.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
@ -63,78 +65,10 @@
#include "nsCOMPtr.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsHTMLAnchorElement.h"
nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult);
class nsHTMLAnchorElement : public nsGenericHTMLElement,
public nsIDOMHTMLAnchorElement,
public nsIDOMNSHTMLAnchorElement2,
public nsILink
{
public:
nsHTMLAnchorElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLAnchorElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLAnchorElement
NS_DECL_NSIDOMHTMLANCHORELEMENT
// nsIDOMNSHTMLAnchorElement
NS_DECL_NSIDOMNSHTMLANCHORELEMENT
// nsIDOMNSHTMLAnchorElement2
NS_DECL_NSIDOMNSHTMLANCHORELEMENT2
// nsILink
NS_IMETHOD GetLinkState(nsLinkState &aState);
NS_IMETHOD SetLinkState(nsLinkState aState);
NS_IMETHOD GetHrefURI(nsIURI** aURI);
NS_IMETHOD LinkAdded() { return NS_OK; }
NS_IMETHOD LinkRemoved() { return NS_OK; }
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
PRBool aCompileEventHandlers);
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual void SetFocus(nsPresContext* aPresContext);
virtual PRBool IsFocusable(PRBool *aTabIndex = nsnull);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual PRBool IsLink(nsIURI** aURI) const;
virtual void GetLinkTarget(nsAString& aTarget);
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, PRBool aNotify)
{
return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
}
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// The cached visited state
nsLinkState mLinkState;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)
@ -153,19 +87,8 @@ NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, nsGenericElement)
// QueryInterface implementation for nsHTMLAnchorElement
NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLAnchorElement, nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED4(nsHTMLAnchorElement,
nsIDOMHTMLAnchorElement,
nsIDOMNSHTMLAnchorElement,
nsIDOMNSHTMLAnchorElement2,
nsILink)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAnchorElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLAnchorElement)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Coords, coords)
NS_IMPL_URI_ATTR(nsHTMLAnchorElement, Href, href)

Просмотреть файл

@ -0,0 +1,116 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Daniel Glazman <glazman@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLAnchorElement_h__
#define nsHTMLAnchorElement_h__
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMNSHTMLAnchorElement2.h"
#include "nsILink.h"
class nsHTMLAnchorElement : public nsGenericHTMLElement,
public nsIDOMHTMLAnchorElement,
public nsIDOMNSHTMLAnchorElement2,
public nsILink
{
public:
nsHTMLAnchorElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLAnchorElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLAnchorElement
NS_DECL_NSIDOMHTMLANCHORELEMENT
// nsIDOMNSHTMLAnchorElement
NS_DECL_NSIDOMNSHTMLANCHORELEMENT
// nsIDOMNSHTMLAnchorElement2
NS_DECL_NSIDOMNSHTMLANCHORELEMENT2
// nsILink
NS_IMETHOD GetLinkState(nsLinkState &aState);
NS_IMETHOD SetLinkState(nsLinkState aState);
NS_IMETHOD GetHrefURI(nsIURI** aURI);
NS_IMETHOD LinkAdded() { return NS_OK; }
NS_IMETHOD LinkRemoved() { return NS_OK; }
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
PRBool aCompileEventHandlers);
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual void SetFocus(nsPresContext* aPresContext);
virtual PRBool IsFocusable(PRBool *aTabIndex = nsnull);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual PRBool IsLink(nsIURI** aURI) const;
virtual void GetLinkTarget(nsAString& aTarget);
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, PRBool aNotify)
{
return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
}
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// The cached visited state
nsLinkState mLinkState;
};
#endif

Просмотреть файл

@ -34,46 +34,14 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLDivElement.h"
#include "nsHTMLDivElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsMappedAttributes.h"
class nsHTMLDivElement : public nsGenericHTMLElement,
public nsIDOMHTMLDivElement
{
public:
nsHTMLDivElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLDivElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLDivElement
NS_DECL_NSIDOMHTMLDIVELEMENT
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Div)
@ -90,13 +58,6 @@ nsHTMLDivElement::~nsHTMLDivElement()
NS_IMPL_ADDREF_INHERITED(nsHTMLDivElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLDivElement, nsGenericElement)
// QueryInterface implementation for nsHTMLDivElement
NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLDivElement, nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED1(nsHTMLDivElement, nsIDOMHTMLDivElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLDivElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLDivElement)

Просмотреть файл

@ -0,0 +1,75 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLDivElement_h__
#define nsHTMLDivElement_h__
#include "nsIDOMHTMLDivElement.h"
#include "nsGenericHTMLElement.h"
class nsHTMLDivElement : public nsGenericHTMLElement,
public nsIDOMHTMLDivElement
{
public:
nsHTMLDivElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLDivElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLDivElement
NS_DECL_NSIDOMHTMLDIVELEMENT
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
#endif

Просмотреть файл

@ -34,48 +34,14 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLFrameElement.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLFrameElement.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsDOMError.h"
class nsHTMLFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLFrameElement
{
public:
nsHTMLFrameElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFrameElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLFrameElement
NS_DECL_NSIDOMHTMLFRAMEELEMENT
// nsIContent
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Frame)
@ -92,14 +58,6 @@ nsHTMLFrameElement::~nsHTMLFrameElement()
NS_IMPL_ADDREF_INHERITED(nsHTMLFrameElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameElement, nsGenericElement)
// QueryInterface implementation for nsHTMLFrameElement
NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLFrameElement,
nsGenericHTMLFrameElement)
NS_INTERFACE_TABLE_INHERITED1(nsHTMLFrameElement, nsIDOMHTMLFrameElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFrameElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLFrameElement)

Просмотреть файл

@ -0,0 +1,76 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLFrameElement_h__
#define nsHTMLFrameElement_h__
#include "nsIDOMHTMLFrameElement.h"
#include "nsGenericHTMLElement.h"
class nsHTMLFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLFrameElement
{
public:
nsHTMLFrameElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFrameElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLFrameElement
NS_DECL_NSIDOMHTMLFRAMEELEMENT
// nsIContent
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
#endif

Просмотреть файл

@ -34,91 +34,15 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsHTMLFrameSetElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsIFrameSetElement.h"
#include "nsIHTMLDocument.h"
#include "nsIDocument.h"
class nsHTMLFrameSetElement : public nsGenericHTMLElement,
public nsIDOMHTMLFrameSetElement,
public nsIFrameSetElement
{
public:
nsHTMLFrameSetElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFrameSetElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLFrameSetElement
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
// These override the SetAttr methods in nsGenericHTMLElement (need
// both here to silence compiler warnings).
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, PRBool aNotify)
{
return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
}
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
// nsIFramesetElement
NS_IMETHOD GetRowSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
NS_IMETHOD GetColSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
private:
nsresult ParseRowCol(const nsAString& aValue,
PRInt32& aNumSpecs,
nsFramesetSpec** aSpecs);
/**
* The number of size specs in our "rows" attr
*/
PRInt32 mNumRows;
/**
* The number of size specs in our "cols" attr
*/
PRInt32 mNumCols;
/**
* The style hint to return for the rows/cols attrs in
* GetAttributeChangeHint
*/
nsChangeHint mCurrentRowColHint;
/**
* The parsed representation of the "rows" attribute
*/
nsAutoArrayPtr<nsFramesetSpec> mRowSpecs; // parsed, non-computed dimensions
/**
* The parsed representation of the "cols" attribute
*/
nsAutoArrayPtr<nsFramesetSpec> mColSpecs; // parsed, non-computed dimensions
};
NS_IMPL_NS_NEW_HTML_ELEMENT(FrameSet)
@ -137,15 +61,6 @@ NS_IMPL_ADDREF_INHERITED(nsHTMLFrameSetElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameSetElement, nsGenericElement)
// QueryInterface implementation for nsHTMLFrameSetElement
NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLFrameSetElement,
nsGenericHTMLElement)
NS_INTERFACE_TABLE_INHERITED2(nsHTMLFrameSetElement,
nsIDOMHTMLFrameSetElement,
nsIFrameSetElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFrameSetElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLFrameSetElement)

Просмотреть файл

@ -0,0 +1,120 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLFrameSetElement_h__
#define nsHTMLFrameSetElement_h__
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsIFrameSetElement.h"
#include "nsGenericHTMLElement.h"
class nsHTMLFrameSetElement : public nsGenericHTMLElement,
public nsIDOMHTMLFrameSetElement,
public nsIFrameSetElement
{
public:
nsHTMLFrameSetElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFrameSetElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLFrameSetElement
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
// These override the SetAttr methods in nsGenericHTMLElement (need
// both here to silence compiler warnings).
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, PRBool aNotify)
{
return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
}
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
// nsIFramesetElement
NS_IMETHOD GetRowSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
NS_IMETHOD GetColSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
private:
nsresult ParseRowCol(const nsAString& aValue,
PRInt32& aNumSpecs,
nsFramesetSpec** aSpecs);
/**
* The number of size specs in our "rows" attr
*/
PRInt32 mNumRows;
/**
* The number of size specs in our "cols" attr
*/
PRInt32 mNumCols;
/**
* The style hint to return for the rows/cols attrs in
* GetAttributeChangeHint
*/
nsChangeHint mCurrentRowColHint;
/**
* The parsed representation of the "rows" attribute
*/
nsAutoArrayPtr<nsFramesetSpec> mRowSpecs; // parsed, non-computed dimensions
/**
* The parsed representation of the "cols" attribute
*/
nsAutoArrayPtr<nsFramesetSpec> mColSpecs; // parsed, non-computed dimensions
};
#endif

Просмотреть файл

@ -34,8 +34,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLIFrameElement.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLIFrameElement.h"
#include "nsGkAtoms.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
@ -45,43 +45,9 @@
#include "nsRuleData.h"
#include "nsStyleConsts.h"
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLIFrameElement
{
public:
nsHTMLIFrameElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLIFrameElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLIFrameElement
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
// nsIContent
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(IFrame)
nsHTMLIFrameElement::nsHTMLIFrameElement(nsINodeInfo *aNodeInfo)
: nsGenericHTMLFrameElement(aNodeInfo)
{
@ -95,13 +61,6 @@ nsHTMLIFrameElement::~nsHTMLIFrameElement()
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameElement,nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameElement,nsGenericElement)
// QueryInterface implementation for nsHTMLIFrameElement
NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLIFrameElement,
nsGenericHTMLFrameElement)
NS_INTERFACE_TABLE_INHERITED1(nsHTMLIFrameElement, nsIDOMHTMLIFrameElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLIFrameElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLIFrameElement)

Просмотреть файл

@ -0,0 +1,78 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLIFrameElement_h__
#define nsHTMLIFrameElement_h__
#include "nsIFrameSetElement.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLIFrameElement.h"
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLIFrameElement
{
public:
nsHTMLIFrameElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLIFrameElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFrameElement::)
// nsIDOMHTMLIFrameElement
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
// nsIContent
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
#endif

Просмотреть файл

@ -34,44 +34,17 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLElement.h"
#include "nsHTMLSpanElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsIAtom.h"
#include "nsRuleData.h"
class nsHTMLSpanElement : public nsGenericHTMLElement,
public nsIDOMHTMLElement
{
public:
nsHTMLSpanElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLSpanElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Span)
nsHTMLSpanElement::nsHTMLSpanElement(nsINodeInfo *aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
@ -85,12 +58,6 @@ nsHTMLSpanElement::~nsHTMLSpanElement()
NS_IMPL_ADDREF_INHERITED(nsHTMLSpanElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLSpanElement, nsGenericElement)
// QueryInterface implementation for nsHTMLSpanElement
NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLSpanElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLSpanElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSpanElement)

Просмотреть файл

@ -0,0 +1,69 @@
/* -*- 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
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLSpanElement_h__
#define nsHTMLSpanElement_h__
#include "nsIDOMHTMLElement.h"
#include "nsGenericHTMLElement.h"
class nsHTMLSpanElement : public nsGenericHTMLElement,
public nsIDOMHTMLElement
{
public:
nsHTMLSpanElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLSpanElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
#endif

Просмотреть файл

@ -91,6 +91,8 @@ CPPSRCS = \
nsWyciwygProtocolHandler.cpp \
$(NULL)
GQI_SRCS = htmldocument.gqi
EXPORTS = \
nsIHTMLDocument.h \
$(NULL)

Просмотреть файл

@ -0,0 +1,17 @@
%import "contentbase.gqi"
%import-idl "nsIDOMHTMLDocument.idl"
%import-idl "nsIDOMNSHTMLDocument.idl"
%{C++
#include "nsHTMLDocument.h"
%}
%pseudo-iid nsIHTMLDocument 61e989a8-70cd-4582-845e-6e5e12559a83
NS_INTERFACE_MAP_BEGIN(nsHTMLDocument, nsDocument)
NS_INTERFACE_MAP_ENTRY(nsIHTMLDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLDocument)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLDocument)
NS_INTERFACE_MAP_END

Просмотреть файл

@ -416,18 +416,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsHTMLDocument, nsDocument)
NS_IMPL_RELEASE_INHERITED(nsHTMLDocument, nsDocument)
// QueryInterface implementation for nsHTMLDocument
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLDocument)
NS_INTERFACE_TABLE_INHERITED3(nsHTMLDocument,
nsIHTMLDocument,
nsIDOMHTMLDocument,
nsIDOMNSHTMLDocument)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDocument)
NS_INTERFACE_MAP_END_INHERITING(nsDocument)
nsresult
nsHTMLDocument::Init()
{

788
xpcom/base/gqi.py Normal file
Просмотреть файл

@ -0,0 +1,788 @@
# -*- Mode: Python: tab-width: 8; indent-tabs-mode: nil; python-indent: 4 -*-
"""Implement QueryInterface using optimized generated code."""
import os, errno, re, sys, sets
# Global controlling debug output to sys.stderr
debug = False
def findfile(f, curfile, includedirs):
"""Find a file 'f' by looking in the directory of the current file
and then in all directories specified by -I until it is found. Returns
the path of the file that was found.
@raises IOError is the file is not found."""
sdirs = [os.path.dirname(curfile)]
sdirs.extend(includedirs)
for dir in sdirs:
t = os.path.join(dir, f)
if os.path.exists(t):
return t
raise IOError(errno.ENOENT, "File not found", f)
# Giant parsing loop: parse input files into the internal representation,
# keeping track of file/line numbering information. This iterator automatically
# skips blank lines and lines beginning with //
class IterFile(object):
def __init__(self, file):
self._file = file
self._iter = open(file)
self._lineno = 0
def __iter__(self):
return self
def next(self):
self._lineno += 1
line = self._iter.next().strip()
if line == '' or line.startswith('//'):
return self.next()
return line
def loc(self):
return "%s:%i" % (self._file, self._lineno)
class uniqdict(dict):
"""A subclass of dict that will throw an error if you attempt to set the same key to different values."""
def __setitem__(self, key, value):
if key in self and not value == self[key]:
raise IndexError('Key "%s" already present in uniqdict' % key)
dict.__setitem__(self, key, value)
def update(self, d):
for key, value in d.iteritems():
if key in self and not value == self[key]:
raise IndexError('Key "%s" already present in uniqdict' % key)
dict.update(self, d)
def dump_hex_tuple(t):
return "(%s)" % ", ".join(["%#x" % i for i in t])
class UUID(object):
def __init__(self, name, iidstr, pseudo=False, base=None):
"""This method *assumes* that the UUID is validly formed."""
self.name = name
self.pseudo = pseudo
self.base = base
# iid is in 32-16-16-8*8 format, as hex *strings*
iid = (iidstr[0:8], iidstr[9:13], iidstr[14:18],
iidstr[19:21], iidstr[21:23], iidstr[24:26], iidstr[26:28],
iidstr[28:30], iidstr[30:32], iidstr[32:34], iidstr[34:36])
self.iid = iid
# (big_endian_words, little_endian_words)
self.words = (
(int(iid[0], 16),
int(iid[1] + iid[2], 16),
int("".join([iid[i] for i in xrange(3, 7)]), 16),
int("".join([iid[i] for i in xrange(7, 11)]), 16)),
(int(iid[0], 16),
int(iid[2] + iid[1], 16),
int("".join([iid[i] for i in xrange(6, 2, -1)]), 16),
int("".join([iid[i] for i in xrange(10, 6, -1)]), 16)))
if debug:
print >>sys.stderr, "%r" % self
print >>sys.stderr, " bigendian: %s" % dump_hex_tuple(self.words[False])
print >>sys.stderr, " littleendian: %r" % dump_hex_tuple(self.words[True])
def __eq__(self, uuid):
return self.iid == uuid.iid and self.name == uuid.name
def __repr__(self):
return """UUID(%r, "%s-%s-%s-%s-%s", pseudo=%r, base=%r)""" % (
self.name, self.iid[0], self.iid[1], self.iid[2], self.iid[3] + self.iid[4],
"".join([self.iid[i] for i in xrange(5, 11)]), self.pseudo, self.base)
def asstruct(self):
return "{ 0x%s, 0x%s, 0x%s, { 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s } }" % self.iid
def runtime_assertion(self):
if self.pseudo:
return """
static const nsID kGQI_%(iname)s = %(struct)s;
NS_ASSERTION(NS_GET_IID(%(iname)s).Equals(kGQI_%(iname)s),
"GQI pseudo-IID doesn't match reality.");
""" % {
'iname': self.name,
'struct': self.asstruct()
}
else:
return ""
_uuid_pattern_string = r'[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}'
_includefinder = re.compile(r'#include\s+(?:"|\<)(?P<filename>[a-z\.\-\_0-9]+)(?:"|\>)\s*$', re.I)
_uuidfinder = re.compile(r'uuid\((?P<iid>' + _uuid_pattern_string + r')\)', re.I)
_namefinder = re.compile(r'interface\s+(?P<interface>[A-Za-z_0-9]+)\s+:\s+(?P<base>[A-Za-z]+)')
def importidl(file, includedirs):
"""Parse an IDL file. Returns (mapofiids, setofdeps)"""
iids = {}
deps = sets.Set()
deps.add(file)
f = IterFile(file)
for line in f:
if line.startswith('%{'):
# Skip literal IDL blocks such as %{C++ %}
for line in f:
if line.startswith('%}'):
break
continue
m = _includefinder.match(line)
if m is not None:
importediids, importeddeps = importidl(findfile(m.group('filename'), file, includedirs), includedirs)
iids.update(importediids)
deps |= importeddeps
continue
m = _uuidfinder.search(line)
if m is not None:
iid = m.group('iid')
line = f.next()
if line == 'interface nsISupports {':
iids['nsISupports'] = UUID('nsISupports', iid)
else:
m = _namefinder.match(line)
if m is None:
raise Exception("%s: expected interface" % f.loc())
iids[m.group('interface')] = \
UUID(m.group('interface'), iid, base=m.group('base'))
return iids, deps
def gqi(ifaces, endian):
"""Find an algorithm that uniquely identifies interfaces by a single
word. Returns (indexfunction, table)"""
for bits in xrange(3, 10):
bitmask = (1 << bits) - 1
for word in xrange(0, 4):
for sh in xrange(0, 33 - bits):
shmask = bitmask << sh
# print "Trying word: %i, bits: %i, shift: %i" % (word, bits, sh)
# print "Bitmask: %x" % (bitmask)
# print "Shifter mask: %x" % (shmask)
l = list([None for i in xrange(0, 1 << bits)])
try:
for i in xrange(0, len(ifaces)):
n = (ifaces[i].uuid.words[endian][word] & shmask) >> sh
if l[n] is not None:
# print "found conflict, index %i" % n
# print "old iface: %s" % l[n].uuid
# print "new iface: %s" % i.uuid
raise IndexError()
l[n] = i
except IndexError:
continue
# If we got here, we're ok... create the table we want
indexfunc = "(reinterpret_cast<const PRUint32*>(&aIID)[%i] & 0x%x) >> %i" % (word, shmask, sh)
return indexfunc, l
raise Exception("No run of 9 bits within a word was unique!: interfaces: %s" % [i.uuid for i in ifaces])
def basecast(item, baselist):
"""Returns a string where an item is static_cast through a list of bases."""
for base in baselist:
item = "static_cast<%s*>(%s)" % (base, item)
return item
class QIImpl(object):
_default_unfound = """
*aResult = nsnull;
return NS_NOINTERFACE;
"""
_qiimpl = """
enum %(cname)s_QIActionType {
%(actionenums)s
};
struct %(cname)s_QIAction {
const nsID *iid;
%(actiontype)s
union {
void *ptr;
%(actiondata)s
} data;
};
NS_IMETHODIMP %(cname)s::QueryInterface(REFNSIID aIID, void **aResult)
{
#ifdef DEBUG
%(pseudoassertions)s
#endif
static const PRUint8 kLookupTable[] = {
#ifdef IS_BIG_ENDIAN
%(biglookup)s
#else
%(littlelookup)s
#endif
};
static const %(cname)s_QIAction kActionTable[] = {
%(actiontable)s
};
nsISupports* found = nsnull;
const %(cname)s_QIAction *entry;
PRUint32 index =
#ifdef IS_BIG_ENDIAN
%(bigindexfunc)s;
#else
%(littleindexfunc)s;
#endif
PRUint8 action = kLookupTable[index];
if (action == 0xFF)
goto unfound;
entry = kActionTable + action;
if (!entry->iid->Equals(aIID))
goto unfound;
%(actioncode)s
NS_NOTREACHED("Unhandled case?");
%(nullcheck)s
exit_addref:
NS_ASSERTION(found, "Interface should have been found by now.");
found->AddRef();
*aResult = found;
return NS_OK;
unfound:
%(unfound)s
}"""
_datatypes = """
%(type)s %(name)s;
"""
_actiontable_entry = """
{
&NS_GET_IID(%(iname)s),
%(enumtype)s
%(emitTable)s
},
"""
_actioncode_multi = """
switch (entry->action) {
%s
}
"""
_actioncode_multi_entry = """
case %(cname)s_%(enumtype)s:
%(setResult)s
"""
_nullcheck = """
exit_nullcheck_addref:
if (!found)
return NS_ERROR_OUT_OF_MEMORY;
"""
_refcounting = """
NS_IMPL_%(threadsafe)sADDREF(%(cname)s)
NS_IMPL_%(threadsafe)sRELEASE(%(cname)s)
"""
def __init__(self, cname, ifaces, emitrefcount=False,
threadsafe="", unfound=None, base=None):
self.cname = cname
self.emitrefcount = emitrefcount
self.threadsafe = threadsafe
self.base = base
self.ifaces = ifaces
self.unfound = unfound
# ensure that interfaces are not duplicated
ifdict = uniqdict()
for i, baselist in self.iter_all_ifaces():
ifdict[i.uuid.name] = i
def iter_self_and_bases(self):
"""yields (impl, baselist) for all bases"""
impl = self
baselist = []
while impl is not None:
baselist = list(baselist)
baselist.append(impl.cname)
yield impl, baselist
impl = impl.base
def iter_all_ifaces(self):
"""yields (iface, baselist) for all interfaces"""
for impl, baselist in self.iter_self_and_bases():
for i in impl.ifaces:
yield i, baselist
def output(self, fd):
unfound = None
for impl, baselist in self.iter_self_and_bases():
if impl.unfound is not None:
unfound = impl.unfound
break
if unfound is None:
unfound = self._default_unfound
needsnullcheck = False
actions = sets.Set()
types = uniqdict()
for i, baselist in self.iter_all_ifaces():
action = i.action
actions.add(action)
if action.needsnullcheck:
needsnullcheck = True
if action.datatype:
types[action.varname] = action.datatype
actionenums = ", ".join(["%s_%s" % (self.cname, action.enumtype)
for action in actions])
# types.ptr is explicitly first (for initialization), so delete it
types.pop('ptr', None)
actiondata = "".join([self._datatypes % {'type': type,
'name': name}
for name, type in types.iteritems()])
# list of (i, baselist)
ilist = [i for i in self.iter_all_ifaces()]
pseudoassertions = "".join([i.uuid.runtime_assertion()
for i, baselist in ilist])
bigindexfunc, bigitable = gqi([iface for iface, baselist in ilist], False)
littleindexfunc, littleitable = gqi([iface for iface, baselist in ilist], True)
# (falseval, trueval)[conditional expression] is the python
# ternary operator
biglookup = ",\n".join([(str(i), "0xFF")[i is None]
for i in bigitable])
littlelookup = ",\n".join([(str(i), "0xFF")[i is None]
for i in littleitable])
if len(actions) > 1:
actiontype = "%s_QIActionType action;" % self.cname
enumtype = "%(cname)s_%(enumtype)s,"
else:
actiontype = ""
enumtype = ""
actiontable = "".join([self._actiontable_entry %
{'enumtype': enumtype % {'cname': self.cname,
'enumtype': iface.action.enumtype},
'iname': iface.uuid.name,
'emitTable': iface.emitTable(self.cname, baselist)}
for iface, baselist in ilist])
if len(actions) == 1:
actioncode = iter(actions).next().setResult % {
'classname': self.cname
}
else:
actioncode = self._actioncode_multi % (
"".join([self._actioncode_multi_entry % {
'cname': self.cname,
'enumtype': action.enumtype,
'setResult': action.setResult % {'classname': self.cname}}
for action in actions])
)
if needsnullcheck:
nullcheck = self._nullcheck
else:
nullcheck = ""
print >>fd, self._qiimpl % {
'cname': self.cname,
'actionenums': actionenums,
'actiontype': actiontype,
'actiondata': actiondata,
'pseudoassertions': pseudoassertions,
'biglookup': biglookup,
'littlelookup': littlelookup,
'actiontable': actiontable,
'bigindexfunc': bigindexfunc,
'littleindexfunc': littleindexfunc,
'actioncode': actioncode,
'nullcheck': nullcheck,
'unfound': unfound
}
if self.emitrefcount:
print >>fd, self._refcounting % {
'threadsafe': self.threadsafe,
'cname': self.cname
}
class PointerAction(object):
enumtype = "STATIC_POINTER"
datatype = "void*"
varname = "ptr"
setResult = """*aResult = entry->data.ptr;
return NS_OK;"""
needsnullcheck = False
nsCycleCollectionParticipant = UUID("nsCycleCollectionParticipant", "9674489b-1f6f-4550-a730-ccaedd104cf9", pseudo=True)
class CCParticipantResponse(object):
action = PointerAction
def __init__(self, classname):
self.classname = classname
self.uuid = nsCycleCollectionParticipant
def emitTable(self, classname, baselist):
return "{ &NS_CYCLE_COLLECTION_NAME(%s) }" % classname
class TearoffResponse(object):
"""Because each tearoff is different, this response is its own action."""
datatype = None
needsnullcheck = True
def __init__(self, uuid, allocator):
self.setResult = """
found = static_cast<%s*>(%s);
goto exit_nullcheck_addref;
""" % (uuid.name, allocator)
self.uuid = uuid
self.action = self
self.enumtype = "NS_TEAROFF_%s" % uuid.name
def emitTable(self, classname, baselist):
return "{0}"
nsCycleCollectionISupports = UUID("nsCycleCollectionISupports", "c61eac14-5f7a-4481-965e-7eaa6effa85f", pseudo=True)
class CCSupportsAction(object):
enumtype = "CC_ISUPPORTS"
datatype = None
setResult = """
found = NS_CYCLE_COLLECTION_CLASSNAME(%(classname)s)::Upcast(this);
goto exit_nullcheck_addref;
"""
needsnullcheck = True
class CCISupportsResponse(object):
action = CCSupportsAction
def __init__(self, classname):
self.classname = classname
self.uuid = nsCycleCollectionISupports
def emitTable(self, classname, baselist):
return "{ 0 }"
nsIClassInfo = UUID("nsIClassInfo", "986c11d0-f340-11d4-9075-0010a4e73d9a", pseudo=True)
class DOMCIResult(object):
datatype = None
enumtype = "DOMCI"
needsnullcheck = True
def __init__(self, domciname):
self.action = self
self.uuid = nsIClassInfo
self.setResult = """
found = NS_GetDOMClassInfoInstance(eDOMClassInfo_%s_id);
goto exit_nullcheck_addref;
""" % domciname
def emitTable(self, classname, baselist):
return "{ 0 }"
class OffsetAction(object):
enumtype = "OFFSET_THIS_ADDREF"
datatype = "PRUint32"
varname = "offset"
setResult = """
found = reinterpret_cast<nsISupports*>(reinterpret_cast<char*>(this) + entry->data.offset);
goto exit_addref;
"""
needsnullcheck = False
class OffsetThisQIResponse(object):
action = OffsetAction
def __init__(self, uuid):
self.uuid = uuid
def emitTable(self, classname, baselist):
casted = basecast("((%s*) 0x1000)" % classname, baselist)
return """
{ reinterpret_cast<void*>(
reinterpret_cast<char*>(
static_cast<%(iname)s*>(%(casted)s)) -
reinterpret_cast<char*>(%(casted)s))
}""" % { 'casted': casted,
'iname': self.uuid.name }
class OffsetFutureThisQIResponse(OffsetThisQIResponse):
action = OffsetAction
def __init__(self, uuid):
self.uuid = uuid
def emitTable(self, classname, baselist):
casted = "((%s*) 0x1000)" % classname
return """
{ reinterpret_cast<void*>(
reinterpret_cast<char*>(
static_cast<%(iname)s*>(%(casted)s)) -
reinterpret_cast<char*>(%(casted)s))
}""" % { 'casted': casted,
'iname': self.uuid.name }
class OffsetThisQIResponseAmbiguous(OffsetThisQIResponse):
def __init__(self, uuid, intermediate):
self.intermediate = intermediate
OffsetThisQIResponse.__init__(self, uuid)
def emitTable(self, classname, baselist):
casted = basecast("((%s*) 0x1000)" % classname, baselist)
return """
{ reinterpret_cast<void*>(
reinterpret_cast<char*>(
static_cast<%(iname)s*>(
static_cast<%(intermediate)s*>(%(casted)s))) -
reinterpret_cast<char*>(%(casted)s))
}""" % \
{ 'casted': casted,
'iname': self.uuid.name,
'intermediate': self.intermediate.name }
class LiteralAction(object):
datatype = None
def __init__(self, uname, code):
self.enumtype = "LITERAL_CODE_%s" % uname
self.setResult = code
self.needsnullcheck = code.find('exit_nullcheck_addref') != -1
class LiteralResponse(object):
def __init__(self, action, uuid):
self.action = action
self.uuid = uuid
def emitTable(self, cname, baselist):
return "{0}"
_map_entry = re.compile(r'(?P<action>[A-Z_]+)\((?P<list>.*)\)$')
_split_commas = re.compile(r'\s*,\s*')
def build_map(f, cname, iids):
"""Parse the body of an NS_INTERFACE_MAP and return (members, unfound)"""
unfound = None
members = []
for line in f:
if line == 'NS_INTERFACE_MAP_END':
return (members, unfound)
if line == 'NS_INTERFACE_MAP_UNFOUND':
unfound = ''
for line in f:
if line == 'END':
break
unfound += line
continue
if line.find(')') == -1:
for line2 in f:
line += line2
if line.find(')') != -1:
break
m = _map_entry.match(line)
if m is None:
raise Exception("%s: Unparseable interface map entry" % f.loc())
items = _split_commas.split(m.group('list'))
action = m.group('action')
if action == 'NS_INTERFACE_MAP_ENTRY':
iname, = items
members.append(OffsetThisQIResponse(iids[iname]))
elif action == 'NS_FUTURE_INTERFACE_MAP_ENTRY':
iname, = items
members.append(OffsetFutureThisQIResponse(iids[iname]))
elif action == 'NS_INTERFACE_MAP_ENTRY_AMBIGUOUS':
iname, intermediate = items
members.append(OffsetThisQIResponseAmbiguous(iids[iname], iids[intermediate]))
elif action == 'NS_INTERFACE_MAP_ENTRY_TEAROFF':
iname, allocator = items
members.append(TearoffResponse(iids[iname], allocator))
elif action == 'NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO':
domciname, = items
members.append(DOMCIResult(domciname))
elif action == 'NS_INTERFACE_MAP_ENTRY_LITERAL':
code = ''
for line in f:
if line == 'END':
break
code += line
a = LiteralAction(items[0], code)
for iname in items:
iface = iids[iname]
members.append(LiteralResponse(a, iface))
else:
raise Exception("%s: Unexpected interface map entry" % f.loc())
raise Exception("%s: Unexpected EOF" % f.loc())
_import = re.compile(r'%(?P<type>import|import-idl)\s+(?:"|\<)(?P<filename>[a-z\.\-\_0-9]+)(?:"|\>)\s*$', re.I)
_impl_qi = re.compile(r'NS_IMPL_(?P<threadsafe>THREADSAFE_)?(?P<type>QUERY_INTERFACE|ISUPPORTS)(?:\d+)\((?P<bases>.*)\)\s*$')
_pseudoiid = re.compile(r'%pseudo-iid\s+(?P<name>[a-z_0-9]+)\s+(?P<iid>' + _uuid_pattern_string + r')\s*$', re.I)
_map_begin = re.compile(r'NS_INTERFACE_MAP_BEGIN(?P<cc>_CYCLE_COLLECTION)?\((?P<classname>[A-Za-z0-9+]+)(?:\s*,\s*(?P<base>[A-Za-z0-9+]+))?\)$')
def parsefile(file, fd, includedirs):
"""Parse a file, returning a (map of name->QIImpls, set of deps)
%{C++ blocks are printed immediately to fd."""
iids = uniqdict()
impls = uniqdict()
imported = uniqdict()
deps = sets.Set()
deps.add(file)
f = IterFile(file)
for line in f:
if len(line) == 0:
continue
if line == "%{C++":
for line in f:
if line == "%}":
break
print >>fd, line
continue
m = _pseudoiid.match(line)
if m is not None:
uuid = UUID(m.group('name'), m.group('iid'), pseudo=True)
iids[m.group('name')] = uuid
continue
m = _import.match(line)
if m is not None:
if m.group('type') == 'import':
newimpls, newdeps = parsefile(findfile(m.group('filename'), file, includedirs), fd, includedirs)
imported.update(newimpls)
deps |= newdeps
else:
newiids, newdeps = importidl(findfile(m.group('filename'), file, includedirs), includedirs)
iids.update(newiids)
deps |= newdeps
print >>fd, '#include "%s"' % m.group('filename').replace('.idl', '.h')
continue
if line.find('NS_IMPL_') != -1:
if line.find(')') == -1:
for follow in f:
line += follow
if follow.find(')') != -1:
break
if line.find(')') == -1:
raise Exception("%s: Unterminated NS_IMPL_ call" % f.loc())
m = _impl_qi.match(line)
if m is None:
raise Exception("%s: Unparseable NS_IMPL_ call" % f.loc())
bases = _split_commas.split(m.group('bases'))
cname = bases.pop(0)
baseuuids = [iids[name] for name in bases]
ifaces = [OffsetThisQIResponse(uuid) for uuid in baseuuids]
ifaces.append(OffsetThisQIResponseAmbiguous(iids['nsISupports'], ifaces[0].uuid))
q = QIImpl(cname, ifaces,
emitrefcount=(m.group('type') == 'ISUPPORTS'),
threadsafe=m.group('threadsafe') or '')
impls[cname] = q
continue
m = _map_begin.match(line)
if m is not None:
members, unfound = build_map(f, m.group('classname'), iids)
if m.group('cc') is not None:
members.append(CCParticipantResponse(m.group('classname')))
members.append(CCISupportsResponse(m.group('classname')))
base = None
if m.group('base') is not None:
if m.group('base') in impls:
base = impls[m.group('base')]
else:
base = imported[m.group('base')]
q = QIImpl(m.group('classname'), members, unfound=unfound, base=base)
impls[m.group('classname')] = q
continue
raise Exception("%s: unexpected input line" % f.loc())
return impls, deps
def main():
from optparse import OptionParser
o = OptionParser()
o.add_option("-I", action="append", dest="include_dirs", default=[],
help="Directory to search for included files.")
o.add_option("-D", dest="deps_file",
help="Write dependencies to a file")
o.add_option("-o", dest="out_file",
help="Write output to file. Required")
(options, files) = o.parse_args()
if options.out_file is None:
o.print_help()
sys.exit(1)
outfd = open(options.out_file, 'w')
deps = sets.Set()
for file in files:
impls, newdeps = parsefile(file, outfd, options.include_dirs)
for q in impls.itervalues():
q.output(outfd)
deps |= newdeps
if options.deps_file is not None:
depsfd = open(options.deps_file, 'w')
print >>depsfd, "%s: %s" % (options.out_file,
" \\\n ".join(deps))
if __name__ == '__main__':
main()

Просмотреть файл

@ -59,6 +59,10 @@ CPPSRCS = \
nsServiceManagerObsolete.cpp \
$(NULL)
GQI_SRCS = \
xpcomcomponents.gqi \
$(NULL)
EXPORTS = \
nsCategoryManagerUtils.h \
nsIServiceManagerObsolete.h \

Просмотреть файл

@ -80,48 +80,6 @@ class nsIComponentLoaderManager;
// pulled in from nsComponentManager.cpp
char* ArenaStrdup(const char* s, PLArenaPool* aArena);
//
// BaseStringEnumerator is subclassed by EntryEnumerator and
// CategoryEnumerator
//
class BaseStringEnumerator
: public nsISimpleEnumerator,
nsIUTF8StringEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
NS_DECL_NSIUTF8STRINGENUMERATOR
protected:
// Callback function for NS_QuickSort to sort mArray
static int SortCallback(const void *, const void *, void *);
BaseStringEnumerator()
: mArray(nsnull),
mCount(0),
mSimpleCurItem(0),
mStringCurItem(0) { }
// A virtual destructor is needed here because subclasses of
// BaseStringEnumerator do not implement their own Release() method.
virtual ~BaseStringEnumerator()
{
if (mArray)
delete[] mArray;
}
void Sort();
const char** mArray;
PRUint32 mCount;
PRUint32 mSimpleCurItem;
PRUint32 mStringCurItem;
};
NS_IMPL_ISUPPORTS2(BaseStringEnumerator, nsISimpleEnumerator, nsIUTF8StringEnumerator)
NS_IMETHODIMP
BaseStringEnumerator::HasMoreElements(PRBool *_retval)
{
@ -483,8 +441,6 @@ CategoryEnumerator::enumfunc_createenumerator(const char* aStr, CategoryNode* aN
// nsCategoryManager implementations
//
NS_IMPL_THREADSAFE_ISUPPORTS1(nsCategoryManager, nsICategoryManager)
nsCategoryManager*
nsCategoryManager::Create()
{
@ -786,17 +742,6 @@ nsCategoryManager::SuppressNotifications(PRBool aSuppress)
return NS_OK;
}
class nsCategoryManagerFactory : public nsIFactory
{
public:
nsCategoryManagerFactory() { }
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
};
NS_IMPL_ISUPPORTS1(nsCategoryManagerFactory, nsIFactory)
NS_IMETHODIMP
nsCategoryManagerFactory::CreateInstance( nsISupports* aOuter, const nsIID& aIID, void** aResult )
{

Просмотреть файл

@ -44,6 +44,9 @@
#include "plarena.h"
#include "nsClassHashtable.h"
#include "nsICategoryManager.h"
#include "nsIFactory.h"
#include "nsISimpleEnumerator.h"
#include "nsIStringEnumerator.h"
#define NS_CATEGORYMANAGER_CLASSNAME "Category Manager"
@ -168,4 +171,53 @@ private:
PRBool mSuppressNotifications;
};
class nsCategoryManagerFactory : public nsIFactory
{
public:
nsCategoryManagerFactory() { }
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
};
//
// BaseStringEnumerator is subclassed by EntryEnumerator and
// CategoryEnumerator
//
class BaseStringEnumerator
: public nsISimpleEnumerator,
nsIUTF8StringEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
NS_DECL_NSIUTF8STRINGENUMERATOR
protected:
// Callback function for NS_QuickSort to sort mArray
static int SortCallback(const void *, const void *, void *);
BaseStringEnumerator()
: mArray(nsnull),
mCount(0),
mSimpleCurItem(0),
mStringCurItem(0) { }
// A virtual destructor is needed here because subclasses of
// BaseStringEnumerator do not implement their own Release() method.
virtual ~BaseStringEnumerator()
{
if (mArray)
delete[] mArray;
}
void Sort();
const char** mArray;
PRUint32 mCount;
PRUint32 mSimpleCurItem;
PRUint32 mStringCurItem;
};
#endif

Просмотреть файл

@ -303,46 +303,6 @@ static const PLDHashTableOps contractID_DHashTableOps = {
////////////////////////////////////////////////////////////////////////////////
// Hashtable Enumeration
////////////////////////////////////////////////////////////////////////////////
typedef NS_CALLBACK(EnumeratorConverter)(PLDHashTable *table,
const PLDHashEntryHdr *hdr,
void *data,
nsISupports **retval);
class PLDHashTableEnumeratorImpl : public nsIBidirectionalEnumerator,
public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIENUMERATOR
NS_DECL_NSIBIDIRECTIONALENUMERATOR
NS_DECL_NSISIMPLEENUMERATOR
PLDHashTableEnumeratorImpl(PLDHashTable *table,
EnumeratorConverter converter,
void *converterData);
PRInt32 Count() { return mCount; }
private:
PLDHashTableEnumeratorImpl(); /* no implementation */
~PLDHashTableEnumeratorImpl();
void ReleaseElements();
nsVoidArray mElements;
PRInt32 mCount, mCurrent;
PRMonitor* mMonitor;
struct Closure {
PRBool succeeded;
EnumeratorConverter converter;
void *data;
PLDHashTableEnumeratorImpl *impl;
};
static PLDHashOperator PR_CALLBACK Enumerator(PLDHashTable *table,
PLDHashEntryHdr *hdr,
PRUint32 number,
void *data);
};
// static
PLDHashOperator PR_CALLBACK
@ -381,11 +341,6 @@ PLDHashTableEnumeratorImpl::PLDHashTableEnumeratorImpl(PLDHashTable *table,
}
}
NS_IMPL_ISUPPORTS3(PLDHashTableEnumeratorImpl,
nsIBidirectionalEnumerator,
nsIEnumerator,
nsISimpleEnumerator)
PLDHashTableEnumeratorImpl::~PLDHashTableEnumeratorImpl()
{
ReleaseElements();
@ -769,16 +724,6 @@ nsComponentManagerImpl::~nsComponentManagerImpl()
PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Destroyed."));
}
NS_IMPL_THREADSAFE_ISUPPORTS7(nsComponentManagerImpl,
nsIComponentManager,
nsIServiceManager,
nsISupportsWeakReference,
nsIInterfaceRequestor,
nsIComponentRegistrar,
nsIServiceManagerObsolete,
nsIComponentManagerObsolete)
nsresult
nsComponentManagerImpl::GetInterface(const nsIID & uuid, void **result)
{

Просмотреть файл

@ -64,6 +64,7 @@
#include "nsCOMArray.h"
#include "nsDataHashtable.h"
#include "nsTArray.h"
#include "nsIEnumerator.h"
struct nsFactoryEntry;
class nsIServiceManager;
@ -334,5 +335,46 @@ struct nsContractIDTableEntry : public PLDHashEntryHdr {
nsFactoryEntry *mFactoryEntry;
};
typedef NS_CALLBACK(EnumeratorConverter)(PLDHashTable *table,
const PLDHashEntryHdr *hdr,
void *data,
nsISupports **retval);
class PLDHashTableEnumeratorImpl : public nsIBidirectionalEnumerator,
public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIENUMERATOR
NS_DECL_NSIBIDIRECTIONALENUMERATOR
NS_DECL_NSISIMPLEENUMERATOR
PLDHashTableEnumeratorImpl(PLDHashTable *table,
EnumeratorConverter converter,
void *converterData);
PRInt32 Count() { return mCount; }
private:
PLDHashTableEnumeratorImpl(); /* no implementation */
~PLDHashTableEnumeratorImpl();
void ReleaseElements();
nsVoidArray mElements;
PRInt32 mCount, mCurrent;
PRMonitor* mMonitor;
struct Closure {
PRBool succeeded;
EnumeratorConverter converter;
void *data;
PLDHashTableEnumeratorImpl *impl;
};
static PLDHashOperator PR_CALLBACK Enumerator(PLDHashTable *table,
PLDHashEntryHdr *hdr,
PRUint32 number,
void *data);
};
#endif // nsComponentManager_h__

Просмотреть файл

@ -87,9 +87,6 @@ static PRLogModuleInfo *nsNativeModuleLoaderLog =
#define LOG(level, args) PR_LOG(nsNativeModuleLoaderLog, level, args)
NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader,
nsIModuleLoader)
NS_IMPL_ADDREF_USING_AGGREGATOR(nsNativeModuleLoader,
nsComponentManagerImpl::gComponentManager)
NS_IMPL_RELEASE_USING_AGGREGATOR(nsNativeModuleLoader,

Просмотреть файл

@ -0,0 +1,41 @@
%import-idl "nsIEnumerator.idl"
%import-idl "nsIComponentManager.idl"
%import-idl "nsIServiceManager.idl"
%import-idl "nsIWeakReference.idl"
%import-idl "nsIInterfaceRequestor.idl"
%import-idl "nsIComponentRegistrar.idl"
%import-idl "nsIComponentManagerObsolete.idl"
%import-idl "nsIStringEnumerator.idl"
%import-idl "nsIModuleLoader.idl"
%import-idl "nsICategoryManager.idl"
%{C++
#include "nsComponentManager.h"
#include "nsCategoryManager.h"
#include "nsNativeComponentLoader.h"
%}
%pseudo-iid nsIServiceManagerObsolete cf0df3b0-3401-11d2-8163-006008119d7a
NS_IMPL_ISUPPORTS3(PLDHashTableEnumeratorImpl,
nsIBidirectionalEnumerator,
nsIEnumerator,
nsISimpleEnumerator)
NS_IMPL_THREADSAFE_ISUPPORTS7(nsComponentManagerImpl,
nsIComponentManager,
nsIServiceManager,
nsISupportsWeakReference,
nsIInterfaceRequestor,
nsIComponentRegistrar,
nsIServiceManagerObsolete,
nsIComponentManagerObsolete)
NS_IMPL_ISUPPORTS1(nsCategoryManagerFactory, nsIFactory)
NS_IMPL_ISUPPORTS2(BaseStringEnumerator, nsISimpleEnumerator, nsIUTF8StringEnumerator)
NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader,
nsIModuleLoader)
NS_IMPL_THREADSAFE_ISUPPORTS1(nsCategoryManager, nsICategoryManager)

Просмотреть файл

@ -79,6 +79,10 @@ CPPSRCS = \
nsHashPropertyBag.cpp \
$(NULL)
GQI_SRCS = \
xpcomds.gqi \
$(NULL)
EXPORTS = \
nsAtomService.h \
nsCheapSets.h \

Просмотреть файл

@ -50,9 +50,6 @@ struct findIndexOfClosure
PR_STATIC_CALLBACK(PRBool) FindElementCallback(void* aElement, void* aClosure);
NS_IMPL_ISUPPORTS2(nsArray, nsIArray, nsIMutableArray)
nsArray::~nsArray()
{
Clear();

Просмотреть файл

@ -66,45 +66,6 @@ static PLDHashTable gAtomTable;
static PLArenaPool* gStaticAtomArena = 0;
class nsStaticAtomWrapper : public nsIAtom
{
public:
nsStaticAtomWrapper(const nsStaticAtom* aAtom, PRUint32 aLength) :
mStaticAtom(aAtom), mLength(aLength)
{
MOZ_COUNT_CTOR(nsStaticAtomWrapper);
}
~nsStaticAtomWrapper() { // no subclasses -> not virtual
// this is arena allocated and won't be called except in debug
// builds. If this function ever does anything non-debug, be sure
// to get rid of the ifdefs in AtomTableClearEntry!
MOZ_COUNT_DTOR(nsStaticAtomWrapper);
}
NS_IMETHOD QueryInterface(REFNSIID aIID,
void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_DECL_NSIATOM
const nsStaticAtom* GetStaticAtom() const {
return mStaticAtom;
}
PRUint32 getLength() const {
return mLength;
}
private:
const nsStaticAtom* mStaticAtom;
// The length of the string in the static atom. The static atom
// (nsStaticAtom) doesn't hold a length, so we keep it here in the
// wrapper instead.
PRUint32 mLength;
};
// The |key| pointer in the various PLDHashTable callbacks we use is an
// AtomTableClearEntry*. These pointers can come from two places: either a
// (probably stack-allocated) string key being passed to PL_DHashTableOperate,
@ -444,8 +405,6 @@ AtomImpl::~AtomImpl()
}
}
NS_IMPL_ISUPPORTS1(AtomImpl, nsIAtom)
PermanentAtomImpl::PermanentAtomImpl()
: AtomImpl()
{
@ -566,8 +525,6 @@ nsStaticAtomWrapper::Release()
return 1;
}
NS_IMPL_QUERY_INTERFACE1(nsStaticAtomWrapper, nsIAtom)
NS_IMETHODIMP
nsStaticAtomWrapper::GetUTF8String(const char** aResult)
{

Просмотреть файл

@ -59,8 +59,6 @@ ByteBufferImpl::Init(PRUint32 aBufferSize)
return mBuffer ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMPL_ISUPPORTS1(ByteBufferImpl,nsIByteBuffer)
ByteBufferImpl::~ByteBufferImpl()
{
if (nsnull != mBuffer) {

Просмотреть файл

@ -70,13 +70,6 @@ NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
NS_IMPL_THREADSAFE_ADDREF(nsHashPropertyBag)
NS_IMPL_THREADSAFE_RELEASE(nsHashPropertyBag)
NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
NS_INTERFACE_MAP_END
nsresult
nsHashPropertyBag::Init()
@ -146,22 +139,6 @@ nsHashPropertyBag::DeleteProperty(const nsAString& name)
// nsSimpleProperty class and impl; used for GetEnumerator
//
class nsSimpleProperty : public nsIProperty {
public:
nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
: mName(aName), mValue(aValue)
{
}
NS_DECL_ISUPPORTS
NS_DECL_NSIPROPERTY
protected:
nsString mName;
nsCOMPtr<nsIVariant> mValue;
};
NS_IMPL_ISUPPORTS1(nsSimpleProperty, nsIProperty)
NS_IMETHODIMP
nsSimpleProperty::GetName(nsAString& aName)
{

Просмотреть файл

@ -48,6 +48,7 @@
#include "nsIWritablePropertyBag.h"
#include "nsIWritablePropertyBag2.h"
#include "nsInterfaceHashtable.h"
#include "nsIProperty.h"
// Set IMETHOD_VISIBILITY to empty so that the class-level NS_COM declaration
// controls member method visibility.
@ -86,4 +87,18 @@ protected:
extern "C" NS_COM nsresult
NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval);
class nsSimpleProperty : public nsIProperty {
public:
nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
: mName(aName), mValue(aValue)
{
}
NS_DECL_ISUPPORTS
NS_DECL_NSIPROPERTY
protected:
nsString mName;
nsCOMPtr<nsIVariant> mValue;
};
#endif /* nsHashPropertyBag_h___ */

Просмотреть файл

@ -43,9 +43,6 @@
class nsIInputStream;
#define NS_IBYTE_BUFFER_IID \
{ 0xe4a6e4b0, 0x93b4, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
#define NS_IBYTEBUFFER_IID \
{ 0xe4a6e4b0, 0x93b4, 0x11d1, \
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }

Просмотреть файл

@ -43,25 +43,6 @@
#include "nsStringEnumerator.h"
#include "nsVoidArray.h"
class nsINIParserImpl :
public nsIINIParser
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIINIPARSER
nsresult Init(nsILocalFile* aINIFile) {
return mParser.Init(aINIFile);
}
private:
nsINIParser mParser;
};
NS_IMPL_ISUPPORTS2(nsINIParserFactory,
nsIINIParserFactory,
nsIFactory)
NS_IMETHODIMP
nsINIParserFactory::CreateINIParser(nsILocalFile* aINIFile,
nsIINIParser* *aResult)
@ -97,9 +78,6 @@ nsINIParserFactory::LockFactory(PRBool aLock)
return NS_OK;
}
NS_IMPL_ISUPPORTS1(nsINIParserImpl,
nsIINIParser)
static PRBool
SectionCB(const char* aSection, void *aClosure)
{

Просмотреть файл

@ -39,6 +39,7 @@
#define nsINIParserImpl_h__
#include "nsIINIParser.h"
#include "nsINIParser.h"
#include "nsIFactory.h"
#define NS_INIPARSERFACTORY_CID \
@ -58,4 +59,19 @@ public:
NS_DECL_NSIFACTORY
};
class nsINIParserImpl :
public nsIINIParser
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIINIPARSER
nsresult Init(nsILocalFile* aINIFile) {
return mParser.Init(aINIFile);
}
private:
nsINIParser mParser;
};
#endif // nsINIParserImpl_h__

Просмотреть файл

@ -39,6 +39,7 @@
#include "nscore.h"
#include "nsISupports.h"
#include "prlog.h"
#define NS_IUNICHARBUFFER_IID \
{ 0x14cf6970, 0x93b5, 0x11d1, \

Просмотреть файл

@ -129,8 +129,6 @@ nsObserverList::NotifyObservers(nsISupports *aSubject,
}
}
NS_IMPL_ISUPPORTS1(nsObserverEnumerator, nsISimpleEnumerator)
nsObserverEnumerator::nsObserverEnumerator(nsObserverList* aObserverList)
: mIndex(0)
{

Просмотреть файл

@ -141,8 +141,6 @@ nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResul
return rv;
}
NS_IMPL_THREADSAFE_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties)
NS_IMETHODIMP
nsPersistentProperties::Load(nsIInputStream *aIn)
{
@ -478,8 +476,6 @@ nsPropertyElement::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
return rv;
}
NS_IMPL_ISUPPORTS1(nsPropertyElement, nsIPropertyElement)
NS_IMETHODIMP
nsPropertyElement::GetKey(nsACString& aReturnKey)
{

Просмотреть файл

@ -56,6 +56,44 @@ struct nsStaticAtom {
nsIAtom ** mAtom;
};
class nsStaticAtomWrapper : public nsIAtom
{
public:
nsStaticAtomWrapper(const nsStaticAtom* aAtom, PRUint32 aLength) :
mStaticAtom(aAtom), mLength(aLength)
{
MOZ_COUNT_CTOR(nsStaticAtomWrapper);
}
~nsStaticAtomWrapper() { // no subclasses -> not virtual
// this is arena allocated and won't be called except in debug
// builds. If this function ever does anything non-debug, be sure
// to get rid of the ifdefs in AtomTableClearEntry!
MOZ_COUNT_DTOR(nsStaticAtomWrapper);
}
NS_IMETHOD QueryInterface(REFNSIID aIID,
void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_DECL_NSIATOM
const nsStaticAtom* GetStaticAtom() const {
return mStaticAtom;
}
PRUint32 getLength() const {
return mLength;
}
private:
const nsStaticAtom* mStaticAtom;
// The length of the string in the static atom. The static atom
// (nsStaticAtom) doesn't hold a length, so we keep it here in the
// wrapper instead.
PRUint32 mLength;
};
// register your lookup function with the atom table. Your function
// will be called when at atom is not found in the main atom table.

Просмотреть файл

@ -49,73 +49,6 @@
// nsStringEnumerator
//
class nsStringEnumerator : public nsIStringEnumerator,
public nsIUTF8StringEnumerator,
public nsISimpleEnumerator
{
public:
nsStringEnumerator(const nsStringArray* aArray, PRBool aOwnsArray) :
mArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(PR_TRUE)
{}
nsStringEnumerator(const nsCStringArray* aArray, PRBool aOwnsArray) :
mCArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(PR_FALSE)
{}
nsStringEnumerator(const nsStringArray* aArray, nsISupports* aOwner) :
mArray(aArray), mIndex(0), mOwner(aOwner), mOwnsArray(PR_FALSE), mIsUnicode(PR_TRUE)
{}
nsStringEnumerator(const nsCStringArray* aArray, nsISupports* aOwner) :
mCArray(aArray), mIndex(0), mOwner(aOwner), mOwnsArray(PR_FALSE), mIsUnicode(PR_FALSE)
{}
NS_DECL_ISUPPORTS
NS_DECL_NSIUTF8STRINGENUMERATOR
// have to declare nsIStringEnumerator manually, because of
// overlapping method names
NS_IMETHOD GetNext(nsAString& aResult);
NS_DECL_NSISIMPLEENUMERATOR
private:
~nsStringEnumerator() {
if (mOwnsArray) {
// const-casting is safe here, because the NS_New*
// constructors make sure mOwnsArray is consistent with
// the constness of the objects
if (mIsUnicode)
delete const_cast<nsStringArray*>(mArray);
else
delete const_cast<nsCStringArray*>(mCArray);
}
}
union {
const nsStringArray* mArray;
const nsCStringArray* mCArray;
};
inline PRUint32 Count() {
return mIsUnicode ? mArray->Count() : mCArray->Count();
}
PRUint32 mIndex;
// the owner allows us to hold a strong reference to the object
// that owns the array. Having a non-null value in mOwner implies
// that mOwnsArray is PR_FALSE, because we rely on the real owner
// to release the array
nsCOMPtr<nsISupports> mOwner;
PRPackedBool mOwnsArray;
PRPackedBool mIsUnicode;
};
NS_IMPL_ISUPPORTS3(nsStringEnumerator,
nsIStringEnumerator,
nsIUTF8StringEnumerator,
nsISimpleEnumerator)
NS_IMETHODIMP
nsStringEnumerator::HasMore(PRBool* aResult)
{

Просмотреть файл

@ -38,6 +38,8 @@
#include "nsIStringEnumerator.h"
#include "nsVoidArray.h"
#include "nsISimpleEnumerator.h"
#include "nsCOMPtr.h"
// nsIStringEnumerator/nsIUTF8StringEnumerator implementations
//
@ -120,3 +122,65 @@ NS_COM nsresult
NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
const nsCStringArray* aArray,
nsISupports* aOwner);
class nsStringEnumerator : public nsIStringEnumerator,
public nsIUTF8StringEnumerator,
public nsISimpleEnumerator
{
public:
nsStringEnumerator(const nsStringArray* aArray, PRBool aOwnsArray) :
mArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(PR_TRUE)
{}
nsStringEnumerator(const nsCStringArray* aArray, PRBool aOwnsArray) :
mCArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(PR_FALSE)
{}
nsStringEnumerator(const nsStringArray* aArray, nsISupports* aOwner) :
mArray(aArray), mIndex(0), mOwner(aOwner), mOwnsArray(PR_FALSE), mIsUnicode(PR_TRUE)
{}
nsStringEnumerator(const nsCStringArray* aArray, nsISupports* aOwner) :
mCArray(aArray), mIndex(0), mOwner(aOwner), mOwnsArray(PR_FALSE), mIsUnicode(PR_FALSE)
{}
NS_DECL_ISUPPORTS
NS_DECL_NSIUTF8STRINGENUMERATOR
// have to declare nsIStringEnumerator manually, because of
// overlapping method names
NS_IMETHOD GetNext(nsAString& aResult);
NS_DECL_NSISIMPLEENUMERATOR
private:
~nsStringEnumerator() {
if (mOwnsArray) {
// const-casting is safe here, because the NS_New*
// constructors make sure mOwnsArray is consistent with
// the constness of the objects
if (mIsUnicode)
delete const_cast<nsStringArray*>(mArray);
else
delete const_cast<nsCStringArray*>(mCArray);
}
}
union {
const nsStringArray* mArray;
const nsCStringArray* mCArray;
};
inline PRUint32 Count() {
return mIsUnicode ? mArray->Count() : mCArray->Count();
}
PRUint32 mIndex;
// the owner allows us to hold a strong reference to the object
// that owns the array. Having a non-null value in mOwner implies
// that mOwnsArray is PR_FALSE, because we rely on the real owner
// to release the array
nsCOMPtr<nsISupports> mOwner;
PRPackedBool mOwnsArray;
PRPackedBool mIsUnicode;
};

Просмотреть файл

@ -216,8 +216,6 @@ nsSupportsArray::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
return it->QueryInterface(aIID, aResult);
}
NS_IMPL_THREADSAFE_ISUPPORTS3(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable)
NS_IMETHODIMP
nsSupportsArray::Read(nsIObjectInputStream *aStream)
{
@ -682,27 +680,6 @@ NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult)
return rv;
}
class nsArrayEnumerator : public nsISimpleEnumerator
{
public:
// nsISupports interface
NS_DECL_ISUPPORTS
// nsISimpleEnumerator interface
NS_IMETHOD HasMoreElements(PRBool* aResult);
NS_IMETHOD GetNext(nsISupports** aResult);
// nsArrayEnumerator methods
nsArrayEnumerator(nsISupportsArray* aValueArray);
private:
~nsArrayEnumerator(void);
protected:
nsISupportsArray* mValueArray;
PRInt32 mIndex;
};
nsArrayEnumerator::nsArrayEnumerator(nsISupportsArray* aValueArray)
: mValueArray(aValueArray),
mIndex(0)
@ -715,8 +692,6 @@ nsArrayEnumerator::~nsArrayEnumerator(void)
NS_IF_RELEASE(mValueArray);
}
NS_IMPL_ISUPPORTS1(nsArrayEnumerator, nsISimpleEnumerator)
NS_IMETHODIMP
nsArrayEnumerator::HasMoreElements(PRBool* aResult)
{

Просмотреть файл

@ -168,4 +168,25 @@ private:
nsSupportsArray(const nsISupportsArray& other);
};
class nsArrayEnumerator : public nsISimpleEnumerator
{
public:
// nsISupports interface
NS_DECL_ISUPPORTS
// nsISimpleEnumerator interface
NS_IMETHOD HasMoreElements(PRBool* aResult);
NS_IMETHOD GetNext(nsISupports** aResult);
// nsArrayEnumerator methods
nsArrayEnumerator(nsISupportsArray* aValueArray);
private:
~nsArrayEnumerator(void);
protected:
nsISupportsArray* mValueArray;
PRInt32 mIndex;
};
#endif // nsSupportsArray_h__

Просмотреть файл

@ -50,8 +50,6 @@ nsSupportsArrayEnumerator::~nsSupportsArrayEnumerator()
NS_RELEASE(mArray);
}
NS_IMPL_ISUPPORTS2(nsSupportsArrayEnumerator, nsIBidirectionalEnumerator, nsIEnumerator)
NS_IMETHODIMP
nsSupportsArrayEnumerator::First()
{

Просмотреть файл

@ -47,8 +47,6 @@
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsIDImpl, nsISupportsID, nsISupportsPrimitive)
nsSupportsIDImpl::nsSupportsIDImpl()
: mData(nsnull)
{
@ -107,9 +105,6 @@ NS_IMETHODIMP nsSupportsIDImpl::ToString(char **_retval)
* nsSupportsCStringImpl
*****************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsCStringImpl, nsISupportsCString,
nsISupportsPrimitive)
NS_IMETHODIMP nsSupportsCStringImpl::GetType(PRUint16 *aType)
{
NS_ASSERTION(aType, "Bad pointer");
@ -144,9 +139,6 @@ NS_IMETHODIMP nsSupportsCStringImpl::SetData(const nsACString& aData)
* nsSupportsStringImpl
*****************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsStringImpl, nsISupportsString,
nsISupportsPrimitive)
NS_IMETHODIMP nsSupportsStringImpl::GetType(PRUint16 *aType)
{
NS_ASSERTION(aType, "Bad pointer");
@ -179,9 +171,6 @@ NS_IMETHODIMP nsSupportsStringImpl::SetData(const nsAString& aData)
/***************************************************************************/
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsPRBoolImpl, nsISupportsPRBool,
nsISupportsPrimitive)
nsSupportsPRBoolImpl::nsSupportsPRBoolImpl()
: mData(PR_FALSE)
{
@ -220,9 +209,6 @@ NS_IMETHODIMP nsSupportsPRBoolImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRUint8Impl, nsISupportsPRUint8,
nsISupportsPrimitive)
nsSupportsPRUint8Impl::nsSupportsPRUint8Impl()
: mData(0)
{
@ -265,9 +251,6 @@ NS_IMETHODIMP nsSupportsPRUint8Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRUint16Impl, nsISupportsPRUint16,
nsISupportsPrimitive)
nsSupportsPRUint16Impl::nsSupportsPRUint16Impl()
: mData(0)
{
@ -310,9 +293,6 @@ NS_IMETHODIMP nsSupportsPRUint16Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRUint32Impl, nsISupportsPRUint32,
nsISupportsPrimitive)
nsSupportsPRUint32Impl::nsSupportsPRUint32Impl()
: mData(0)
{
@ -355,9 +335,6 @@ NS_IMETHODIMP nsSupportsPRUint32Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRUint64Impl, nsISupportsPRUint64,
nsISupportsPrimitive)
nsSupportsPRUint64Impl::nsSupportsPRUint64Impl()
: mData(LL_ZERO)
{
@ -400,9 +377,6 @@ NS_IMETHODIMP nsSupportsPRUint64Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRTimeImpl, nsISupportsPRTime,
nsISupportsPrimitive)
nsSupportsPRTimeImpl::nsSupportsPRTimeImpl()
: mData(LL_ZERO)
{
@ -445,9 +419,6 @@ NS_IMETHODIMP nsSupportsPRTimeImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsCharImpl, nsISupportsChar,
nsISupportsPrimitive)
nsSupportsCharImpl::nsSupportsCharImpl()
: mData(0)
{
@ -490,9 +461,6 @@ NS_IMETHODIMP nsSupportsCharImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRInt16Impl, nsISupportsPRInt16,
nsISupportsPrimitive)
nsSupportsPRInt16Impl::nsSupportsPRInt16Impl()
: mData(0)
{
@ -535,9 +503,6 @@ NS_IMETHODIMP nsSupportsPRInt16Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRInt32Impl, nsISupportsPRInt32,
nsISupportsPrimitive)
nsSupportsPRInt32Impl::nsSupportsPRInt32Impl()
: mData(0)
{
@ -580,9 +545,6 @@ NS_IMETHODIMP nsSupportsPRInt32Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsPRInt64Impl, nsISupportsPRInt64,
nsISupportsPrimitive)
nsSupportsPRInt64Impl::nsSupportsPRInt64Impl()
: mData(LL_ZERO)
{
@ -625,9 +587,6 @@ NS_IMETHODIMP nsSupportsPRInt64Impl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsFloatImpl, nsISupportsFloat,
nsISupportsPrimitive)
nsSupportsFloatImpl::nsSupportsFloatImpl()
: mData(float(0.0))
{
@ -670,9 +629,6 @@ NS_IMETHODIMP nsSupportsFloatImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsDoubleImpl, nsISupportsDouble,
nsISupportsPrimitive)
nsSupportsDoubleImpl::nsSupportsDoubleImpl()
: mData(double(0.0))
{
@ -716,9 +672,6 @@ NS_IMETHODIMP nsSupportsDoubleImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsVoidImpl, nsISupportsVoid,
nsISupportsPrimitive)
nsSupportsVoidImpl::nsSupportsVoidImpl()
: mData(nsnull)
{
@ -758,10 +711,6 @@ NS_IMETHODIMP nsSupportsVoidImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsInterfacePointerImpl,
nsISupportsInterfacePointer,
nsISupportsPrimitive)
nsSupportsInterfacePointerImpl::nsSupportsInterfacePointerImpl()
: mIID(nsnull)
{
@ -839,8 +788,6 @@ NS_IMETHODIMP nsSupportsInterfacePointerImpl::ToString(char **_retval)
/***************************************************************************/
NS_IMPL_ISUPPORTS2(nsSupportsDependentCString,nsISupportsCString,nsISupportsPrimitive)
nsSupportsDependentCString::nsSupportsDependentCString(const char* aStr)
: mData(aStr)
{ }

Просмотреть файл

@ -74,8 +74,6 @@ UnicharBufferImpl::Init(PRUint32 aBufferSize)
return mBuffer ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMPL_ISUPPORTS1(UnicharBufferImpl, nsIUnicharBuffer)
UnicharBufferImpl::~UnicharBufferImpl()
{
if (nsnull != mBuffer) {

Просмотреть файл

@ -1689,8 +1689,6 @@ nsVariant::Traverse(const nsDiscriminatedUnion& data,
/***************************************************************************/
// members...
NS_IMPL_ISUPPORTS2(nsVariant, nsIVariant, nsIWritableVariant)
nsVariant::nsVariant()
: mWritable(PR_TRUE)
{

135
xpcom/ds/xpcomds.gqi Normal file
Просмотреть файл

@ -0,0 +1,135 @@
%import-idl "nsIMutableArray.idl"
%import-idl "nsIProperty.idl"
%import-idl "nsIINIParser.idl"
%import-idl "nsIFactory.idl"
%import-idl "nsIVariant.idl"
%import-idl "nsIPersistentProperties2.idl"
%import-idl "nsISimpleEnumerator.idl"
%import-idl "nsIStringEnumerator.idl"
%import-idl "nsISupportsArray.idl"
%import-idl "nsISerializable.idl"
%import-idl "nsIAtom.idl"
%import-idl "nsISupportsPrimitives.idl"
%import-idl "nsIWritablePropertyBag.idl"
%import-idl "nsIWritablePropertyBag2.idl"
%{C++
#include "nsArray.h"
#include "nsIByteBuffer.h"
#include "nsHashPropertyBag.h"
#include "nsINIParserImpl.h"
#include "nsVariant.h"
#include "nsByteBuffer.h"
#include "nsPersistentProperties.h"
#include "nsUnicharBuffer.h"
#include "nsObserverList.h"
#include "nsStringEnumerator.h"
#include "nsSupportsArray.h"
#include "nsAtomTable.h"
#include "nsStaticAtom.h"
#include "nsSupportsArrayEnumerator.h"
#include "nsSupportsPrimitives.h"
%}
%pseudo-iid nsIByteBuffer e4a6e4b0-93b4-11d1-895b-006008911b81
%pseudo-iid nsIUnicharBuffer 14cf6970-93b5-11d1-895b-006008911b81
NS_IMPL_ISUPPORTS2(nsArray, nsIArray, nsIMutableArray)
NS_IMPL_ISUPPORTS1(nsSimpleProperty, nsIProperty)
NS_IMPL_ISUPPORTS2(nsINIParserFactory,
nsIINIParserFactory,
nsIFactory)
NS_IMPL_ISUPPORTS1(nsINIParserImpl,
nsIINIParser)
NS_IMPL_ISUPPORTS2(nsVariant, nsIVariant, nsIWritableVariant)
NS_IMPL_ISUPPORTS1(ByteBufferImpl,nsIByteBuffer)
NS_IMPL_THREADSAFE_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties)
NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
NS_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS1(nsPropertyElement, nsIPropertyElement)
NS_IMPL_ISUPPORTS1(UnicharBufferImpl, nsIUnicharBuffer)
NS_IMPL_ISUPPORTS1(nsObserverEnumerator, nsISimpleEnumerator)
NS_IMPL_ISUPPORTS3(nsStringEnumerator,
nsIStringEnumerator,
nsIUTF8StringEnumerator,
nsISimpleEnumerator)
NS_IMPL_THREADSAFE_ISUPPORTS3(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable)
NS_IMPL_ISUPPORTS1(nsArrayEnumerator, nsISimpleEnumerator)
NS_IMPL_ISUPPORTS1(AtomImpl, nsIAtom)
NS_IMPL_QUERY_INTERFACE1(nsStaticAtomWrapper, nsIAtom)
NS_IMPL_ISUPPORTS2(nsSupportsArrayEnumerator, nsIBidirectionalEnumerator, nsIEnumerator)
NS_IMPL_ISUPPORTS2(nsSupportsIDImpl, nsISupportsID, nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsCStringImpl, nsISupportsCString,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsStringImpl, nsISupportsString,
nsISupportsPrimitive)
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsPRBoolImpl, nsISupportsPRBool,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRUint8Impl, nsISupportsPRUint8,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRUint16Impl, nsISupportsPRUint16,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRUint32Impl, nsISupportsPRUint32,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRUint64Impl, nsISupportsPRUint64,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRTimeImpl, nsISupportsPRTime,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsCharImpl, nsISupportsChar,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRInt16Impl, nsISupportsPRInt16,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRInt32Impl, nsISupportsPRInt32,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsPRInt64Impl, nsISupportsPRInt64,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsFloatImpl, nsISupportsFloat,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsDoubleImpl, nsISupportsDouble,
nsISupportsPrimitive)
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsVoidImpl, nsISupportsVoid,
nsISupportsPrimitive)
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsInterfacePointerImpl,
nsISupportsInterfacePointer,
nsISupportsPrimitive)
NS_IMPL_ISUPPORTS2(nsSupportsDependentCString,nsISupportsCString,nsISupportsPrimitive)