#ifndef NamedNodeMap_h
#define NamedNodeMap_h
#include "bindings/v8/ScriptWrappable.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/AtomicString.h"
namespace WebCore {
class Node;
class Element;
class ExceptionState;
class NamedNodeMap : public ScriptWrappable {
WTF_MAKE_FAST_ALLOCATED;
friend class Element;
public:
static PassOwnPtr<NamedNodeMap> create(Element* element)
{
return adoptPtr(new NamedNodeMap(element));
}
void ref();
void deref();
PassRefPtr<Node> getNamedItem(const AtomicString&) const;
PassRefPtr<Node> removeNamedItem(const AtomicString& name, ExceptionState&);
PassRefPtr<Node> getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
PassRefPtr<Node> removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState&);
PassRefPtr<Node> setNamedItem(Node*, ExceptionState&);
PassRefPtr<Node> setNamedItemNS(Node*, ExceptionState&);
PassRefPtr<Node> item(unsigned index) const;
size_t length() const;
Element* element() const { return m_element; }
private:
explicit NamedNodeMap(Element* element)
: m_element(element)
{
ASSERT(m_element);
ScriptWrappable::init(this);
}
Element* m_element;
};
}
#endif