X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltoolingtest%2FXMLObjectBaseTestCase.h;h=f74e9a5c20da2014e29b289ce629c130fd694c93;hb=f0e42ca0a7bf45d71625a101e68abb77eb38f782;hp=f59c1a36d1b9f19424ce40bb0e5becae31490e58;hpb=aca34e703b1e5d3d8df152e350ad83b339818758;p=shibboleth%2Fxmltooling.git diff --git a/xmltoolingtest/XMLObjectBaseTestCase.h b/xmltoolingtest/XMLObjectBaseTestCase.h index f59c1a3..f74e9a5 100644 --- a/xmltoolingtest/XMLObjectBaseTestCase.h +++ b/xmltoolingtest/XMLObjectBaseTestCase.h @@ -43,8 +43,21 @@ extern string data_path; #pragma warning( disable : 4250 4251 ) #endif -class SimpleXMLObject : public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller +class SimpleXMLObject : public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { +protected: + SimpleXMLObject(const SimpleXMLObject& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), + m_id(XMLString::replicate(src.m_id)), m_value(XMLString::replicate(src.m_value)) { +#ifndef XMLTOOLING_NO_XMLSEC + m_children.push_back(NULL); + m_signature=m_children.begin(); +#endif + VectorOf(SimpleXMLObject) mine=getSimpleXMLObjects(); + for (vector::const_iterator i=src.m_simples.begin(); i!=src.m_simples.end(); i++) { + mine.push_back((*i) ? (*i)->clone() : NULL); + } + } + public: static const XMLCh NAMESPACE[]; static const XMLCh NAMESPACE_PREFIX[]; @@ -66,7 +79,18 @@ public: XMLString::release(&m_id); XMLString::release(&m_value); } - + + SimpleXMLObject* clone() const { + auto_ptr domClone(AbstractDOMCachingXMLObject::clone()); + SimpleXMLObject* ret=dynamic_cast(domClone.get()); + if (ret) { + domClone.release(); + return ret; + } + + return new SimpleXMLObject(*this); + } + const XMLCh* getId() const { return m_id; } void setId(const XMLCh* id) { m_id=prepareForAssignment(m_id,id); } @@ -86,23 +110,8 @@ public: VectorOf(SimpleXMLObject) getSimpleXMLObjects() { return VectorOf(SimpleXMLObject)(this, m_simples, &m_children, m_children.end()); } - - SimpleXMLObject* clone() const { - auto_ptr domClone(AbstractDOMCachingXMLObject::clone()); - SimpleXMLObject* ret=dynamic_cast(domClone.get()); - if (ret) { - domClone.release(); - return ret; - } - - ret=new SimpleXMLObject(); - ret->m_namespaces=m_namespaces; - ret->setId(m_id); - ret->setValue(m_value); - xmltooling::clone(m_children, ret->m_children); - return ret; - } +protected: void marshallAttributes(DOMElement* domElement) const { if(getId()) { domElement->setAttributeNS(NULL, SimpleXMLObject::ID_ATTRIB_NAME, getId());