[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling: base.h encryption/impl/EncryptionImpl.cpp impl/AnyElement.cpp ...

noreply at shibboleth.net noreply at shibboleth.net
Mon Nov 21 21:45:56 GMT 2011


Author: scantor
Date: Mon Nov 21 21:45:56 2011
New Revision: 927

URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=927&view=rev
Log:
https://issues.shibboleth.net/jira/browse/CPPOST-70

Modified:
    branches/REL_1/xmltooling/base.h
    branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp
    branches/REL_1/xmltooling/impl/AnyElement.cpp
    branches/REL_1/xmltooling/impl/AnyElement.h

Modified: branches/REL_1/xmltooling/base.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/base.h?rev=927&r1=926&r2=927&view=diff
==============================================================================
--- branches/REL_1/xmltooling/base.h (original)
+++ branches/REL_1/xmltooling/base.h Mon Nov 21 21:45:56 2011
@@ -1263,7 +1263,7 @@
 /**
  * Implements cloning methods for an XMLObject specialization implementation class.
  *
- * @param cname    the name of the XMLObject specialization
+ * @param cname the name of the XMLObject specialization
  */
 #define IMPL_XMLOBJECT_CLONE(cname) \
     cname* clone##cname() const { \
@@ -1277,6 +1277,79 @@
             return ret; \
         } \
         return new cname##Impl(*this); \
+    }
+
+/**
+ * Implements cloning methods for an XMLObject specialization implementation class
+ * that must override a base class clone method.
+ *
+ * @param cname the name of the XMLObject specialization
+ * @param base  name of base type.
+ */
+#define IMPL_XMLOBJECT_CLONE2(cname,base) \
+    cname* clone##cname() const { \
+        return dynamic_cast<cname*>(clone()); \
+    } \
+    base* clone##base() const { \
+        return dynamic_cast<base*>(clone()); \
+    } \
+    xmltooling::XMLObject* clone() const { \
+        std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
+        cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
+        if (ret) { \
+            domClone.release(); \
+            return ret; \
+        } \
+        return new cname##Impl(*this); \
+    }
+
+/**
+ * Implements cloning methods for an XMLObject specialization implementation class that
+ * needs two stage duplication to avoid invoking virtual methods during construction.
+ *
+ * @param cname the name of the XMLObject specialization
+ */
+#define IMPL_XMLOBJECT_CLONE_EX(cname) \
+    cname* clone##cname() const { \
+        return dynamic_cast<cname*>(clone()); \
+    } \
+    xmltooling::XMLObject* clone() const { \
+        std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
+        cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
+        if (ret) { \
+            domClone.release(); \
+            return ret; \
+        } \
+        std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
+        ret2->_clone(*this); \
+        return ret2.release(); \
+    }
+
+/**
+ * Implements cloning methods for an XMLObject specialization implementation class that
+ * needs two stage duplication to avoid invoking virtual methods during construction,
+ * and must override a base class clone method.
+ *
+ * @param cname the name of the XMLObject specialization
+ * @param base  name of base type
+ */
+#define IMPL_XMLOBJECT_CLONE_EX2(cname,base) \
+    cname* clone##cname() const { \
+        return dynamic_cast<cname*>(clone()); \
+    } \
+    base* clone##base() const { \
+        return dynamic_cast<base*>(clone()); \
+    } \
+    xmltooling::XMLObject* clone() const { \
+        std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
+        cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
+        if (ret) { \
+            domClone.release(); \
+            return ret; \
+        } \
+        std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
+        ret2->_clone(*this); \
+        return ret2.release(); \
     }
 
 /**

Modified: branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp?rev=927&r1=926&r2=927&view=diff
==============================================================================
--- branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp (original)
+++ branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp Mon Nov 21 21:45:56 2011
@@ -380,13 +380,9 @@
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
-        void init() {
+    protected:
+        ReferenceTypeImpl() {
             m_URI=nullptr;
-        }
-        
-    protected:
-        ReferenceTypeImpl() {
-            init();
         }
         
     public:
@@ -396,19 +392,22 @@
 
         ReferenceTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
             : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
-            init();
+            m_URI=nullptr;
         }
             
         ReferenceTypeImpl(const ReferenceTypeImpl& src)

[... 171 lines stripped ...]


More information about the commits mailing list