rejigged overrides

This commit is contained in:
jez 2010-12-27 13:06:18 +00:00
parent 16463bbd83
commit d7b9375eba

View file

@ -34,6 +34,33 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
{ {
} // ~AttrMap } // ~AttrMap
/////////////////////////////////////////////////////
virtual DOMNode_implT* setNamedItem(DOMNode_implT* newAttr)
{
AttrImplT* attr = dynamic_cast<AttrImplT*>(newAttr);
if(alreadyHere(attr))
return attr;
NamedNodeMapImplT::throwIfReadOnly();
checkNotInUse(attr);
attr->setOwnerElement(ownerElement_);
return dynamic_cast<DOMAttr_implT*>(NamedNodeMapImplT::setNamedItem(attr));
} // setNamedItem
virtual DOMNode_implT* removeNamedItem(const stringT& name)
{
DOMNode_implT* n = NamedNodeMapImplT::removeNamedItem(name);
createDefault(name);
return n;
} // removeNamedItem
virtual DOMNode_implT* removeNamedItemNS(const stringT& namespaceURI, const stringT& localName)
{
DOMNode_implT* n = NamedNodeMapImplT::removeNamedItemNS(namespaceURI, localName);
createDefault(namespaceURI, localName);
return n;
} // removedNamedItemNS
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
const stringT& getAttribute(const stringT& name) const const stringT& getAttribute(const stringT& name) const
{ {
@ -50,8 +77,7 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
void removeAttribute(const stringT& name) void removeAttribute(const stringT& name)
{ {
NamedNodeMapImplT::removeNamedItem(name); removeNamedItem(name);
createDefault(name);
} // removeAttribute } // removeAttribute
DOMAttr_implT* getAttributeNode(const stringT& name) const DOMAttr_implT* getAttributeNode(const stringT& name) const
@ -63,22 +89,11 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
{ {
return dynamic_cast<DOMAttr_implT*>(setNamedItem(newAttr)); return dynamic_cast<DOMAttr_implT*>(setNamedItem(newAttr));
} // setAttributeNode } // setAttributeNode
virtual DOMNode_implT* setNamedItem(DOMNode_implT* newAttr)
{
AttrImplT* attr = dynamic_cast<AttrImplT*>(newAttr);
if(alreadyHere(attr))
return attr;
NamedNodeMapImplT::throwIfReadOnly();
checkNotInUse(attr);
attr->setOwnerElement(ownerElement_);
return dynamic_cast<DOMAttr_implT*>(NamedNodeMapImplT::setNamedItem(attr));
} // setNamedItem
DOMAttr_implT* removeAttributeNode(DOMAttr_implT* oldAttr) DOMAttr_implT* removeAttributeNode(DOMAttr_implT* oldAttr)
{ {
if(NamedNodeMapImplT::removeNamedItem(oldAttr->getNodeName()) == 0) if(removeNamedItem(oldAttr->getNodeName()) == 0)
throw DOM::DOMException(DOM::DOMException::NOT_FOUND_ERR); throw DOM::DOMException(DOM::DOMException::NOT_FOUND_ERR);
createDefault(oldAttr->getNodeName());
return oldAttr; return oldAttr;
} // removeAttributeNode } // removeAttributeNode
@ -101,8 +116,7 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
void removeAttributeNS(const stringT& namespaceURI, const stringT& localName) void removeAttributeNS(const stringT& namespaceURI, const stringT& localName)
{ {
NamedNodeMapImplT::removeNamedItemNS(namespaceURI, localName); removeNamedItemNS(namespaceURI, localName);
createDefault(namespaceURI, localName);
} // removeAttributeNS } // removeAttributeNS
DOMAttr_implT* getAttributeNodeNS(const stringT& namespaceURI, const stringT& localName) const DOMAttr_implT* getAttributeNodeNS(const stringT& namespaceURI, const stringT& localName) const
@ -114,6 +128,7 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
{ {
return dynamic_cast<DOMAttr_implT*>(setNamedItemNS(newAttr)); return dynamic_cast<DOMAttr_implT*>(setNamedItemNS(newAttr));
} // setAttributeNodeNS } // setAttributeNodeNS
virtual DOMNode_implT* setNamedItemNS(DOMNode_implT* newAttr) virtual DOMNode_implT* setNamedItemNS(DOMNode_implT* newAttr)
{ {
AttrImplT* attr = dynamic_cast<AttrImplT*>(newAttr); AttrImplT* attr = dynamic_cast<AttrImplT*>(newAttr);