Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'NamedNodeMap (./kdelibs/khtml/dom/dom_node.h:46)

class NamedNodeMap
{
public:
    NamedNodeMap();
    NamedNodeMap(const NamedNodeMap &other);

    NamedNodeMap & operator = (const NamedNodeMap &other);

    ~NamedNodeMap();

    /**
     * The number of nodes in the map. The range of valid child node
     * indices is 0 to <code> length-1 </code> inclusive.
     *
     */
    unsigned long length() const;

    /**
     * Retrieves a node specified by name.
     *
     * @param name Name of a node to retrieve.
     *
     * @return A <code> Node </code> (of any type) with the specified
     * name, or <code> null </code> if the specified name did not
     * identify any node in the map.
     *
     */
    Node getNamedItem ( const DOMString &name );

    /**
     * Adds a node using its <code> nodeName </code> attribute.
     *
     *  As the <code> nodeName </code> attribute is used to derive the
     * name which the node must be stored under, multiple nodes of
     * certain types (those that have a "special" string value) cannot
     * be stored as the names would clash. This is seen as preferable
     * to allowing nodes to be aliased.
     *
     * @param arg A node to store in a named node map. The node will
     * later be accessible using the value of the <code> nodeName
     * </code> attribute of the node. If a node with that name is
     * already present in the map, it is replaced by the new one.
     *
     * @return If the new <code> Node </code> replaces an existing
     * node with the same name the previously existing <code> Node
     * </code> is returned, otherwise <code> null </code> is returned.
     *
     * @exception DOMException
     * WRONG_DOCUMENT_ERR: Raised if <code> arg </code> was created
     * from a different document than the one that created the <code>
     * NamedNodeMap </code> .
     *
     *  NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>
     * NamedNodeMap </code> is readonly.
     *
     *  INUSE_ATTRIBUTE_ERR: Raised if <code> arg </code> is an <code>
     * Attr </code> that is already an attribute of another <code>
     * Element </code> object. The DOM user must explicitly clone
     * <code> Attr </code> nodes to re-use them in other elements.
     *
     */
    Node setNamedItem ( const Node &arg );

    /**
     * Removes a node specified by name. If the removed node is an
     * <code> Attr </code> with a default value it is immediately
     * replaced.
     *
     * @param name The name of a node to remove.
     *
     * @return The node removed from the map or <code> null </code> if
     * no node with such a name exists.
     *
     * @exception DOMException
     * NOT_FOUND_ERR: Raised if there is no node named <code> name
     * </code> in the map.
     *
     */
    Node removeNamedItem ( const DOMString &name );

    /**
     * Returns the <code> index </code> th item in the map. If <code>
     * index </code> is greater than or equal to the number of nodes
     * in the map, this returns <code> null </code> .
     *
     * @param index Index into the map.
     *
     * @return The node at the <code> index </code> th position in the
     * <code> NamedNodeMap </code> , or <code> null </code> if that is
     * not a valid index.
     *
     */
    Node item ( unsigned long index );

protected:
    NamedNodeMap( NodeImpl *i);

    NodeImpl *map;

    friend class Node;
};


kdelibs'NamedNodeMap::NamedNodeMap() (./kdelibs/khtml/dom/dom_node.cpp:34)

NamedNodeMap::NamedNodeMap()
{
    map = 0;
}


kdelibs'NamedNodeMap::NamedNodeMap() (./kdelibs/khtml/dom/dom_node.cpp:39)

NamedNodeMap::NamedNodeMap(const NamedNodeMap &other)
{
    map = other.map;
    if(map) map->ref();
}


kdelibs'NamedNodeMap::NamedNodeMap() (./kdelibs/khtml/dom/dom_node.cpp:45)

NamedNodeMap::NamedNodeMap(NodeImpl *i)
{
    map = i;
    if(map) map->ref();
}


kdelibs'NamedNodeMap::~NamedNodeMap() (./kdelibs/khtml/dom/dom_node.cpp:60)

NamedNodeMap::~NamedNodeMap()
{
    if(map) map->deref();
}


kdelibs'NamedNodeMap::getNamedItem() (./kdelibs/khtml/dom/dom_node.cpp:65)

Node NamedNodeMap::getNamedItem( const DOMString &name )
{
    if(map->nodeType() != Node::ELEMENT_NODE)
	return 0;

    return (NodeImpl *)((ElementImpl *)map)->getAttributeNode( name );
}


kdelibs'NamedNodeMap::setNamedItem() (./kdelibs/khtml/dom/dom_node.cpp:73)

Node NamedNodeMap::setNamedItem( const Node &arg )
{
    if(map->nodeType() != Node::ELEMENT_NODE)
	throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);

    if(!arg.impl->isAttributeNode())
	throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);

    // ### check the attribute is not already used somewhere

    return (NodeImpl *)((ElementImpl *)map)->setAttributeNode( (AttrImpl *)arg.impl );
}


kdelibs'NamedNodeMap::removeNamedItem() (./kdelibs/khtml/dom/dom_node.cpp:86)

Node NamedNodeMap::removeNamedItem( const DOMString &name )
{
    if(map->nodeType() != Node::ELEMENT_NODE)
	throw DOMException(DOMException::NOT_FOUND_ERR);

    AttrImpl *n = ((ElementImpl *)map)->getAttributeNode ( name );
    if(!n) throw DOMException(DOMException::NOT_FOUND_ERR);

    return (NodeImpl *)((ElementImpl *)map)->removeAttributeNode( n );
}


kdelibs'NamedNodeMap::item() (./kdelibs/khtml/dom/dom_node.cpp:97)

Node NamedNodeMap::item( unsigned long /*index*/ )
{
    if(map->nodeType() != Node::ELEMENT_NODE)
	return 0;

    // ####
    return 0;
}


kdelibs'NamedNodeMap::length() (./kdelibs/khtml/dom/dom_node.cpp:106)

unsigned long NamedNodeMap::length() const
{
    // ####
    return 0;
}

// ---------------------------------------------------------------------------