X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fio%2FAbstractXMLObjectMarshaller.h;h=cbab2fed2a3d3a7b73e307ba8fd7a0bcf05d2283;hb=77769b2e300d1295b8a5d717d9ede50e27d70cea;hp=e93a4b33a5d3e7385c08a00df18c4d4507c6c4e0;hpb=60f3be64ed06c66d430173ad1514c148cd35610f;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/io/AbstractXMLObjectMarshaller.h b/xmltooling/io/AbstractXMLObjectMarshaller.h index e93a4b3..cbab2fe 100644 --- a/xmltooling/io/AbstractXMLObjectMarshaller.h +++ b/xmltooling/io/AbstractXMLObjectMarshaller.h @@ -23,39 +23,39 @@ #if !defined(__xmltooling_xmlmarshaller_h__) #define __xmltooling_xmlmarshaller_h__ -#include +#include + +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4250 4251 ) +#endif namespace xmltooling { /** * A thread-safe abstract marshaller. */ - class XMLTOOL_API AbstractXMLObjectMarshaller : public virtual Marshaller + class XMLTOOL_API AbstractXMLObjectMarshaller : public virtual AbstractXMLObject { public: virtual ~AbstractXMLObjectMarshaller() {} - /** - * @see Marshaller::marshall(XMLObject*,DOMDocument*) - */ - DOMElement* marshall(XMLObject* xmlObject, DOMDocument* document=NULL) const; + DOMElement* marshall( + DOMDocument* document=NULL +#ifndef XMLTOOLING_NO_XMLSEC + ,const std::vector* sigs=NULL +#endif + ) const; - /** - * @see Marshaller::marshall(XMLObject*,DOMElement*) - */ - DOMElement* marshall(XMLObject* xmlObject, DOMElement* parentElement) const; - + DOMElement* marshall( + DOMElement* parentElement +#ifndef XMLTOOLING_NO_XMLSEC + ,const std::vector* sigs=NULL +#endif + ) const; protected: - /** - * Constructor. - * - * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this - * marshaller operates on - * @param targetLocalName the local name of either the schema type QName or element QName of the elements this - * marshaller operates on - */ - AbstractXMLObjectMarshaller(const XMLCh* targetNamespaceURI, const XMLCh* targetLocalName); + AbstractXMLObjectMarshaller() {} /** * Sets the given element as the Document Element of the given Document. @@ -67,75 +67,68 @@ namespace xmltooling { void setDocumentElement(DOMDocument* document, DOMElement* element) const { DOMElement* documentRoot = document->getDocumentElement(); if (documentRoot) - document->replaceChild(documentRoot, element); + document->replaceChild(element, documentRoot); else document->appendChild(element); } /** - * Marshalls the given XMLObject into the given DOM Element. + * Marshalls the XMLObject into the given DOM Element. * The DOM Element must be within a DOM tree rooted in the owning Document. * - * @param xmlObject the XMLObject to marshall * @param targetElement the Element into which the XMLObject is marshalled into + * @param ctx optional marshalling context + * * @throws MarshallingException thrown if there is a problem marshalling the object + * @throws SignatureException thrown if a problem occurs during signature creation */ - void marshallInto(XMLObject* xmlObject, DOMElement* targetElement) const; + void marshallInto( + DOMElement* targetElement +#ifndef XMLTOOLING_NO_XMLSEC + ,const std::vector* sigs +#endif + ) const; /** * Creates an xsi:type attribute, corresponding to the given type of the XMLObject, on the DOM element. * - * @param xmlObject the XMLObject * @param domElement the DOM element * * @throws MarshallingException thrown if the type on the XMLObject is doesn't contain * a local name, prefix, and namespace URI */ - void marshallElementType(XMLObject* xmlObject, DOMElement* domElement) const; + void marshallElementType(DOMElement* domElement) const; /** - * Creates the xmlns attributes for any namespaces set on the given XMLObject. + * Creates the xmlns attributes for any namespaces set on the XMLObject. * - * @param xmlObject the XMLObject * @param domElement the DOM element the namespaces will be added to */ - void marshallNamespaces(const XMLObject* xmlObject, DOMElement* domElement) const; + void marshallNamespaces(DOMElement* domElement) const; /** - * Marshalls the child elements of the given XMLObject. + * Marshalls the text content and/or child elements of the XMLObject. * - * @param xmlObject the XMLObject whose children will be marshalled * @param domElement the DOM element that will recieved the marshalled children * * @throws MarshallingException thrown if there is a problem marshalling a child element */ - void marshallChildElements(const XMLObject* xmlObject, DOMElement* domElement) const; + void marshallContent(DOMElement* domElement) const; /** - * Marshalls the attributes from the given XMLObject into the given DOM element. - * The XMLObject passed to this method is guaranteed to be of the target name - * specified during this marshaller's construction. + * Marshalls the attributes from the XMLObject into the given DOM element. * - * @param xmlObject the XMLObject being marshalled * @param domElement the DOM Element into which attributes will be marshalled * - * @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute - */ - virtual void marshallAttributes(const XMLObject* xmlObject, DOMElement* domElement) const=0; - - /** - * Marshalls data from the XMLObject into content of the DOM Element. - * - * @param xmlObject the XMLObject - * @param domElement the DOM element recieving the content + * @throws MarshallingException thrown if there is a problem marshalling an attribute */ - virtual void marshallElementContent(const XMLObject* xmlObject, DOMElement* domElement) const=0; - - void* m_log; - private: - QName m_targetQName; + virtual void marshallAttributes(DOMElement* domElement) const {} }; }; +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + #endif /* __xmltooling_xmlmarshaller_h__ */