Adding more utility functions to nsINodeInfo.

This commit is contained in:
jst%netscape.com 2000-05-14 18:34:35 +00:00
Родитель ab76ca26bb
Коммит 4b767ec567
6 изменённых файлов: 174 добавлений и 0 удалений

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

@ -154,11 +154,18 @@ public:
* namespace ID.
*/
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName,
const nsString& aPrefix) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix,
PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI) = 0;
/*
* This is a convinience method that creates a new nsINodeInfo that differs

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

@ -212,6 +212,18 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name;
mInner.mName->GetUnicode(&name);
return aName.Equals(name);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom)
{
@ -219,6 +231,21 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name, *prefix = nsnull;
mInner.mName->GetUnicode(&name);
if (mInner.mPrefix)
mInner.mPrefix->GetUnicode(&prefix);
return aName.Equals(name) && aPrefix.Equals(prefix);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID)
{
@ -226,6 +253,18 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, PRInt32 aNamespaceID)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name;
mInner.mName->GetUnicode(&name);
return aName.Equals(name) && (mInner.mNamespaceID == aNamespaceID);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID)
@ -236,6 +275,23 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix,
PRInt32 aNamespaceID)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name, *prefix = nsnull;
mInner.mName->GetUnicode(&name);
if (mInner.mPrefix)
mInner.mPrefix->GetUnicode(&prefix);
return aName.Equals(name) && aPrefix.Equals(prefix) &&
(mInner.mNamespaceID == aNamespaceID);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID)
{
@ -243,6 +299,22 @@ nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::NamespaceEquals(const nsString& aNamespaceURI)
{
NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsINameSpaceManager> nsmgr;
NS_ENSURE_SUCCESS(mOwnerManager->GetNamespaceManager(*getter_AddRefs(nsmgr)),
NS_ERROR_NOT_INITIALIZED);
PRInt32 nsid;
nsmgr->GetNameSpaceID(aNamespaceURI, nsid);
return mInner.mNamespaceID == nsid;
}
NS_IMETHODIMP
nsNodeInfo::NameChanged(nsIAtom *aName, nsINodeInfo*& aResult)
{

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

@ -75,11 +75,19 @@ public:
NS_IMETHOD GetNamespaceID(PRInt32& aResult);
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom);
NS_IMETHOD_(PRBool) Equals(const nsString& aName);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom);
NS_IMETHOD_(PRBool) Equals(const nsString& aName,
const nsString& aPrefix);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix,
PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI);
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult);
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult);

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

@ -154,11 +154,18 @@ public:
* namespace ID.
*/
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName,
const nsString& aPrefix) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix,
PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI) = 0;
/*
* This is a convinience method that creates a new nsINodeInfo that differs

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

@ -212,6 +212,18 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name;
mInner.mName->GetUnicode(&name);
return aName.Equals(name);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom)
{
@ -219,6 +231,21 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name, *prefix = nsnull;
mInner.mName->GetUnicode(&name);
if (mInner.mPrefix)
mInner.mPrefix->GetUnicode(&prefix);
return aName.Equals(name) && aPrefix.Equals(prefix);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID)
{
@ -226,6 +253,18 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, PRInt32 aNamespaceID)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name;
mInner.mName->GetUnicode(&name);
return aName.Equals(name) && (mInner.mNamespaceID == aNamespaceID);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID)
@ -236,6 +275,23 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix,
PRInt32 aNamespaceID)
{
if (!mInner.mName) return PR_FALSE;
const PRUnichar *name, *prefix = nsnull;
mInner.mName->GetUnicode(&name);
if (mInner.mPrefix)
mInner.mPrefix->GetUnicode(&prefix);
return aName.Equals(name) && aPrefix.Equals(prefix) &&
(mInner.mNamespaceID == aNamespaceID);
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID)
{
@ -243,6 +299,22 @@ nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID)
}
NS_IMETHODIMP_(PRBool)
nsNodeInfo::NamespaceEquals(const nsString& aNamespaceURI)
{
NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsINameSpaceManager> nsmgr;
NS_ENSURE_SUCCESS(mOwnerManager->GetNamespaceManager(*getter_AddRefs(nsmgr)),
NS_ERROR_NOT_INITIALIZED);
PRInt32 nsid;
nsmgr->GetNameSpaceID(aNamespaceURI, nsid);
return mInner.mNamespaceID == nsid;
}
NS_IMETHODIMP
nsNodeInfo::NameChanged(nsIAtom *aName, nsINodeInfo*& aResult)
{

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

@ -75,11 +75,19 @@ public:
NS_IMETHOD GetNamespaceID(PRInt32& aResult);
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom);
NS_IMETHOD_(PRBool) Equals(const nsString& aName);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom);
NS_IMETHOD_(PRBool) Equals(const nsString& aName,
const nsString& aPrefix);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix,
PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI);
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult);
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult);