Remove unused content code. Bug 207021, r=jst, sr=alecf.

This commit is contained in:
bryner%netscape.com 2003-06-17 17:53:06 +00:00
Родитель f6516c3e12
Коммит 97504df874
8 изменённых файлов: 0 добавлений и 897 удалений

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

@ -92,7 +92,6 @@ CPPSRCS = \
nsHTMLMapElement.cpp \
nsHTMLMenuElement.cpp \
nsHTMLMetaElement.cpp \
nsHTMLModElement.cpp \
nsHTMLOListElement.cpp \
nsHTMLObjectElement.cpp \
nsHTMLOptionElement.cpp \

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

@ -1328,9 +1328,6 @@ NS_NewHTMLMenuElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewHTMLMetaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewHTMLModElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewHTMLOListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);

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

@ -1,148 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLModElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
class nsHTMLModElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLModElement
{
public:
nsHTMLModElement();
virtual ~nsHTMLModElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLModElement
NS_DECL_NSIDOMHTMLMODELEMENT
};
nsresult
NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLModElement* it = new nsHTMLModElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLModElement::nsHTMLModElement()
{
}
nsHTMLModElement::~nsHTMLModElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLModElement, nsGenericElement);
NS_IMPL_RELEASE_INHERITED(nsHTMLModElement, nsGenericElement);
// QueryInterface implementation for nsHTMLModElement
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLModElement,
nsGenericHTMLContainerElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLModElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLModElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
nsresult
nsHTMLModElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLModElement* it = new nsHTMLModElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLModElement, Cite, cite)
NS_IMPL_STRING_ATTR(nsHTMLModElement, DateTime, datetime)

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

@ -96,25 +96,6 @@ nsresult
NS_NewXMLStylesheetProcessingInstruction(nsIContent** aInstancePtrResult,
const nsAString& aData);
nsresult
NS_NewXMLEntity(nsIContent** aInstancePtrResult,
const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aNotationName);
nsresult
NS_NewXMLNotation(nsIContent** aInstancePtrResult,
const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId);
class nsIDOMNamedNodeMap;
nsresult
NS_NewXMLNamedNodeMap(nsIDOMNamedNodeMap** aInstancePtrResult,
nsISupportsArray *aArray);
nsresult
NS_NewXMLCDATASection(nsIContent** aInstancePtrResult);

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

@ -49,9 +49,6 @@ CPPSRCS = \
nsXMLElement.cpp \
nsXMLCDATASection.cpp \
nsXMLProcessingInstruction.cpp \
nsXMLEntity.cpp \
nsXMLNotation.cpp \
nsXMLNamedNodeMap.cpp \
nsXMLStylesheetPI.cpp \
$(NULL)

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

@ -1,222 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMEntity.h"
#include "nsGenericDOMDataNode.h"
#include "nsLayoutAtoms.h"
#include "nsString.h"
class nsXMLEntity : public nsGenericDOMDataNode,
public nsIDOMEntity
{
public:
nsXMLEntity(const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aNotationName);
virtual ~nsXMLEntity();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA
// nsIDOMEntity
NS_DECL_NSIDOMENTITY
NS_IMETHOD GetTag(nsIAtom** aResult) const;
#ifdef DEBUG
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const;
#endif
protected:
// XXX Processing instructions are currently implemented by using
// the generic CharacterData inner object, even though PIs are not
// character data. This is done simply for convenience and should
// be changed if this restricts what should be done for character data.
nsAutoString mName;
nsString mPublicId;
nsString mSystemId;
nsString mNotationName;
};
nsresult
NS_NewXMLEntity(nsIContent** aInstancePtrResult,
const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aNotationName)
{
*aInstancePtrResult = new nsXMLEntity(aName, aPublicId, aSystemId,
aNotationName);
NS_ENSURE_TRUE(*aInstancePtrResult, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsXMLEntity::nsXMLEntity(const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aNotationName) :
mName(aName), mPublicId(aPublicId), mSystemId(aSystemId),
mNotationName(aNotationName)
{
}
nsXMLEntity::~nsXMLEntity()
{
}
// QueryInterface implementation for nsXMLEntity
NS_INTERFACE_MAP_BEGIN(nsXMLEntity)
NS_INTERFACE_MAP_ENTRY(nsIDOMEntity)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Entity)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF_INHERITED(nsXMLEntity, nsGenericDOMDataNode)
NS_IMPL_RELEASE_INHERITED(nsXMLEntity, nsGenericDOMDataNode)
NS_IMETHODIMP
nsXMLEntity::GetPublicId(nsAString& aPublicId)
{
aPublicId.Assign(mPublicId);
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::GetSystemId(nsAString& aSystemId)
{
aSystemId.Assign(mSystemId);
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::GetNotationName(nsAString& aNotationName)
{
aNotationName.Assign(mNotationName);
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::GetTag(nsIAtom** aResult) const
{
// *aResult = nsLayoutAtoms::EntityTagName;
// NS_ADDREF(*aResult);
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::GetNodeName(nsAString& aNodeName)
{
aNodeName.Assign(mName);
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::GetNodeType(PRUint16* aNodeType)
{
*aNodeType = (PRUint16)nsIDOMNode::ENTITY_NODE;
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = new nsXMLEntity(mName, mSystemId, mPublicId, mNotationName);
NS_ENSURE_TRUE(*aReturn, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
nsXMLEntity::List(FILE* out, PRInt32 aIndent) const
{
NS_PRECONDITION(mDocument, "bad content");
PRInt32 index;
for (index = aIndent; --index >= 0; ) fputs(" ", out);
fprintf(out, "Entity refcount=%d<!ENTITY ", mRefCnt.get());
nsAutoString tmp(mName);
if (!mPublicId.IsEmpty()) {
tmp.Append(NS_LITERAL_STRING(" PUBLIC \""));
tmp.Append(mPublicId);
tmp.Append(NS_LITERAL_STRING("\""));
}
if (!mSystemId.IsEmpty()) {
tmp.Append(NS_LITERAL_STRING(" SYSTEM \""));
tmp.Append(mSystemId);
tmp.Append(NS_LITERAL_STRING("\""));
}
if (!mNotationName.IsEmpty()) {
tmp.Append(NS_LITERAL_STRING(" NDATA "));
tmp.Append(mNotationName);
}
fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out);
fputs(">\n", out);
return NS_OK;
}
NS_IMETHODIMP
nsXMLEntity::DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const
{
return NS_OK;
}
#endif

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

@ -1,295 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMNamedNodeMap.h"
#include "nsGenericDOMDataNode.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
#include "nsContentUtils.h"
class nsXMLNamedNodeMap : public nsIDOMNamedNodeMap
{
public:
nsXMLNamedNodeMap(nsISupportsArray *aArray);
virtual ~nsXMLNamedNodeMap();
// nsISupports
NS_DECL_ISUPPORTS
// nsIDOMNamedNodeMap
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD GetNamedItem(const nsAString& aName,
nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsAString& aName,
nsIDOMNode** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsAString& aNamespaceURI,
const nsAString&aLocalName,
nsIDOMNode** aReturn);
protected:
nsISupportsArray *mArray;
};
nsresult
NS_NewXMLNamedNodeMap(nsIDOMNamedNodeMap** aInstancePtrResult,
nsISupportsArray *aArray)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsIDOMNamedNodeMap* it = new nsXMLNamedNodeMap(aArray);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aInstancePtrResult = it;
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsXMLNamedNodeMap::nsXMLNamedNodeMap(nsISupportsArray *aArray)
{
mArray = aArray;
NS_IF_ADDREF(mArray);
}
nsXMLNamedNodeMap::~nsXMLNamedNodeMap()
{
NS_IF_RELEASE(mArray);
}
// QueryInterface implementation for nsXMLNamedNodeMap
NS_INTERFACE_MAP_BEGIN(nsXMLNamedNodeMap)
NS_INTERFACE_MAP_ENTRY(nsIDOMNamedNodeMap)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NamedNodeMap)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsXMLNamedNodeMap)
NS_IMPL_RELEASE(nsXMLNamedNodeMap)
NS_IMETHODIMP
nsXMLNamedNodeMap::GetLength(PRUint32* aLength)
{
if (mArray)
mArray->Count(aLength);
else
*aLength = 0;
return NS_OK;
}
NS_IMETHODIMP
nsXMLNamedNodeMap::GetNamedItem(const nsAString& aName,
nsIDOMNode** aReturn)
{
if (!aReturn)
return NS_ERROR_NULL_POINTER;
*aReturn = 0;
if (!mArray)
return NS_OK;
nsCOMPtr<nsIDOMNode> node;
PRUint32 i, count;
mArray->Count(&count);
for (i = 0; i < count; i++) {
mArray->QueryElementAt(i, NS_GET_IID(nsIDOMNode), getter_AddRefs(node));
if (!node)
break;
nsAutoString tmpName;
node->GetNodeName(tmpName);
if (aName.Equals(tmpName)) {
*aReturn = node;
break;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsXMLNamedNodeMap::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
if (!aReturn || !aArg)
return NS_ERROR_NULL_POINTER;
*aReturn = 0;
// XXX, do same-origin check here once we know what to do with this class
nsAutoString argName;
aArg->GetNodeName(argName);
if (mArray) {
nsCOMPtr<nsIDOMNode> node;
PRUint32 i, count;
mArray->Count(&count);
for (i = 0; i < count; i++) {
mArray->QueryElementAt(i, NS_GET_IID(nsIDOMNode), getter_AddRefs(node));
if (!node)
break;
nsAutoString tmpName;
node->GetNodeName(tmpName);
if (argName.Equals(tmpName)) {
mArray->ReplaceElementAt(aArg, i);
*aReturn = node;
break;
}
}
} else {
nsresult rv = NS_NewISupportsArray(&mArray);
if (NS_FAILED(rv))
return rv;
}
if (!*aReturn)
mArray->AppendElement(aArg);
return NS_OK;
}
NS_IMETHODIMP
nsXMLNamedNodeMap::RemoveNamedItem(const nsAString& aName,
nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = 0;
if (!mArray)
return NS_OK;
nsCOMPtr<nsIDOMNode> node;
PRUint32 i, count;
mArray->Count(&count);
for (i = 0; i < count; i++) {
mArray->QueryElementAt(i, NS_GET_IID(nsIDOMNode), getter_AddRefs(node));
if (!node)
break;
nsAutoString tmpName;
node->GetNodeName(tmpName);
if (aName.Equals(tmpName)) {
*aReturn = node;
mArray->RemoveElementAt(i);
break;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsXMLNamedNodeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
PRUint32 count;
mArray->Count(&count);
if (mArray && aIndex < count) {
nsCOMPtr<nsIDOMNode> node;
mArray->QueryElementAt(aIndex, NS_GET_IID(nsIDOMNode),
getter_AddRefs(node));
*aReturn = node;
NS_IF_ADDREF(*aReturn);
} else
*aReturn = 0;
return NS_OK;
}
nsresult
nsXMLNamedNodeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXMLNamedNodeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsXMLNamedNodeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
const nsAString&aLocalName,
nsIDOMNode** aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -1,206 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMNotation.h"
#include "nsIDOMEventReceiver.h"
#include "nsIContent.h"
#include "nsGenericDOMDataNode.h"
#include "nsGenericElement.h"
#include "nsLayoutAtoms.h"
#include "nsString.h"
#include "nsIXMLContent.h"
class nsXMLNotation : public nsGenericDOMDataNode,
public nsIDOMNotation
{
public:
nsXMLNotation(const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId);
virtual ~nsXMLNotation();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA
// nsIDOMNotation
NS_DECL_NSIDOMNOTATION
#ifdef DEBUG
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const;
#endif
// nsIContent
NS_IMETHOD GetTag(nsIAtom** aResult) const;
protected:
nsAutoString mName;
nsString mPublicId;
nsString mSystemId;
};
nsresult
NS_NewXMLNotation(nsIContent** aInstancePtrResult,
const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId)
{
*aInstancePtrResult = new nsXMLNotation(aName, aPublicId, aSystemId);
NS_ENSURE_TRUE(*aInstancePtrResult, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsXMLNotation::nsXMLNotation(const nsAString& aName,
const nsAString& aPublicId,
const nsAString& aSystemId) :
mName(aName), mPublicId(aPublicId), mSystemId(aSystemId)
{
}
nsXMLNotation::~nsXMLNotation()
{
}
// QueryInterface implementation for nsXMLNotation
NS_INTERFACE_MAP_BEGIN(nsXMLNotation)
NS_INTERFACE_MAP_ENTRY(nsIDOMNotation)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Notation)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF_INHERITED(nsXMLNotation, nsGenericDOMDataNode)
NS_IMPL_RELEASE_INHERITED(nsXMLNotation, nsGenericDOMDataNode)
NS_IMETHODIMP
nsXMLNotation::GetPublicId(nsAString& aPublicId)
{
aPublicId.Assign(mPublicId);
return NS_OK;
}
NS_IMETHODIMP
nsXMLNotation::GetSystemId(nsAString& aSystemId)
{
aSystemId.Assign(mSystemId);
return NS_OK;
}
NS_IMETHODIMP
nsXMLNotation::GetTag(nsIAtom** aResult) const
{
// *aResult = nsLayoutAtoms::NotationTagName;
// NS_ADDREF(*aResult);
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsXMLNotation::GetNodeName(nsAString& aNodeName)
{
aNodeName.Assign(mName);
return NS_OK;
}
NS_IMETHODIMP
nsXMLNotation::GetNodeType(PRUint16* aNodeType)
{
*aNodeType = (PRUint16)nsIDOMNode::NOTATION_NODE;
return NS_OK;
}
NS_IMETHODIMP
nsXMLNotation::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = new nsXMLNotation(mName, mSystemId, mPublicId);
NS_ENSURE_TRUE(*aReturn, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aReturn);
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
nsXMLNotation::List(FILE* out, PRInt32 aIndent) const
{
NS_PRECONDITION(mDocument, "bad content");
PRInt32 index;
for (index = aIndent; --index >= 0; ) fputs(" ", out);
fprintf(out, "Notation refcount=%d<!NOTATION ", mRefCnt.get());
nsAutoString tmp(mName);
if (!mPublicId.IsEmpty()) {
tmp.Append(NS_LITERAL_STRING(" PUBLIC \""));
tmp.Append(mPublicId);
tmp.Append(NS_LITERAL_STRING("\""));
}
if (!mSystemId.IsEmpty()) {
tmp.Append(NS_LITERAL_STRING(" SYSTEM \""));
tmp.Append(mSystemId);
tmp.Append(NS_LITERAL_STRING("\""));
}
fputs(NS_LossyConvertUCS2toASCII(tmp).get(), out);
fputs(">\n", out);
return NS_OK;
}
NS_IMETHODIMP
nsXMLNotation::DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const
{
return NS_OK;
}
#endif