Got conformance tests compiling and running on Linux

This commit is contained in:
Jez Higgins 2010-12-09 14:04:13 +00:00
parent b22d91ff3e
commit ef878d91a2
4 changed files with 22 additions and 16 deletions

View file

@ -20,13 +20,15 @@ class CDATASection : public Text<stringT, string_adaptorT>
{
typedef Text<stringT, string_adaptorT> TextT;
public:
typedef Node<stringT, string_adaptorT> NodeT;
CDATASection() : Text<stringT, string_adaptorT>() { }
explicit CDATASection(CDATASection_impl<stringT, string_adaptorT>* impl) : Text<stringT, string_adaptorT>(impl) { }
CDATASection(const CDATASection& rhs) : Text<stringT, string_adaptorT>(rhs) { }
explicit CDATASection(const Node<stringT, string_adaptorT>& rhs) : Text<stringT, string_adaptorT>(rhs, 0)
{
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(rhs.getNodeType() != Node_base::CDATA_SECTION_NODE)
//throw std::runtime_error("bad_cast: Cannot convert Node to CDATA section");
throw std::bad_cast();

View file

@ -19,14 +19,16 @@ template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<
class Comment : public CharacterData<stringT, string_adaptorT>
{
public:
typedef Node<stringT, string_adaptorT> NodeT;
Comment() : CharacterData<stringT, string_adaptorT>() { }
explicit Comment(Comment_impl<stringT, string_adaptorT>* impl) : CharacterData<stringT, string_adaptorT>(dynamic_cast<Comment_impl<stringT, string_adaptorT>*>(impl)) { }
Comment(const Comment& rhs) : CharacterData<stringT, string_adaptorT>(rhs) { }
explicit Comment(const Node<stringT, string_adaptorT>& rhs) : CharacterData<stringT, string_adaptorT>(rhs)
{
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(rhs.getNodeType() != Node<stringT, string_adaptorT>::COMMENT_NODE)
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(rhs.getNodeType() != Node_base::COMMENT_NODE)
throw std::bad_cast();
} // Comment
}; // class Comment

View file

@ -21,14 +21,16 @@ template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<
class DocumentFragment : public Node<stringT, string_adaptorT>
{
public:
typedef Node<stringT, string_adaptorT> NodeT;
DocumentFragment() : Node<stringT, string_adaptorT>() { }
explicit DocumentFragment(DocumentFragment_impl<stringT, string_adaptorT>* impl) : Node<stringT, string_adaptorT>(impl) { }
DocumentFragment(const DocumentFragment& rhs) : Node<stringT, string_adaptorT>(rhs) { }
explicit DocumentFragment(const Node<stringT, string_adaptorT>& rhs) : Node<stringT, string_adaptorT>(rhs)
{
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(rhs.getNodeType() != Node<stringT, string_adaptorT>::DOCUMENT_FRAGMENT_NODE)
if(NodeT::impl_ == 0) // null nodes can always be cast
return;
if(rhs.getNodeType() != Node_base::DOCUMENT_FRAGMENT_NODE)
throw std::bad_cast();
}
}; // class DocumentFragment

View file

@ -65,8 +65,8 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
} // setAttributeNode
virtual DOMNode_implT* setNamedItem(DOMNode_implT* newAttr)
{
throwIfReadOnly();
checkNotInUse(newAttr);
NamedNodeMapImplT::throwIfReadOnly();
checkNotInUse(newAttr);
dynamic_cast<AttrImplT*>(newAttr)->setOwnerElement(ownerElement_);
return dynamic_cast<DOMAttr_implT*>(NamedNodeMapImplT::setNamedItem(newAttr));
} // setNamedItem
@ -113,8 +113,8 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
} // setAttributeNodeNS
virtual DOMNode_implT* setNamedItemNS(DOMNode_implT* newAttr)
{
throwIfReadOnly();
checkNotInUse(newAttr);
NamedNodeMapImplT::throwIfReadOnly();
checkNotInUse(newAttr);
dynamic_cast<AttrImplT*>(newAttr)->setOwnerElement(ownerElement_);
return dynamic_cast<DOMAttr_implT*>(NamedNodeMapImplT::setNamedItemNS(newAttr));
} // setNamedItem
@ -193,12 +193,12 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
return 0;
} // getDefaultAttrs
void checkNotInUse(DOMNode_implT* newAttr)
{
void checkNotInUse(DOMNode_implT* newAttr)
{
AttrImplT* attr = dynamic_cast<AttrImplT*>(newAttr);
if(!attr->isOrphaned())
if(!attr->isOrphaned())
throw DOM::DOMException(DOM::DOMException::INUSE_ATTRIBUTE_ERR);
} // checkNotInUse
} // checkNotInUse
ElementImplT* ownerElement_;
}; // class AttrMap