2001-09-25 05:32:19 +04:00
|
|
|
/* -*- 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
|
2000-05-08 18:29:44 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* 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/
|
2000-05-08 18:29:44 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* 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.
|
2000-05-08 18:29:44 +04:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* 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.
|
2000-05-08 18:29:44 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* 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 ***** */
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* nsINodeInfo is an interface to node info, such as name, prefix, namespace
|
2000-08-30 04:35:43 +04:00
|
|
|
* ID and possibly other data that is shared between nodes (elements
|
2000-05-08 18:29:44 +04:00
|
|
|
* and attributes) that have the same name, prefix and namespace ID within
|
|
|
|
* the same document.
|
|
|
|
*
|
|
|
|
* nsINodeInfoManager is an interface to an object that manages a list of
|
|
|
|
* nsINodeInfo's, every document object should hold a strong reference to
|
2000-08-30 04:35:43 +04:00
|
|
|
* a nsINodeInfoManager and every nsINodeInfo also holds a strong reference
|
2000-05-08 18:29:44 +04:00
|
|
|
* to their owning manager. When a nsINodeInfo is no longer used it will
|
|
|
|
* automatically remove itself from its owner manager, and when all
|
|
|
|
* nsINodeInfo's have been removed from a nsINodeInfoManager and all external
|
|
|
|
* references are released the nsINodeInfoManager deletes itself.
|
|
|
|
*
|
|
|
|
* -- jst@netscape.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsINodeInfo_h___
|
|
|
|
#define nsINodeInfo_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2002-01-03 07:51:02 +03:00
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsAString.h"
|
|
|
|
#include "domstubs.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
2003-11-15 08:27:37 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCOMArray.h"
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
// Forward declarations
|
2003-11-15 08:27:37 +03:00
|
|
|
class nsINodeInfo;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
class nsIDocument;
|
2002-07-24 02:16:45 +04:00
|
|
|
class nsIURI;
|
2002-07-31 01:26:32 +04:00
|
|
|
class nsIPrincipal;
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
// IID for the nsINodeInfo interface
|
|
|
|
#define NS_INODEINFO_IID \
|
|
|
|
{ 0x93dbfd8c, 0x2fb3, 0x4ef5, \
|
|
|
|
{0xa2, 0xa0, 0xcf, 0xf2, 0x69, 0x6f, 0x07, 0x88} }
|
|
|
|
|
|
|
|
// IID for the nsINodeInfoManager interface
|
|
|
|
#define NS_INODEINFOMANAGER_IID \
|
|
|
|
{ 0xb622469b, 0x4dcf, 0x45c4, \
|
|
|
|
{0xb0, 0xb9, 0xa7, 0x32, 0xbc, 0xee, 0xa5, 0xcc} }
|
|
|
|
|
2000-09-14 03:57:52 +04:00
|
|
|
#define NS_NODEINFOMANAGER_CONTRACTID "@mozilla.org/layout/nodeinfomanager;1"
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
|
2003-11-15 08:27:37 +03:00
|
|
|
class nsINodeInfoManager : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INODEINFOMANAGER_IID)
|
|
|
|
|
|
|
|
nsINodeInfoManager()
|
|
|
|
: mDocument(nsnull)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~nsINodeInfoManager() { }
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the nodeinfo manager with a document.
|
|
|
|
*/
|
|
|
|
virtual nsresult Init(nsIDocument *aDocument) = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Release the reference to the document, this will be called when
|
|
|
|
* the document is going away.
|
|
|
|
*/
|
|
|
|
virtual void DropDocumentReference() = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Methods for creating nodeinfo's from atoms and/or strings.
|
|
|
|
*/
|
|
|
|
virtual nsresult GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
|
|
|
PRInt32 aNamespaceID,
|
|
|
|
nsINodeInfo** aNodeInfo) = 0;
|
|
|
|
virtual nsresult GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
|
|
|
|
PRInt32 aNamespaceID,
|
|
|
|
nsINodeInfo** aNodeInfo) = 0;
|
|
|
|
virtual nsresult GetNodeInfo(const nsAString& aQualifiedName,
|
|
|
|
const nsAString& aNamespaceURI,
|
|
|
|
nsINodeInfo** aNodeInfo) = 0;
|
|
|
|
|
|
|
|
virtual nsresult GetNodeInfo(const nsACString& aName, nsIAtom *aPrefix,
|
|
|
|
PRInt32 aNamespaceID,
|
|
|
|
nsINodeInfo** aNodeInfo) = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Retrieve a pointer to the document that owns this node info
|
|
|
|
* manager.
|
|
|
|
*/
|
|
|
|
nsIDocument* GetDocument() const
|
|
|
|
{
|
|
|
|
return mDocument;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the principal of the document associated with this.
|
|
|
|
*/
|
|
|
|
virtual nsresult GetDocumentPrincipal(nsIPrincipal** aPrincipal) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the principal of the nodeinfo manager. This should only be called
|
|
|
|
* when this nodeinfo manager isn't connected to an nsIDocument.
|
|
|
|
*/
|
|
|
|
virtual nsresult SetDocumentPrincipal(nsIPrincipal* aPrincipal) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Populate the given nsCOMArray with all of the nsINodeInfos
|
|
|
|
* managed by this manager.
|
|
|
|
*/
|
|
|
|
virtual nsresult GetNodeInfos(nsCOMArray<nsINodeInfo> *aArray) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsIDocument *mDocument; // WEAK
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-05-08 18:29:44 +04:00
|
|
|
class nsINodeInfo : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INODEINFO_IID)
|
|
|
|
|
2002-01-03 07:51:02 +03:00
|
|
|
nsINodeInfo()
|
2003-11-15 08:27:37 +03:00
|
|
|
: mInner(nsnull, nsnull, kNameSpaceID_None),
|
|
|
|
mOwnerManager(nsnull)
|
2002-01-03 07:51:02 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-11-15 08:27:37 +03:00
|
|
|
virtual ~nsINodeInfo() { }
|
|
|
|
|
2000-05-08 18:29:44 +04:00
|
|
|
/*
|
|
|
|
* Get the name from this node as a string, this does not include the prefix.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" this will return "body" and for the XML
|
|
|
|
* element "<html:body>" this will return "body".
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
void GetName(nsAString& aName) const
|
2002-01-03 07:51:02 +03:00
|
|
|
{
|
|
|
|
mInner.mName->ToString(aName);
|
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the name from this node as an atom, this does not include the prefix.
|
|
|
|
* This function never returns a null atom.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" this will return the "body" atom and for
|
|
|
|
* the XML element "<html:body>" this will return the "body" atom.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsIAtom* NameAtom() const
|
2002-01-03 07:51:02 +03:00
|
|
|
{
|
2003-06-14 00:10:01 +04:00
|
|
|
return mInner.mName;
|
2002-01-03 07:51:02 +03:00
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the qualified name from this node as a string, the qualified name
|
|
|
|
* includes the prefix, if one exists.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" this will return "body" and for the XML
|
|
|
|
* element "<html:body>" this will return "html:body".
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
virtual void GetQualifiedName(nsAString& aQualifiedName) const = 0;
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the local name from this node as a string, GetLocalName() gets the
|
|
|
|
* same string as GetName() but only if the node has a prefix and/or a
|
|
|
|
* namespace URI. If the node has neither a prefix nor a namespace URI the
|
|
|
|
* local name is a null string.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" in a HTML document this will return a null
|
|
|
|
* string and for the XML element "<html:body>" this will return "body".
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
virtual void GetLocalName(nsAString& aLocalName) const = 0;
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the prefix from this node as a string.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" this will return a null string and for
|
|
|
|
* the XML element "<html:body>" this will return the string "html".
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
void GetPrefix(nsAString& aPrefix) const
|
2002-01-03 07:51:02 +03:00
|
|
|
{
|
|
|
|
if (mInner.mPrefix) {
|
|
|
|
mInner.mPrefix->ToString(aPrefix);
|
|
|
|
} else {
|
|
|
|
SetDOMStringToNull(aPrefix);
|
|
|
|
}
|
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the prefix from this node as an atom.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" this will return a null atom and for
|
|
|
|
* the XML element "<html:body>" this will return the "html" atom.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsIAtom* GetPrefixAtom() const
|
2002-01-03 07:51:02 +03:00
|
|
|
{
|
2003-06-14 00:10:01 +04:00
|
|
|
return mInner.mPrefix;
|
2002-01-03 07:51:02 +03:00
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the namespace URI for a node, if the node has a namespace URI.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" in a HTML document this will return a null
|
|
|
|
* string and for the XML element "<html:body>" (assuming that this element,
|
|
|
|
* or one of it's ancestors has an
|
2000-06-15 13:54:41 +04:00
|
|
|
* xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return
|
|
|
|
* the string "http://www.w3.org/1999/xhtml".
|
2000-05-08 18:29:44 +04:00
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
virtual nsresult GetNamespaceURI(nsAString& aNameSpaceURI) const = 0;
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the namespace ID for a node if the node has a namespace, if not this
|
|
|
|
* returns kNameSpaceID_None.
|
|
|
|
*
|
|
|
|
* For the HTML element "<body>" in a HTML document this will return
|
|
|
|
* kNameSpaceID_None and for the XML element "<html:body>" (assuming that
|
|
|
|
* this element, or one of it's ancestors has an
|
2000-06-15 13:54:41 +04:00
|
|
|
* xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return
|
|
|
|
* the namespace ID for "http://www.w3.org/1999/xhtml".
|
2000-05-08 18:29:44 +04:00
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
PRInt32 NamespaceID() const
|
2002-01-03 07:51:02 +03:00
|
|
|
{
|
2003-06-14 00:10:01 +04:00
|
|
|
return mInner.mNamespaceID;
|
2002-01-03 07:51:02 +03:00
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
2000-08-30 04:35:43 +04:00
|
|
|
/*
|
2002-01-03 07:51:02 +03:00
|
|
|
* Get and set the ID attribute atom for this node.
|
2000-08-30 04:35:43 +04:00
|
|
|
* See http://www.w3.org/TR/1998/REC-xml-19980210#sec-attribute-types
|
|
|
|
* for the definition of an ID attribute.
|
|
|
|
*
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsIAtom* GetIDAttributeAtom() const
|
|
|
|
{
|
|
|
|
return mIDAttributeAtom;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetIDAttributeAtom(nsIAtom* aID)
|
|
|
|
{
|
|
|
|
mIDAttributeAtom = aID;
|
|
|
|
}
|
2000-08-30 04:35:43 +04:00
|
|
|
|
2000-05-08 18:29:44 +04:00
|
|
|
/*
|
|
|
|
* Get the owning node info manager, this will never return null.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsINodeInfoManager* NodeInfoManager() const
|
|
|
|
{
|
|
|
|
return mOwnerManager;
|
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
2000-08-30 04:35:43 +04:00
|
|
|
* Utility functions that can be used to check if a nodeinfo holds a specific
|
2000-05-08 18:29:44 +04:00
|
|
|
* name, name and prefix, name and prefix and namespace ID, or just
|
|
|
|
* namespace ID.
|
|
|
|
*/
|
2002-01-03 07:51:02 +03:00
|
|
|
PRBool Equals(nsINodeInfo *aNodeInfo) const
|
|
|
|
{
|
|
|
|
return aNodeInfo == this || aNodeInfo->Equals(mInner.mName, mInner.mPrefix,
|
|
|
|
mInner.mNamespaceID);
|
|
|
|
}
|
|
|
|
|
2002-03-27 03:13:57 +03:00
|
|
|
PRBool NameAndNamespaceEquals(nsINodeInfo *aNodeInfo) const
|
|
|
|
{
|
|
|
|
return aNodeInfo == this || aNodeInfo->Equals(mInner.mName,
|
|
|
|
mInner.mNamespaceID);
|
|
|
|
}
|
|
|
|
|
2002-01-03 07:51:02 +03:00
|
|
|
PRBool Equals(nsIAtom *aNameAtom) const
|
|
|
|
{
|
|
|
|
return mInner.mName == aNameAtom;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) const
|
|
|
|
{
|
|
|
|
return (mInner.mName == aNameAtom) && (mInner.mPrefix == aPrefixAtom);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) const
|
|
|
|
{
|
|
|
|
return ((mInner.mName == aNameAtom) &&
|
|
|
|
(mInner.mNamespaceID == aNamespaceID));
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
|
|
|
|
PRInt32 aNamespaceID) const
|
|
|
|
{
|
|
|
|
return ((mInner.mName == aNameAtom) &&
|
|
|
|
(mInner.mPrefix == aPrefixAtom) &&
|
|
|
|
(mInner.mNamespaceID == aNamespaceID));
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool NamespaceEquals(PRInt32 aNamespaceID) const
|
|
|
|
{
|
|
|
|
return mInner.mNamespaceID == aNamespaceID;
|
|
|
|
}
|
|
|
|
|
2003-11-15 08:27:37 +03:00
|
|
|
virtual PRBool Equals(const nsAString& aName) const = 0;
|
|
|
|
virtual PRBool Equals(const nsAString& aName,
|
|
|
|
const nsAString& aPrefix) const = 0;
|
|
|
|
virtual PRBool Equals(const nsAString& aName,
|
|
|
|
PRInt32 aNamespaceID) const = 0;
|
|
|
|
virtual PRBool Equals(const nsAString& aName, const nsAString& aPrefix,
|
|
|
|
PRInt32 aNamespaceID) const = 0;
|
|
|
|
virtual PRBool NamespaceEquals(const nsAString& aNamespaceURI) const = 0;
|
2003-03-25 21:55:59 +03:00
|
|
|
// switch to UTF8 - this allows faster access for consumers
|
2003-11-15 08:27:37 +03:00
|
|
|
virtual PRBool QualifiedNameEquals(const nsACString& aQualifiedName) const = 0;
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is a convinience method that creates a new nsINodeInfo that differs
|
|
|
|
* only by name from the one this is called on.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsresult NameChanged(nsIAtom *aName, nsINodeInfo** aResult)
|
|
|
|
{
|
|
|
|
return mOwnerManager->GetNodeInfo(aName, mInner.mPrefix,
|
|
|
|
mInner.mNamespaceID, aResult);
|
|
|
|
}
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is a convinience method that creates a new nsINodeInfo that differs
|
|
|
|
* only by prefix from the one this is called on.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsresult PrefixChanged(nsIAtom *aPrefix, nsINodeInfo** aResult)
|
|
|
|
{
|
|
|
|
return mOwnerManager->GetNodeInfo(mInner.mName, aPrefix,
|
|
|
|
mInner.mNamespaceID, aResult);
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Retrieve a pointer to the document that owns this node info.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsIDocument* GetDocument() const
|
|
|
|
{
|
|
|
|
return mOwnerManager->GetDocument();
|
|
|
|
}
|
2002-01-03 07:51:02 +03:00
|
|
|
|
2002-07-31 01:26:32 +04:00
|
|
|
/*
|
|
|
|
* Retrieve a pointer to the principal for the document of this node info.
|
|
|
|
*/
|
2003-11-15 08:27:37 +03:00
|
|
|
nsresult GetDocumentPrincipal(nsIPrincipal** aPrincipal) const
|
|
|
|
{
|
|
|
|
return mOwnerManager->GetDocumentPrincipal(aPrincipal);
|
|
|
|
}
|
2002-07-31 01:26:32 +04:00
|
|
|
|
2002-01-03 07:51:02 +03:00
|
|
|
protected:
|
|
|
|
/*
|
|
|
|
* nsNodeInfoInner is used for two things:
|
|
|
|
*
|
|
|
|
* 1. as a member in nsNodeInfo for holding the name, prefix and
|
|
|
|
* namespace ID
|
|
|
|
* 2. as the hash key in the hash table in nsNodeInfoManager
|
|
|
|
*
|
|
|
|
* nsNodeInfoInner does not do any kind of reference counting,
|
|
|
|
* that's up to the user of this class. Since nsNodeInfoInner is
|
|
|
|
* typically used as a member of nsNodeInfo, the hash table doesn't
|
|
|
|
* need to delete the keys. When the value (nsNodeInfo) is deleted
|
|
|
|
* the key is automatically deleted.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nsNodeInfoInner
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsNodeInfoInner(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID)
|
|
|
|
: mName(aName), mPrefix(aPrefix), mNamespaceID(aNamespaceID)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIAtom* mName;
|
|
|
|
nsIAtom* mPrefix;
|
|
|
|
PRInt32 mNamespaceID;
|
|
|
|
};
|
|
|
|
|
|
|
|
// nsNodeInfoManager needs to pass mInner to the hash table.
|
|
|
|
friend class nsNodeInfoManager;
|
|
|
|
|
|
|
|
nsNodeInfoInner mInner;
|
2000-05-08 18:29:44 +04:00
|
|
|
|
2003-11-15 08:27:37 +03:00
|
|
|
nsCOMPtr<nsIAtom> mIDAttributeAtom;
|
|
|
|
nsINodeInfoManager* mOwnerManager; // Strong reference!
|
2000-05-08 18:29:44 +04:00
|
|
|
};
|
|
|
|
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
|
|
|
NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
|
2000-05-08 18:29:44 +04:00
|
|
|
|
|
|
|
#endif /* nsINodeInfo_h___ */
|