for the entire
// DOM API, or DOM_*.hpp for individual DOM classes, where the class
// name is substituded for the *.
//
/*
* $Id: IDParentNode.hpp,v 1.1.1.1 2002/02/01 22:21:56 peiyongz Exp $
*/
/**
* ParentNode provides the capability of having child
* nodes. Not every node in the DOM can have children, so only nodes that can
* should include this class and pay the price for it.
*
* While we have a direct reference to the first child, the last child is
* stored as the previous sibling of the first child. First child nodes are
* marked as being so, and getNextSibling hides this fact.
*
**/
#include
#include "IDNodeListImpl.hpp"
class IDChildNode;
class IDOM_Document;
class IDOM_Node;
class IDOM_NodeList;
class CDOM_EXPORT IDParentNode {
public:
IDOM_Document *fOwnerDocument; // Document this node belongs to
IDOM_Node *fFirstChild;
IDNodeListImpl fChildNodeList; // for GetChildNodes()
public:
IDParentNode(IDOM_Document *ownerDocument);
IDParentNode(const IDParentNode &other);
IDOM_Document * getOwnerDocument() const;
void setOwnerDocument(IDOM_Document* doc);
// Track changes to the node tree structure under this node. An optimization
// for NodeLists.
int changes() const;
void changed();
IDOM_Node * appendChild(IDOM_Node *newChild);
IDOM_NodeList * getChildNodes() const;
IDOM_Node * getFirstChild() const;
IDOM_Node * getLastChild() const;
unsigned int getLength() const;
bool hasChildNodes() const;
IDOM_Node * insertBefore(IDOM_Node *newChild, IDOM_Node *refChild);
IDOM_Node * item(unsigned int index) const;
IDOM_Node * removeChild(IDOM_Node *oldChild);
IDOM_Node * replaceChild(IDOM_Node *newChild, IDOM_Node *oldChild);
//Introduced in DOM Level 2
void normalize();
// NON-DOM
// unlike getOwnerDocument this never returns null, even for Document nodes
IDOM_Document * getDocument() const;
public:
void cloneChildren(const IDOM_Node *other);
IDOM_Node * lastChild() const;
void lastChild(IDOM_Node *);
};
#endif