Convert from NULL macro to nullptr.
[shibboleth/cpp-xmltooling.git] / xmltooling / soap / impl / SOAPImpl.cpp
index 57c7fde..4549d90 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2010 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
 /**
  * SOAPImpl.cpp
  * 
- * Implementation classes for SOAP schema
+ * Implementation classes for SOAP 1.1 schema.
  */
 
 #include "internal.h"
@@ -34,6 +34,7 @@
 
 using namespace soap11;
 using namespace xmltooling;
+using namespace xercesc;
 using namespace std;
 using xmlconstants::SOAP11ENV_NS;
 using xmlconstants::SOAP11ENV_PREFIX;
@@ -54,33 +55,33 @@ namespace {
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
-        QName* m_qname;
+        xmltooling::QName* m_qname;
     public:
         virtual ~FaultcodeImpl() {
             delete m_qname;
         }
 
-        FaultcodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
-            : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_qname(NULL) {
+        FaultcodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_qname(nullptr) {
         }
             
         FaultcodeImpl(const FaultcodeImpl& src)
-                : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(NULL) {
+                : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(nullptr) {
             setCode(src.getCode());
         }
         
-        const QName* getCode() const {
+        const xmltooling::QName* getCode() const {
             return m_qname;
         }
         
-        void setCode(const QName* qname) {
+        void setCode(const xmltooling::QName* qname) {
             m_qname=prepareForAssignment(m_qname,qname);
             if (m_qname) {
                 auto_ptr_XMLCh temp(m_qname->toString().c_str());
                 setTextContent(temp.get());
             }
             else
-                setTextContent(NULL);
+                setTextContent(nullptr);
         }
         
         IMPL_XMLOBJECT_CLONE(Faultcode);
@@ -96,7 +97,7 @@ namespace {
     public:
         virtual ~DetailImpl() {}
 
-        DetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+        DetailImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
             : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
         }
             
@@ -134,14 +135,14 @@ namespace {
         public AbstractXMLObjectUnmarshaller
     {
         void init() {
-            m_Faultcode=NULL;
-            m_Faultstring=NULL;
-            m_Faultactor=NULL;
-            m_Detail=NULL;
-            m_children.push_back(NULL);
-            m_children.push_back(NULL);
-            m_children.push_back(NULL);
-            m_children.push_back(NULL);
+            m_Faultcode=nullptr;
+            m_Faultstring=nullptr;
+            m_Faultactor=nullptr;
+            m_Detail=nullptr;
+            m_children.push_back(nullptr);
+            m_children.push_back(nullptr);
+            m_children.push_back(nullptr);
+            m_children.push_back(nullptr);
             m_pos_Faultcode=m_children.begin();
             m_pos_Faultstring=m_pos_Faultcode;
             ++m_pos_Faultstring;
@@ -158,7 +159,7 @@ namespace {
     public:
         virtual ~FaultImpl() {}
 
-        FaultImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+        FaultImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
             init();
         }
@@ -184,10 +185,10 @@ namespace {
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(Faultcode,SOAP11ENV_NS,false);
-            PROC_TYPED_CHILD(Faultstring,SOAP11ENV_NS,false);
-            PROC_TYPED_CHILD(Faultactor,SOAP11ENV_NS,false);
-            PROC_TYPED_CHILD(Detail,SOAP11ENV_NS,false);
+            PROC_TYPED_CHILD(Faultcode,nullptr,false);
+            PROC_TYPED_CHILD(Faultstring,nullptr,false);
+            PROC_TYPED_CHILD(Faultactor,nullptr,false);
+            PROC_TYPED_CHILD(Detail,nullptr,false);
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
     };
@@ -199,17 +200,12 @@ namespace {
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
-        void init() {
-            m_EncodingStyle=NULL;
-        }
     public:
         virtual ~BodyImpl() {
-            XMLString::release(&m_EncodingStyle);
         }
 
-        BodyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+        BodyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
             : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
-            init();
         }
             
         BodyImpl(const BodyImpl& src)
@@ -217,30 +213,16 @@ namespace {
                     AbstractAttributeExtensibleXMLObject(src),
                     AbstractComplexElement(src),
                     AbstractDOMCachingXMLObject(src) {
-            init();
-            setEncodingStyle(src.getEncodingStyle());
             VectorOf(XMLObject) v=getUnknownXMLObjects();
             for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
                 v.push_back((*i)->clone());
         }
         
         IMPL_XMLOBJECT_CLONE(Body);
-        IMPL_STRING_ATTRIB(EncodingStyle);
         IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
 
-        void setAttribute(QName& qualifiedName, const XMLCh* value, bool ID=false) {
-            if (qualifiedName.hasNamespaceURI() && XMLString::equals(qualifiedName.getNamespaceURI(),SOAP11ENV_NS)) {
-                if (XMLString::equals(qualifiedName.getLocalPart(),ENCODINGSTYLE_ATTRIB_NAME)) {
-                    setEncodingStyle(value);
-                    return;
-                }
-            }
-            AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
-        }
-
     protected:
         void marshallAttributes(DOMElement* domElement) const {
-            MARSHALL_STRING_ATTRIB(EncodingStyle,ENCODINGSTYLE,SOAP11ENV_NS);
             marshallExtensionAttributes(domElement);
         }
 
@@ -260,18 +242,12 @@ namespace {
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
-        void init() {
-            m_Actor=NULL;
-            m_MustUnderstand=xmlconstants::XML_BOOL_NULL;
-        }
     public:
         virtual ~HeaderImpl() {
-            XMLString::release(&m_Actor);
         }
 
-        HeaderImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+        HeaderImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
             : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
-            init();
         }
             
         HeaderImpl(const HeaderImpl& src)
@@ -279,37 +255,16 @@ namespace {
                     AbstractAttributeExtensibleXMLObject(src),
                     AbstractComplexElement(src),
                     AbstractDOMCachingXMLObject(src) {
-            init();
-            setActor(src.getActor());
-            MustUnderstand(m_MustUnderstand);
             VectorOf(XMLObject) v=getUnknownXMLObjects();
             for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
                 v.push_back((*i)->clone());
         }
         
         IMPL_XMLOBJECT_CLONE(Header);
-        IMPL_STRING_ATTRIB(Actor);
-        IMPL_BOOLEAN_ATTRIB(MustUnderstand);
         IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
 
-        void setAttribute(QName& qualifiedName, const XMLCh* value, bool ID=false) {
-            if (qualifiedName.hasNamespaceURI() && XMLString::equals(qualifiedName.getNamespaceURI(),SOAP11ENV_NS)) {
-                if (XMLString::equals(qualifiedName.getLocalPart(),MUSTUNDERSTAND_ATTRIB_NAME)) {
-                    setMustUnderstand(value);
-                    return;
-                }
-                else if (XMLString::equals(qualifiedName.getLocalPart(),ACTOR_ATTRIB_NAME)) {
-                    setActor(value);
-                    return;
-                }
-            }
-            AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
-        }
-
     protected:
         void marshallAttributes(DOMElement* domElement) const {
-            MARSHALL_STRING_ATTRIB(Actor,ACTOR,SOAP11ENV_NS);
-            MARSHALL_BOOLEAN_ATTRIB(MustUnderstand,MUSTUNDERSTAND,SOAP11ENV_NS);
             marshallExtensionAttributes(domElement);
         }
 
@@ -330,10 +285,10 @@ namespace {
         public AbstractXMLObjectUnmarshaller
     {
         void init() {
-            m_Header=NULL;
-            m_Body=NULL;
-            m_children.push_back(NULL);
-            m_children.push_back(NULL);
+            m_Header=nullptr;
+            m_Body=nullptr;
+            m_children.push_back(nullptr);
+            m_children.push_back(nullptr);
             m_pos_Header=m_children.begin();
             m_pos_Body=m_pos_Header;
             ++m_pos_Body;
@@ -341,7 +296,7 @@ namespace {
     public:
         virtual ~EnvelopeImpl() {}
 
-        EnvelopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
+        EnvelopeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
             : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
             init();
         }
@@ -411,12 +366,12 @@ const XMLCh Header::TYPE_NAME[] =                       UNICODE_LITERAL_6(H,e,a,
 const XMLCh Header::ACTOR_ATTRIB_NAME[] =               UNICODE_LITERAL_5(a,c,t,o,r);
 const XMLCh Header::MUSTUNDERSTAND_ATTRIB_NAME[] =      UNICODE_LITERAL_14(m,u,s,t,U,n,d,e,r,s,t,a,n,d);
 
-static const XMLCh _CLIENT[] =                          UNICODE_LITERAL_6(C,l,i,e,n,t);\r
-static const XMLCh _SERVER[] =                          UNICODE_LITERAL_6(S,e,r,v,e,r);\r
-static const XMLCh _MUSTUNDERSTAND[] =                  UNICODE_LITERAL_14(M,u,s,t,U,n,d,e,r,s,t,a,n,d);\r
-static const XMLCh _VERSIONMISMATCH[] =                 UNICODE_LITERAL_15(V,e,r,s,i,o,n,M,i,s,m,a,t,c,h);\r
\r
-QName Faultcode::CLIENT(SOAP11ENV_NS,_CLIENT,SOAP11ENV_PREFIX);\r
-QName Faultcode::SERVER(SOAP11ENV_NS,_SERVER,SOAP11ENV_PREFIX);\r
-QName Faultcode::MUSTUNDERSTAND(SOAP11ENV_NS,_MUSTUNDERSTAND,SOAP11ENV_PREFIX);\r
-QName Faultcode::VERSIONMISMATCH(SOAP11ENV_NS,_VERSIONMISMATCH,SOAP11ENV_PREFIX);\r
+static const XMLCh _CLIENT[] =                          UNICODE_LITERAL_6(C,l,i,e,n,t);
+static const XMLCh _SERVER[] =                          UNICODE_LITERAL_6(S,e,r,v,e,r);
+static const XMLCh _MUSTUNDERSTAND[] =                  UNICODE_LITERAL_14(M,u,s,t,U,n,d,e,r,s,t,a,n,d);
+static const XMLCh _VERSIONMISMATCH[] =                 UNICODE_LITERAL_15(V,e,r,s,i,o,n,M,i,s,m,a,t,c,h);
+xmltooling::QName Faultcode::CLIENT(SOAP11ENV_NS,_CLIENT,SOAP11ENV_PREFIX);
+xmltooling::QName Faultcode::SERVER(SOAP11ENV_NS,_SERVER,SOAP11ENV_PREFIX);
+xmltooling::QName Faultcode::MUSTUNDERSTAND(SOAP11ENV_NS,_MUSTUNDERSTAND,SOAP11ENV_PREFIX);
+xmltooling::QName Faultcode::VERSIONMISMATCH(SOAP11ENV_NS,_VERSIONMISMATCH,SOAP11ENV_PREFIX);