Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
nsAttrName Class Reference

#include <nsAttrName.h>

List of all members.

Public Member Functions

 nsAttrName (const nsAttrName &aOther)
 nsAttrName (nsIAtom *aAtom)
 nsAttrName (nsINodeInfo *aNodeInfo)
 ~nsAttrName ()
void SetTo (nsINodeInfo *aNodeInfo)
void SetTo (nsIAtom *aAtom)
PRBool IsAtom () const
nsINodeInfoNodeInfo () const
nsIAtomAtom () const
PRBool Equals (const nsAttrName &aOther) const
PRBool Equals (nsIAtom *aAtom) const
PRBool Equals (nsIAtom *aLocalName, PRInt32 aNamespaceID) const
PRInt32 NamespaceID () const
nsIAtomLocalName () const
nsIAtomGetPrefix () const
PRBool QualifiedNameEquals (const nsACString &aName) const
void GetQualifiedName (nsAString &aStr) const
void GetPrefix (nsAString &aStr) const
PRUint32 HashValue () const
PRBool IsSmaller (nsIAtom *aOther) const

Private Member Functions

void AddRefInternalName ()
void ReleaseInternalName ()

Private Attributes

PtrBits mBits

Detailed Description

Definition at line 49 of file nsAttrName.h.


Constructor & Destructor Documentation

nsAttrName::nsAttrName ( const nsAttrName aOther) [inline]

Definition at line 52 of file nsAttrName.h.

    : mBits(aOther.mBits)
  {
    AddRefInternalName();
  }

Here is the call graph for this function:

nsAttrName::nsAttrName ( nsIAtom aAtom) [inline, explicit]

Definition at line 58 of file nsAttrName.h.

    : mBits(NS_REINTERPRET_CAST(PtrBits, aAtom))
  {
    NS_ASSERTION(aAtom, "null atom-name in nsAttrName");
    NS_ADDREF(aAtom);
  }

Here is the call graph for this function:

nsAttrName::nsAttrName ( nsINodeInfo aNodeInfo) [inline, explicit]

Definition at line 65 of file nsAttrName.h.

  {
    NS_ASSERTION(aNodeInfo, "null nodeinfo-name in nsAttrName");
    if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
      mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo->NameAtom());
      NS_ADDREF(aNodeInfo->NameAtom());
    }
    else {
      mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo) |
              NS_ATTRNAME_NODEINFO_BIT;
      NS_ADDREF(aNodeInfo);
    }
  }

Here is the call graph for this function:

Definition at line 79 of file nsAttrName.h.

Here is the call graph for this function:


Member Function Documentation

void nsAttrName::AddRefInternalName ( ) [inline, private]

Definition at line 201 of file nsAttrName.h.

  {
    // Since both nsINodeInfo and nsIAtom inherit nsISupports as its first
    // interface we can safely assume that it's first in the vtable
    nsISupports* name = NS_REINTERPRET_CAST(nsISupports *,
      mBits & ~NS_ATTRNAME_NODEINFO_BIT);

    NS_ADDREF(name);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

nsIAtom* nsAttrName::Atom ( ) const [inline]

Definition at line 120 of file nsAttrName.h.

  {
    NS_ASSERTION(IsAtom(), "getting atom-value of nodeinfo-name");
    return NS_REINTERPRET_CAST(nsIAtom*, mBits);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsAttrName::Equals ( const nsAttrName aOther) const [inline]

Definition at line 126 of file nsAttrName.h.

  {
    return mBits == aOther.mBits;
  }

Here is the caller graph for this function:

PRBool nsAttrName::Equals ( nsIAtom aAtom) const [inline]

Definition at line 132 of file nsAttrName.h.

  {
    return NS_REINTERPRET_CAST(PtrBits, aAtom) == mBits;
  }
PRBool nsAttrName::Equals ( nsIAtom aLocalName,
PRInt32  aNamespaceID 
) const [inline]

Definition at line 137 of file nsAttrName.h.

  {
    if (aNamespaceID == kNameSpaceID_None) {
      return Equals(aLocalName);
    }
    return !IsAtom() && NodeInfo()->Equals(aLocalName, aNamespaceID);
  }

Here is the call graph for this function:

nsIAtom* nsAttrName::GetPrefix ( ) const [inline]

Definition at line 155 of file nsAttrName.h.

  {
    return IsAtom() ? nsnull : NodeInfo()->GetPrefixAtom();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAttrName::GetPrefix ( nsAString &  aStr) const [inline]

Definition at line 176 of file nsAttrName.h.

  {
    if (IsAtom()) {
      SetDOMStringToNull(aStr);
    }
    else {
      NodeInfo()->GetPrefix(aStr);
    }
  }

Here is the call graph for this function:

void nsAttrName::GetQualifiedName ( nsAString &  aStr) const [inline]

Definition at line 166 of file nsAttrName.h.

  {
    if (IsAtom()) {
      Atom()->ToString(aStr);
    }
    else {
      NodeInfo()->GetQualifiedName(aStr);
    }
  }

Here is the call graph for this function:

PRUint32 nsAttrName::HashValue ( ) const [inline]

Definition at line 186 of file nsAttrName.h.

  {
    // mBits and PRUint32 might have different size. This should silence
    // any warnings or compile-errors. This is what the implementation of
    // NS_PTR_TO_INT32 does to take care of the same problem.
    return mBits - 0;
  }

Here is the caller graph for this function:

PRBool nsAttrName::IsAtom ( ) const [inline]

Definition at line 109 of file nsAttrName.h.

  {
    return !(mBits & NS_ATTRNAME_NODEINFO_BIT);
  }

Here is the caller graph for this function:

PRBool nsAttrName::IsSmaller ( nsIAtom aOther) const [inline]

Definition at line 194 of file nsAttrName.h.

  {
    return mBits < NS_REINTERPRET_CAST(PtrBits, aOther);
  }
nsIAtom* nsAttrName::LocalName ( ) const [inline]

Definition at line 150 of file nsAttrName.h.

  {
    return IsAtom() ? Atom() : NodeInfo()->NameAtom();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsAttrName::NamespaceID ( ) const [inline]

Definition at line 145 of file nsAttrName.h.

  {
    return IsAtom() ? kNameSpaceID_None : NodeInfo()->NamespaceID();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

nsINodeInfo* nsAttrName::NodeInfo ( ) const [inline]

Definition at line 114 of file nsAttrName.h.

  {
    NS_ASSERTION(!IsAtom(), "getting nodeinfo-value of atom-name");
    return NS_REINTERPRET_CAST(nsINodeInfo*, mBits & ~NS_ATTRNAME_NODEINFO_BIT);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsAttrName::QualifiedNameEquals ( const nsACString &  aName) const [inline]

Definition at line 160 of file nsAttrName.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAttrName::ReleaseInternalName ( ) [inline, private]

Definition at line 211 of file nsAttrName.h.

  {
    // Since both nsINodeInfo and nsIAtom inherit nsISupports as its first
    // interface we can safely assume that it's first in the vtable
    nsISupports* name = NS_REINTERPRET_CAST(nsISupports *,
      mBits & ~NS_ATTRNAME_NODEINFO_BIT);

    NS_RELEASE(name);
  }

Here is the caller graph for this function:

void nsAttrName::SetTo ( nsINodeInfo aNodeInfo) [inline]

Definition at line 84 of file nsAttrName.h.

  {
    NS_ASSERTION(aNodeInfo, "null nodeinfo-name in nsAttrName");

    ReleaseInternalName();
    if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
      mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo->NameAtom());
      NS_ADDREF(aNodeInfo->NameAtom());
    }
    else {
      mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo) |
              NS_ATTRNAME_NODEINFO_BIT;
      NS_ADDREF(aNodeInfo);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAttrName::SetTo ( nsIAtom aAtom) [inline]

Definition at line 100 of file nsAttrName.h.

  {
    NS_ASSERTION(aAtom, "null atom-name in nsAttrName");

    ReleaseInternalName();
    mBits = NS_REINTERPRET_CAST(PtrBits, aAtom);
    NS_ADDREF(aAtom);
  }

Here is the call graph for this function:


Member Data Documentation

Definition at line 221 of file nsAttrName.h.


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