[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling: base.h encryption/impl/EncryptionImpl.cpp signature/impl/KeyIn...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Dec 21 19:34:13 GMT 2011
Author: scantor
Date: Wed Dec 21 19:34:13 2011
New Revision: 944
URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=944&view=rev
Log:
Implement content cloning via macros
Modified:
branches/REL_1/xmltooling/base.h
branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp
branches/REL_1/xmltooling/signature/impl/KeyInfoImpl.cpp
branches/REL_1/xmltooling/soap/impl/SOAPImpl.cpp
Modified: branches/REL_1/xmltooling/base.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/base.h?rev=944&r1=943&r2=944&view=diff
==============================================================================
--- branches/REL_1/xmltooling/base.h (original)
+++ branches/REL_1/xmltooling/base.h Wed Dec 21 19:34:13 2011
@@ -1357,6 +1357,79 @@
}
/**
+ * Implements cloning of a child attribute, for use in copy constructor or
+ * deferred clone methods.
+ *
+ * proper the proper name of the attribute to clone
+ */
+#define IMPL_CLONE_ATTRIB(proper) \
+ set##proper(src.get##proper())
+
+/**
+ * Implements cloning of a child object, for use in copy constructor or
+ * deferred clone methods.
+ *
+ * proper the proper name of the child object to clone
+ */
+#define IMPL_CLONE_XMLOBJECT_CHILD(proper) \
+ if (src.get##proper()) \
+ set##proper(src.get##proper()->clone())
+
+/**
+ * Implements cloning of a typed child object, for use in copy constructor or
+ * deferred clone methods.
+ *
+ * proper the proper name of the child type to clone
+ */
+#define IMPL_CLONE_TYPED_CHILD(proper) \
+ if (src.get##proper()) \
+ set##proper(src.get##proper()->clone##proper())
+
+/**
+ * Implements cloning of an untyped child collection, for use in copy constructor or
+ * deferred clone methods.
+ */
+#define IMPL_CLONE_XMLOBJECT_CHILDREN() \
+ static void (VectorOf(XMLObject)::* XMLObject_push_back)(XMLObject* const&) = &VectorOf(XMLObject)::push_back; \
+ VectorOf(XMLObject) cXMLObject = getUnknownXMLObjects(); \
+ std::for_each( \
+ src.m_UnknownXMLObjects.begin(), src.m_UnknownXMLObjects.end(), \
+ boost::lambda::if_(boost::lambda::_1 != ((XMLObject*)nullptr)) \
+ [boost::lambda::bind(XMLObject_push_back, boost::ref(cXMLObject), boost::lambda::bind(&XMLObject::clone, boost::lambda::_1))] \
+ )
+
+/**
+ * Implements cloning of a child collection, for use in copy constructor or
+ * deferred clone methods.
+ *
+ * proper the proper name of the child type to clone
+ */
+#define IMPL_CLONE_TYPED_CHILDREN(proper) \
+ static void (VectorOf(proper)::* proper##_push_back)(proper* const&) = &VectorOf(proper)::push_back; \
+ VectorOf(proper) c##proper = get##proper##s(); \
+ std::for_each( \
+ src.m_##proper##s.begin(), src.m_##proper##s.end(), \
+ boost::lambda::if_(boost::lambda::_1 != ((proper*)nullptr)) \
+ [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&proper::clone##proper, boost::lambda::_1))] \
+ )
+
+/**
+ * Implements cloning of a child collection in a foreign namespace, for use in copy constructor or
+ * deferred clone methods.
+ *
+ * proper the proper name of the child type to clone
+ * ns the namespace of the child type
+ */
+#define IMPL_CLONE_TYPED_FOREIGN_CHILDREN(proper,ns) \
+ static void (VectorOf(ns::proper)::* proper##_push_back)(ns::proper* const&) = &VectorOf(ns::proper)::push_back; \
+ VectorOf(ns::proper) c##proper = get##proper##s(); \
+ std::for_each( \
+ src.m_##proper##s.begin(), src.m_##proper##s.end(), \
+ boost::lambda::if_(boost::lambda::_1 != ((ns::proper*)nullptr)) \
+ [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&ns::proper::clone##proper, boost::lambda::_1))] \
+ )
+
+/**
* Declares an XMLObject specialization with a simple content model and type,
* handling it as string data.
*
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=944&r1=943&r2=944&view=diff
==============================================================================
--- branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp (original)
+++ branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp Wed Dec 21 19:34:13 2011
@@ -35,6 +35,10 @@
#include "signature/KeyInfo.h"
#include "util/XMLHelper.h"
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/casts.hpp>
+#include <boost/lambda/if.hpp>
+#include <boost/lambda/lambda.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
using namespace xmlencryption;
@@ -86,16 +90,10 @@
EncryptionMethodImpl(const EncryptionMethodImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setAlgorithm(src.getAlgorithm());
- if (src.getKeySize())
- setKeySize(src.getKeySize()->cloneKeySize());
- if (src.getOAEPparams())
[... 727 lines stripped ...]
More information about the commits
mailing list