Back to index

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

#include <dom.h>

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

List of all members.

Public Member Functions

 NamedNodeMap ()
virtual ~NamedNodeMap ()
NodegetNamedItem (const nsAString &name)
virtual NodesetNamedItem (Node *arg)
virtual NoderemoveNamedItem (const nsAString &name)
void append (Node &newNode)
void append (Node *newNode)
Nodeitem (PRUint32 index)
PRUint32 getLength ()

Protected Attributes

ListItemfirstItem
ListItemlastItem
PRUint32 length

Private Member Functions

NodeListDefinition::ListItemfindListItemByName (const nsAString &name)

Friends

class txXPathTreeWalker

Detailed Description

Definition at line 195 of file dom.h.


Constructor & Destructor Documentation

Definition at line 46 of file NamedNodeMap.cpp.

{
}

Definition at line 50 of file NamedNodeMap.cpp.

{
}

Member Function Documentation

void NodeListDefinition::append ( Node newNode) [inherited]

Definition at line 86 of file NodeListDefinition.cpp.

{
  ListItem* newListItem = new ListItem;
  if (!newListItem)
      return;

  // Setup the new list item
  newListItem->node = &newNode;
  newListItem->prev = lastItem;
  newListItem->next = nsnull;

  //Append the list item
  if (lastItem)
    lastItem->next = newListItem;

  lastItem = newListItem;

  //Adjust firstItem if this new item is being added to an empty list
  if (!firstItem)
    firstItem = lastItem;

  //Need to increment the length of the list.  Inherited from NodeList
  length++;
}

Here is the caller graph for this function:

void NodeListDefinition::append ( Node newNode) [inherited]

Definition at line 81 of file NodeListDefinition.cpp.

{
  append(*newNode);
}

Here is the call graph for this function:

Definition at line 113 of file NamedNodeMap.cpp.

{
  NodeListDefinition::ListItem* pSearchItem = firstItem;

  while (pSearchItem)
    {
      nsAutoString nodeName;
      pSearchItem->node->getNodeName(nodeName);
      if (name.Equals(nodeName))
        return pSearchItem;

      pSearchItem = pSearchItem->next;
    }

  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRUint32 NodeListDefinition::getLength ( ) [virtual, inherited]

Implements NodeList.

Definition at line 133 of file NodeListDefinition.cpp.

{
  return length;
}

Here is the caller graph for this function:

Node * NamedNodeMap::getNamedItem ( const nsAString &  name)

Definition at line 54 of file NamedNodeMap.cpp.

{
  ListItem* pSearchItem = findListItemByName(name);

  if (pSearchItem)
    return pSearchItem->node;
  else
    return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Node * NodeListDefinition::item ( PRUint32  index) [virtual, inherited]

Implements NodeList.

Definition at line 114 of file NodeListDefinition.cpp.

{
  PRUint32 selectLoop;
  ListItem* pListItem = firstItem;

  if (index < length)
    {
      for (selectLoop=0;selectLoop<index;selectLoop++)
        pListItem = pListItem->next;

      return pListItem->node;
    }

  return nsnull;
}

Here is the caller graph for this function:

Node * NamedNodeMap::removeNamedItem ( const nsAString &  name) [virtual]

Reimplemented in AttrMap.

Definition at line 79 of file NamedNodeMap.cpp.

{
  NodeListDefinition::ListItem* pSearchItem;
  Node* returnNode;

  pSearchItem = findListItemByName(name);

  if (pSearchItem)
    {
      if (pSearchItem != firstItem)
        pSearchItem->prev->next = pSearchItem->next;
      else
        firstItem = pSearchItem->next;

      if (pSearchItem != lastItem)
        pSearchItem->next->prev = pSearchItem->prev;
      else
        lastItem = pSearchItem->prev;

      pSearchItem->next = nsnull;
      pSearchItem->prev = nsnull;

      length--;
      returnNode = pSearchItem->node;
      delete pSearchItem;

      return returnNode;
    }


  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Node * NamedNodeMap::setNamedItem ( Node arg) [virtual]

Reimplemented in AttrMap.

Definition at line 64 of file NamedNodeMap.cpp.

{
  //Since the DOM does not specify any ording for the NamedNodeMap, just
  //try and remove the new node (arg).  If successful, return a pointer to
  //the removed item.  Reguardless of wheter the node already existed or not,
  //insert the new node at the end of the list.
  nsAutoString nodeName;
  arg->getNodeName(nodeName);
  Node* pReplacedNode = removeNamedItem(nodeName);

  NodeListDefinition::append(arg);

  return pReplacedNode;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class txXPathTreeWalker [friend]

Reimplemented from NodeListDefinition.

Definition at line 208 of file dom.h.


Member Data Documentation

ListItem* NodeListDefinition::firstItem [protected, inherited]

Definition at line 186 of file dom.h.

ListItem* NodeListDefinition::lastItem [protected, inherited]

Definition at line 187 of file dom.h.

PRUint32 NodeList::length [protected, inherited]

Definition at line 154 of file dom.h.


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