Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | Friends
nsNodeInfo Class Reference

#include <nsNodeInfo.h>

Inheritance diagram for nsNodeInfo:
Inheritance graph
[legend]
Collaboration diagram for nsNodeInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual NS_DECL_ISUPPORTS void GetQualifiedName (nsAString &aQualifiedName) const
virtual void GetLocalName (nsAString &aLocalName) const
virtual nsresult GetNamespaceURI (nsAString &aNameSpaceURI) const
virtual PRBool Equals (const nsAString &aName) const
virtual PRBool Equals (const nsAString &aName, const nsAString &aPrefix) const
virtual PRBool Equals (const nsAString &aName, PRInt32 aNamespaceID) const
virtual PRBool Equals (const nsAString &aName, const nsAString &aPrefix, PRInt32 aNamespaceID) const
virtual PRBool NamespaceEquals (const nsAString &aNamespaceURI) const
virtual PRBool QualifiedNameEquals (const nsACString &aQualifiedName) const
nsIDocumentGetDocument () const
nsIPrincipalGetDocumentPrincipal () const
nsresult Init (nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, nsNodeInfoManager *aOwnerManager)
void GetName (nsAString &aName) const
nsIAtomNameAtom () const
void GetPrefix (nsAString &aPrefix) const
nsIAtomGetPrefixAtom () const
PRInt32 NamespaceID () const
nsIAtomGetIDAttributeAtom () const
void SetIDAttributeAtom (nsIAtom *aID)
nsNodeInfoManagerNodeInfoManager () const
 Get the owning node info manager.
PRBool Equals (nsINodeInfo *aNodeInfo) const
PRBool Equals (nsIAtom *aNameAtom) const
PRBool Equals (nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) const
PRBool Equals (nsIAtom *aNameAtom, PRInt32 aNamespaceID) const
PRBool Equals (nsIAtom *aNameAtom, nsIAtom *aPrefixAtom, PRInt32 aNamespaceID) const
PRBool NameAndNamespaceEquals (nsINodeInfo *aNodeInfo) const
PRBool NamespaceEquals (PRInt32 aNamespaceID) const

Static Public Member Functions

static nsNodeInfoCreate ()
static void ClearCache ()
 Call before shutdown to clear the cache and free memory for this class.

Protected Member Functions

virtual ~nsNodeInfo ()

Protected Attributes

nsNodeInfoInner mInner
nsCOMPtr< nsIAtommIDAttributeAtom
nsNodeInfoManagermOwnerManager

Private Member Functions

 nsNodeInfo ()
void Clear ()
void LastRelease ()
 This method gets called by Release() when it's time to delete this object, instead of always deleting the object we'll put the object in the cache unless the cache is already full.

Static Private Attributes

static nsNodeInfosCachedNodeInfo = nsnull

Friends

class nsNodeInfoManager

Detailed Description

Definition at line 47 of file nsNodeInfo.h.


Constructor & Destructor Documentation

nsNodeInfo::nsNodeInfo ( ) [private]

Definition at line 65 of file nsNodeInfo.cpp.

{
}

Here is the caller graph for this function:

nsNodeInfo::~nsNodeInfo ( ) [protected, virtual]

Definition at line 70 of file nsNodeInfo.cpp.

{
  Clear();
}

Here is the call graph for this function:


Member Function Documentation

void nsNodeInfo::Clear ( ) [private]

Definition at line 76 of file nsNodeInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Call before shutdown to clear the cache and free memory for this class.

Definition at line 269 of file nsNodeInfo.cpp.

{
  // Clear our cache.
  delete sCachedNodeInfo;
  sCachedNodeInfo = nsnull;
}

Here is the caller graph for this function:

Definition at line 51 of file nsNodeInfo.cpp.

{
  if (sCachedNodeInfo) {
    // We have cached unused instances of this class, return a cached
    // instance instead of always creating a new one.
    nsNodeInfo *nodeInfo = sCachedNodeInfo;
    sCachedNodeInfo = nsnull;
    return nodeInfo;
  }

  // Create a new one
  return new nsNodeInfo();
}

Here is the call graph for this function:

PRBool nsNodeInfo::Equals ( const nsAString &  aName) const [virtual]

Implements nsINodeInfo.

Definition at line 170 of file nsNodeInfo.cpp.

{
  return mInner.mName->Equals(aName);
}

Here is the call graph for this function:

PRBool nsNodeInfo::Equals ( const nsAString &  aName,
const nsAString &  aPrefix 
) const [virtual]

Implements nsINodeInfo.

Definition at line 177 of file nsNodeInfo.cpp.

{
  if (!mInner.mName->Equals(aName)) {
    return PR_FALSE;
  }

  if (!mInner.mPrefix) {
    return aPrefix.IsEmpty();
  }

  return mInner.mPrefix->Equals(aPrefix);
}

Here is the call graph for this function:

PRBool nsNodeInfo::Equals ( const nsAString &  aName,
PRInt32  aNamespaceID 
) const [virtual]

Implements nsINodeInfo.

Definition at line 192 of file nsNodeInfo.cpp.

{
  return mInner.mNamespaceID == aNamespaceID &&
    mInner.mName->Equals(aName);
}

Here is the call graph for this function:

PRBool nsNodeInfo::Equals ( const nsAString &  aName,
const nsAString &  aPrefix,
PRInt32  aNamespaceID 
) const [virtual]

Implements nsINodeInfo.

Definition at line 200 of file nsNodeInfo.cpp.

{
  if (!mInner.mNamespaceID == aNamespaceID ||
      !mInner.mName->Equals(aName))
    return PR_FALSE;

  return mInner.mPrefix ? mInner.mPrefix->Equals(aPrefix) :
    aPrefix.IsEmpty();
}

Here is the call graph for this function:

PRBool nsINodeInfo::Equals ( nsINodeInfo aNodeInfo) const [inline, inherited]

Definition at line 212 of file nsINodeInfo.h.

  {
    return aNodeInfo == this || aNodeInfo->Equals(mInner.mName, mInner.mPrefix,
                                                  mInner.mNamespaceID);
  }

Here is the call graph for this function:

PRBool nsINodeInfo::Equals ( nsIAtom aNameAtom) const [inline, inherited]

Definition at line 224 of file nsINodeInfo.h.

  {
    return mInner.mName == aNameAtom;
  }
PRBool nsINodeInfo::Equals ( nsIAtom aNameAtom,
nsIAtom aPrefixAtom 
) const [inline, inherited]

Definition at line 229 of file nsINodeInfo.h.

  {
    return (mInner.mName == aNameAtom) && (mInner.mPrefix == aPrefixAtom);
  }
PRBool nsINodeInfo::Equals ( nsIAtom aNameAtom,
PRInt32  aNamespaceID 
) const [inline, inherited]

Definition at line 234 of file nsINodeInfo.h.

  {
    return ((mInner.mName == aNameAtom) &&
            (mInner.mNamespaceID == aNamespaceID));
  }
PRBool nsINodeInfo::Equals ( nsIAtom aNameAtom,
nsIAtom aPrefixAtom,
PRInt32  aNamespaceID 
) const [inline, inherited]

Definition at line 240 of file nsINodeInfo.h.

  {
    return ((mInner.mName == aNameAtom) &&
            (mInner.mPrefix == aPrefixAtom) &&
            (mInner.mNamespaceID == aNamespaceID));
  }
nsIDocument* nsNodeInfo::GetDocument ( ) const [inline, virtual]

Implements nsINodeInfo.

Definition at line 65 of file nsNodeInfo.h.

  {
    return mOwnerManager->GetDocument();
  }

Here is the call graph for this function:

nsIPrincipal* nsNodeInfo::GetDocumentPrincipal ( ) const [inline, virtual]

Implements nsINodeInfo.

Definition at line 70 of file nsNodeInfo.h.

Here is the call graph for this function:

nsIAtom* nsINodeInfo::GetIDAttributeAtom ( ) const [inline, inherited]

Definition at line 188 of file nsINodeInfo.h.

  {
    return mIDAttributeAtom;
  }
void nsNodeInfo::GetLocalName ( nsAString &  aLocalName) const [virtual]

Implements nsINodeInfo.

Definition at line 139 of file nsNodeInfo.cpp.

{
#ifdef STRICT_DOM_LEVEL2_LOCALNAME
  if (mInner.mNamespaceID > 0) {
    mInner.mName->ToString(aLocalName);
  } else {
    SetDOMStringToNull(aLocalName);
  }
#else
  mInner.mName->ToString(aLocalName);
#endif
}

Here is the call graph for this function:

void nsINodeInfo::GetName ( nsAString &  aName) const [inline, inherited]

Definition at line 93 of file nsINodeInfo.h.

  {
    mInner.mName->ToString(aName);
  }

Here is the caller graph for this function:

nsresult nsNodeInfo::GetNamespaceURI ( nsAString &  aNameSpaceURI) const [virtual]

Implements nsINodeInfo.

Definition at line 154 of file nsNodeInfo.cpp.

{
  nsresult rv = NS_OK;

  if (mInner.mNamespaceID > 0) {
    rv = nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceURI(mInner.mNamespaceID,
                                                                aNameSpaceURI);
  } else {
    SetDOMStringToNull(aNameSpaceURI);
  }

  return rv;
}

Here is the call graph for this function:

void nsINodeInfo::GetPrefix ( nsAString &  aPrefix) const [inline, inherited]

Definition at line 136 of file nsINodeInfo.h.

  {
    if (mInner.mPrefix) {
      mInner.mPrefix->ToString(aPrefix);
    } else {
      SetDOMStringToNull(aPrefix);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

nsIAtom* nsINodeInfo::GetPrefixAtom ( ) const [inline, inherited]

Definition at line 151 of file nsINodeInfo.h.

  {
    return mInner.mPrefix;
  }

Here is the caller graph for this function:

void nsNodeInfo::GetQualifiedName ( nsAString &  aQualifiedName) const [virtual]

Implements nsINodeInfo.

Definition at line 121 of file nsNodeInfo.cpp.

{
  if (mInner.mPrefix) {
    mInner.mPrefix->ToString(aQualifiedName);

    aQualifiedName.Append(PRUnichar(':'));
  } else {
    aQualifiedName.Truncate();
  }

  nsAutoString name;
  mInner.mName->ToString(name);

  aQualifiedName.Append(name);
}
nsresult nsNodeInfo::Init ( nsIAtom aName,
nsIAtom aPrefix,
PRInt32  aNamespaceID,
nsNodeInfoManager aOwnerManager 
)

Definition at line 89 of file nsNodeInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

This method gets called by Release() when it's time to delete this object, instead of always deleting the object we'll put the object in the cache unless the cache is already full.

Definition at line 277 of file nsNodeInfo.cpp.

{
  if (sCachedNodeInfo) {
    // No room in cache
    delete this;
    return;
  }

  // There's space in the cache for one instance. Put
  // this instance in the cache instead of deleting it.
  sCachedNodeInfo = this;

  // Clear object so that we have no references to anything external
  Clear();

  // The refcount balancing and destructor re-entrancy protection
  // code in Release() sets mRefCnt to 1 so we have to set it to 0
  // here to prevent leaks
  mRefCnt = 0;
}

Here is the call graph for this function:

PRBool nsINodeInfo::NameAndNamespaceEquals ( nsINodeInfo aNodeInfo) const [inline, inherited]

Definition at line 218 of file nsINodeInfo.h.

  {
    return aNodeInfo == this || aNodeInfo->Equals(mInner.mName,
                                                  mInner.mNamespaceID);
  }

Here is the call graph for this function:

nsIAtom* nsINodeInfo::NameAtom ( ) const [inline, inherited]

Definition at line 105 of file nsINodeInfo.h.

  {
    return mInner.mName;
  }

Here is the caller graph for this function:

PRBool nsNodeInfo::NamespaceEquals ( const nsAString &  aNamespaceURI) const [virtual]

Implements nsINodeInfo.

Definition at line 213 of file nsNodeInfo.cpp.

Here is the call graph for this function:

PRBool nsINodeInfo::NamespaceEquals ( PRInt32  aNamespaceID) const [inline, inherited]

Definition at line 248 of file nsINodeInfo.h.

  {
    return mInner.mNamespaceID == aNamespaceID;
  }

Here is the caller graph for this function:

PRInt32 nsINodeInfo::NamespaceID ( ) const [inline, inherited]

Definition at line 177 of file nsINodeInfo.h.

  {
    return mInner.mNamespaceID;
  }

Here is the caller graph for this function:

nsNodeInfoManager* nsINodeInfo::NodeInfoManager ( ) const [inline, inherited]

Get the owning node info manager.

Only to be used inside Gecko, you can't really do anything with the pointer outside Gecko anyway.

Definition at line 202 of file nsINodeInfo.h.

  {
    return mOwnerManager;
  }

Here is the caller graph for this function:

PRBool nsNodeInfo::QualifiedNameEquals ( const nsACString &  aQualifiedName) const [virtual]

Implements nsINodeInfo.

Definition at line 222 of file nsNodeInfo.cpp.

{
  
  if (!mInner.mPrefix)
    return mInner.mName->EqualsUTF8(aQualifiedName);

  nsACString::const_iterator start;
  aQualifiedName.BeginReading(start);

  nsACString::const_iterator colon(start);

  const char* prefix;
  mInner.mPrefix->GetUTF8String(&prefix);

  PRUint32 len = strlen(prefix);

  if (len >= aQualifiedName.Length()) {
    return PR_FALSE;
  }

  colon.advance(len);

  // If the character at the prefix length index is not a colon,
  // aQualifiedName is not equal to this string.
  if (*colon != ':') {
    return PR_FALSE;
  }

  // Compare the prefix to the string from the start to the colon
  if (!mInner.mPrefix->EqualsUTF8(Substring(start, colon)))
    return PR_FALSE;

  ++colon; // Skip the ':'

  nsACString::const_iterator end;
  aQualifiedName.EndReading(end);

  // Compare the local name to the string between the colon and the
  // end of aQualifiedName
  return mInner.mName->EqualsUTF8(Substring(colon, end));
}

Here is the call graph for this function:

void nsINodeInfo::SetIDAttributeAtom ( nsIAtom aID) [inline, inherited]

Definition at line 193 of file nsINodeInfo.h.

  {
    mIDAttributeAtom = aID;
  }

Friends And Related Function Documentation

friend class nsNodeInfoManager [friend, inherited]

Definition at line 303 of file nsINodeInfo.h.


Member Data Documentation

Definition at line 307 of file nsINodeInfo.h.

nsNodeInfoInner nsINodeInfo::mInner [protected, inherited]

Definition at line 305 of file nsINodeInfo.h.

Definition at line 308 of file nsINodeInfo.h.

Definition at line 103 of file nsNodeInfo.h.


The documentation for this class was generated from the following files: