}
/**
+ * 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.
*
#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;
EncryptionMethodImpl(const EncryptionMethodImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setAlgorithm(src.getAlgorithm());
- if (src.getKeySize())
- setKeySize(src.getKeySize()->cloneKeySize());
- if (src.getOAEPparams())
- setOAEPparams(src.getOAEPparams()->cloneOAEPparams());
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_ATTRIB(Algorithm);
+ IMPL_CLONE_TYPED_CHILD(KeySize);
+ IMPL_CLONE_TYPED_CHILD(OAEPparams);
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE(EncryptionMethod);
TransformsImpl(const TransformsImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- for (vector<xmlsignature::Transform*>::const_iterator i=src.m_Transforms.begin(); i!=src.m_Transforms.end(); i++) {
- if (*i) {
- getTransforms().push_back((*i)->cloneTransform());
- }
- }
+ IMPL_CLONE_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature);
}
IMPL_XMLOBJECT_CLONE(Transforms);
CipherReferenceImpl(const CipherReferenceImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setURI(src.getURI());
- if (src.getTransforms())
- setTransforms(src.getTransforms()->cloneTransforms());
+ IMPL_CLONE_ATTRIB(URI);
+ IMPL_CLONE_TYPED_CHILD(Transforms);
}
IMPL_XMLOBJECT_CLONE(CipherReference);
CipherDataImpl(const CipherDataImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getCipherValue())
- setCipherValue(src.getCipherValue()->cloneCipherValue());
- if (src.getCipherReference())
- setCipherReference(src.getCipherReference()->cloneCipherReference());
+ IMPL_CLONE_TYPED_CHILD(CipherValue);
+ IMPL_CLONE_TYPED_CHILD(CipherReference);
}
IMPL_XMLOBJECT_CLONE(CipherData);
AbstractComplexElement(src),
AbstractDOMCachingXMLObject(src) {
init();
- setId(src.getId());
- setTarget(src.getTarget());
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_ATTRIB(Id);
+ IMPL_CLONE_ATTRIB(Target);
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE(EncryptionProperty);
EncryptionPropertiesImpl(const EncryptionPropertiesImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setId(src.getId());
- for (vector<EncryptionProperty*>::const_iterator i=src.m_EncryptionPropertys.begin(); i!=src.m_EncryptionPropertys.end(); i++) {
- if (*i) {
- getEncryptionPropertys().push_back((*i)->cloneEncryptionProperty());
- }
- }
+ IMPL_CLONE_ATTRIB(Id);
+ IMPL_CLONE_TYPED_CHILDREN(EncryptionProperty);
}
IMPL_XMLOBJECT_CLONE(EncryptionProperties);
}
void _clone(const ReferenceTypeImpl& src) {
- setURI(src.getURI());
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_ATTRIB(URI);
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE_EX(ReferenceType);
ReferenceListImpl(const ReferenceListImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
- if (*i) {
- DataReference* data=dynamic_cast<DataReference*>(*i);
- if (data) {
- getDataReferences().push_back(data->cloneDataReference());
- continue;
- }
-
- KeyReference* key=dynamic_cast<KeyReference*>(*i);
- if (key) {
- getKeyReferences().push_back(key->cloneKeyReference());
- continue;
- }
+ for (list<XMLObject*>::const_iterator i = src.m_children.begin(); i != src.m_children.end(); ++i) {
+ DataReference* data=dynamic_cast<DataReference*>(*i);
+ if (data) {
+ getDataReferences().push_back(data->cloneDataReference());
+ continue;
+ }
+
+ KeyReference* key=dynamic_cast<KeyReference*>(*i);
+ if (key) {
+ getKeyReferences().push_back(key->cloneKeyReference());
+ continue;
}
}
}
}
void _clone(const EncryptedTypeImpl& src) {
- setId(src.getId());
- setType(src.getType());
- setMimeType(src.getMimeType());
- setEncoding(src.getEncoding());
- if (src.getEncryptionMethod())
- setEncryptionMethod(src.getEncryptionMethod()->cloneEncryptionMethod());
- if (src.getKeyInfo())
- setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
- if (src.getCipherData())
- setCipherData(src.getCipherData()->cloneCipherData());
- if (src.getEncryptionProperties())
- setEncryptionProperties(src.getEncryptionProperties()->cloneEncryptionProperties());
+ IMPL_CLONE_ATTRIB(Id);
+ IMPL_CLONE_ATTRIB(Type);
+ IMPL_CLONE_ATTRIB(MimeType);
+ IMPL_CLONE_ATTRIB(Encoding);
+ IMPL_CLONE_TYPED_CHILD(EncryptionMethod);
+ IMPL_CLONE_TYPED_CHILD(KeyInfo);
+ IMPL_CLONE_TYPED_CHILD(CipherData);
+ IMPL_CLONE_TYPED_CHILD(EncryptionProperties);
}
IMPL_XMLOBJECT_CLONE_EX(EncryptedType);
void _clone(const EncryptedKeyImpl& src) {
EncryptedTypeImpl::_clone(src);
- setRecipient(src.getRecipient());
- if (src.getReferenceList())
- setReferenceList(src.getReferenceList()->cloneReferenceList());
- if (src.getCarriedKeyName())
- setCarriedKeyName(src.getCarriedKeyName()->cloneCarriedKeyName());
+ IMPL_CLONE_ATTRIB(Recipient);
+ IMPL_CLONE_TYPED_CHILD(ReferenceList);
+ IMPL_CLONE_TYPED_CHILD(CarriedKeyName);
}
IMPL_XMLOBJECT_CLONE_EX(EncryptedKey);
#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 xmlsignature;
DSAKeyValueImpl(const DSAKeyValueImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getP())
- setP(src.getP()->cloneP());
- if (src.getQ())
- setQ(src.getQ()->cloneQ());
- if (src.getG())
- setG(src.getG()->cloneG());
- if (src.getY())
- setY(src.getY()->cloneY());
- if (src.getJ())
- setJ(src.getJ()->cloneJ());
- if (src.getSeed())
- setSeed(src.getSeed()->cloneSeed());
- if (src.getPgenCounter())
- setPgenCounter(src.getPgenCounter()->clonePgenCounter());
+ IMPL_CLONE_TYPED_CHILD(P);
+ IMPL_CLONE_TYPED_CHILD(Q);
+ IMPL_CLONE_TYPED_CHILD(G);
+ IMPL_CLONE_TYPED_CHILD(Y);
+ IMPL_CLONE_TYPED_CHILD(J);
+ IMPL_CLONE_TYPED_CHILD(Seed);
+ IMPL_CLONE_TYPED_CHILD(PgenCounter);
}
IMPL_XMLOBJECT_CLONE(DSAKeyValue);
RSAKeyValueImpl(const RSAKeyValueImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getModulus())
- setModulus(src.getModulus()->cloneModulus());
- if (src.getExponent())
- setExponent(src.getExponent()->cloneExponent());
+ IMPL_CLONE_TYPED_CHILD(Modulus);
+ IMPL_CLONE_TYPED_CHILD(Exponent);
}
IMPL_XMLOBJECT_CLONE(RSAKeyValue);
NamedCurveImpl(const NamedCurveImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_URI(nullptr) {
- setURI(src.getURI());
+ IMPL_CLONE_ATTRIB(URI);
}
IMPL_XMLOBJECT_CLONE(NamedCurve);
ECKeyValueImpl(const ECKeyValueImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setId(src.getId());
- if (src.getECParameters())
- setECParameters(src.getECParameters()->clone());
- if (src.getNamedCurve())
- setNamedCurve(src.getNamedCurve()->cloneNamedCurve());
- if (src.getPublicKey())
- setPublicKey(src.getPublicKey()->clonePublicKey());
+ IMPL_CLONE_ATTRIB(Id);
+ IMPL_CLONE_XMLOBJECT_CHILD(ECParameters);
+ IMPL_CLONE_TYPED_CHILD(NamedCurve);
+ IMPL_CLONE_TYPED_CHILD(PublicKey);
}
IMPL_XMLOBJECT_CLONE(ECKeyValue);
KeyValueImpl(const KeyValueImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getDSAKeyValue())
- setDSAKeyValue(src.getDSAKeyValue()->cloneDSAKeyValue());
- if (src.getRSAKeyValue())
- setRSAKeyValue(src.getRSAKeyValue()->cloneRSAKeyValue());
- if (src.getECKeyValue())
- setECKeyValue(src.getECKeyValue()->cloneECKeyValue());
- if (src.getUnknownXMLObject())
- setUnknownXMLObject(src.getUnknownXMLObject()->clone());
+ IMPL_CLONE_TYPED_CHILD(DSAKeyValue);
+ IMPL_CLONE_TYPED_CHILD(RSAKeyValue);
+ IMPL_CLONE_TYPED_CHILD(ECKeyValue);
+ IMPL_CLONE_XMLOBJECT_CHILD(UnknownXMLObject);
}
IMPL_XMLOBJECT_CLONE(KeyValue);
DEREncodedKeyValueImpl(const DEREncodedKeyValueImpl& src)
: AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_Id(nullptr) {
- setId(src.getId());
+ IMPL_CLONE_ATTRIB(Id);
}
IMPL_XMLOBJECT_CLONE(DEREncodedKeyValue);
TransformImpl(const TransformImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Algorithm(nullptr) {
- setAlgorithm(src.getAlgorithm());
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ IMPL_CLONE_ATTRIB(Algorithm);
+ for (list<XMLObject*>::const_iterator i = src.m_children.begin(); i != src.m_children.end(); ++i) {
+ XPath* x=dynamic_cast<XPath*>(*i);
+ if (x) {
+ getXPaths().push_back(x->cloneXPath());
+ continue;
+ }
+
if (*i) {
- XPath* x=dynamic_cast<XPath*>(*i);
- if (x) {
- getXPaths().push_back(x->cloneXPath());
- continue;
- }
-
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
+ getUnknownXMLObjects().push_back((*i)->clone());
}
}
}
TransformsImpl(const TransformsImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- for (vector<Transform*>::const_iterator i=src.m_Transforms.begin(); i!=src.m_Transforms.end(); i++) {
- if (*i) {
- getTransforms().push_back((*i)->cloneTransform());
- }
- }
+ IMPL_CLONE_TYPED_CHILDREN(Transform);
}
IMPL_XMLOBJECT_CLONE(Transforms);
RetrievalMethodImpl(const RetrievalMethodImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setURI(src.getURI());
- setType(src.getType());
- if (src.getTransforms())
- setTransforms(src.getTransforms()->cloneTransforms());
+ IMPL_CLONE_ATTRIB(URI);
+ IMPL_CLONE_ATTRIB(Type);
+ IMPL_CLONE_TYPED_CHILD(Transforms);
}
IMPL_XMLOBJECT_CLONE(RetrievalMethod);
X509IssuerSerialImpl(const X509IssuerSerialImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getX509IssuerName())
- setX509IssuerName(src.getX509IssuerName()->cloneX509IssuerName());
- if (src.getX509SerialNumber())
- setX509SerialNumber(src.getX509SerialNumber()->cloneX509SerialNumber());
+ IMPL_CLONE_TYPED_CHILD(X509IssuerName);
+ IMPL_CLONE_TYPED_CHILD(X509SerialNumber);
}
IMPL_XMLOBJECT_CLONE(X509IssuerSerial);
X509DigestImpl(const X509DigestImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Algorithm(nullptr) {
- setAlgorithm(src.getAlgorithm());
+ IMPL_CLONE_ATTRIB(Algorithm);
}
IMPL_XMLOBJECT_CLONE(X509Digest);
X509DataImpl(const X509DataImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ for (list<XMLObject*>::const_iterator i = src.m_children.begin(); i != src.m_children.end(); ++i) {
+ X509Certificate* xcert=dynamic_cast<X509Certificate*>(*i);
+ if (xcert) {
+ getX509Certificates().push_back(xcert->cloneX509Certificate());
+ continue;
+ }
+
+ X509CRL* xcrl=dynamic_cast<X509CRL*>(*i);
+ if (xcrl) {
+ getX509CRLs().push_back(xcrl->cloneX509CRL());
+ continue;
+ }
+
+ X509SubjectName* xsn=dynamic_cast<X509SubjectName*>(*i);
+ if (xsn) {
+ getX509SubjectNames().push_back(xsn->cloneX509SubjectName());
+ continue;
+ }
+
+ X509IssuerSerial* xis=dynamic_cast<X509IssuerSerial*>(*i);
+ if (xis) {
+ getX509IssuerSerials().push_back(xis->cloneX509IssuerSerial());
+ continue;
+ }
+
+ X509SKI* xski=dynamic_cast<X509SKI*>(*i);
+ if (xski) {
+ getX509SKIs().push_back(xski->cloneX509SKI());
+ continue;
+ }
+
+ X509Digest* xdig=dynamic_cast<X509Digest*>(*i);
+ if (xdig) {
+ getX509Digests().push_back(xdig->cloneX509Digest());
+ continue;
+ }
+
+ OCSPResponse* ocsp=dynamic_cast<OCSPResponse*>(*i);
+ if (ocsp) {
+ getOCSPResponses().push_back(ocsp->cloneOCSPResponse());
+ continue;
+ }
+
if (*i) {
- X509Certificate* xcert=dynamic_cast<X509Certificate*>(*i);
- if (xcert) {
- getX509Certificates().push_back(xcert->cloneX509Certificate());
- continue;
- }
-
- X509CRL* xcrl=dynamic_cast<X509CRL*>(*i);
- if (xcrl) {
- getX509CRLs().push_back(xcrl->cloneX509CRL());
- continue;
- }
-
- X509SubjectName* xsn=dynamic_cast<X509SubjectName*>(*i);
- if (xsn) {
- getX509SubjectNames().push_back(xsn->cloneX509SubjectName());
- continue;
- }
-
- X509IssuerSerial* xis=dynamic_cast<X509IssuerSerial*>(*i);
- if (xis) {
- getX509IssuerSerials().push_back(xis->cloneX509IssuerSerial());
- continue;
- }
-
- X509SKI* xski=dynamic_cast<X509SKI*>(*i);
- if (xski) {
- getX509SKIs().push_back(xski->cloneX509SKI());
- continue;
- }
-
- X509Digest* xdig=dynamic_cast<X509Digest*>(*i);
- if (xdig) {
- getX509Digests().push_back(xdig->cloneX509Digest());
- continue;
- }
-
- OCSPResponse* ocsp=dynamic_cast<OCSPResponse*>(*i);
- if (ocsp) {
- getOCSPResponses().push_back(ocsp->cloneOCSPResponse());
- continue;
- }
-
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
+ getUnknownXMLObjects().push_back((*i)->clone());
}
}
}
SPKIDataImpl(const SPKIDataImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
- for (vector< pair<SPKISexp*,XMLObject*> >::const_iterator i=src.m_SPKISexps.begin(); i!=src.m_SPKISexps.end(); i++) {
+ for (vector< pair<SPKISexp*,XMLObject*> >::const_iterator i = src.m_SPKISexps.begin(); i != src.m_SPKISexps.end(); ++i) {
if (i->first) {
getSPKISexps().push_back(make_pair(i->first->cloneSPKISexp(),(i->second ? i->second->clone() : (XMLObject*)nullptr)));
}
PGPDataImpl(const PGPDataImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getPGPKeyID())
- setPGPKeyID(src.getPGPKeyID()->clonePGPKeyID());
- if (src.getPGPKeyPacket())
- setPGPKeyPacket(src.getPGPKeyPacket()->clonePGPKeyPacket());
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_TYPED_CHILD(PGPKeyID);
+ IMPL_CLONE_TYPED_CHILD(PGPKeyPacket);
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE(PGPData);
KeyInfoReferenceImpl(const KeyInfoReferenceImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- setId(src.getId());
- setURI(src.getURI());
+ IMPL_CLONE_ATTRIB(Id);
+ IMPL_CLONE_ATTRIB(URI);
}
IMPL_XMLOBJECT_CLONE(KeyInfoReference);
KeyInfoImpl(const KeyInfoImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Id(nullptr) {
- setId(src.getId());
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ IMPL_CLONE_ATTRIB(Id);
+ for (list<XMLObject*>::const_iterator i = src.m_children.begin(); i != src.m_children.end(); ++i) {
+ X509Data* xd=dynamic_cast<X509Data*>(*i);
+ if (xd) {
+ getX509Datas().push_back(xd->cloneX509Data());
+ continue;
+ }
+
+ KeyName* kn=dynamic_cast<KeyName*>(*i);
+ if (kn) {
+ getKeyNames().push_back(kn->cloneKeyName());
+ continue;
+ }
+
+ KeyValue* kv=dynamic_cast<KeyValue*>(*i);
+ if (kv) {
+ getKeyValues().push_back(kv->cloneKeyValue());
+ continue;
+ }
+
+ DEREncodedKeyValue* ekv=dynamic_cast<DEREncodedKeyValue*>(*i);
+ if (ekv) {
+ getDEREncodedKeyValues().push_back(ekv->cloneDEREncodedKeyValue());
+ continue;
+ }
+
+ RetrievalMethod* rm=dynamic_cast<RetrievalMethod*>(*i);
+ if (rm) {
+ getRetrievalMethods().push_back(rm->cloneRetrievalMethod());
+ continue;
+ }
+
+ MgmtData* md=dynamic_cast<MgmtData*>(*i);
+ if (md) {
+ getMgmtDatas().push_back(md->cloneMgmtData());
+ continue;
+ }
+
+ SPKIData* sd=dynamic_cast<SPKIData*>(*i);
+ if (sd) {
+ getSPKIDatas().push_back(sd->cloneSPKIData());
+ continue;
+ }
+
+ PGPData* pd=dynamic_cast<PGPData*>(*i);
+ if (pd) {
+ getPGPDatas().push_back(pd->clonePGPData());
+ continue;
+ }
+
+ KeyInfoReference* kref=dynamic_cast<KeyInfoReference*>(*i);
+ if (kref) {
+ getKeyInfoReferences().push_back(kref->cloneKeyInfoReference());
+ continue;
+ }
+
if (*i) {
- X509Data* xd=dynamic_cast<X509Data*>(*i);
- if (xd) {
- getX509Datas().push_back(xd->cloneX509Data());
- continue;
- }
-
- KeyName* kn=dynamic_cast<KeyName*>(*i);
- if (kn) {
- getKeyNames().push_back(kn->cloneKeyName());
- continue;
- }
-
- KeyValue* kv=dynamic_cast<KeyValue*>(*i);
- if (kv) {
- getKeyValues().push_back(kv->cloneKeyValue());
- continue;
- }
-
- DEREncodedKeyValue* ekv=dynamic_cast<DEREncodedKeyValue*>(*i);
- if (ekv) {
- getDEREncodedKeyValues().push_back(ekv->cloneDEREncodedKeyValue());
- continue;
- }
-
- RetrievalMethod* rm=dynamic_cast<RetrievalMethod*>(*i);
- if (rm) {
- getRetrievalMethods().push_back(rm->cloneRetrievalMethod());
- continue;
- }
-
- MgmtData* md=dynamic_cast<MgmtData*>(*i);
- if (md) {
- getMgmtDatas().push_back(md->cloneMgmtData());
- continue;
- }
-
- SPKIData* sd=dynamic_cast<SPKIData*>(*i);
- if (sd) {
- getSPKIDatas().push_back(sd->cloneSPKIData());
- continue;
- }
-
- PGPData* pd=dynamic_cast<PGPData*>(*i);
- if (pd) {
- getPGPDatas().push_back(pd->clonePGPData());
- continue;
- }
-
- KeyInfoReference* kref=dynamic_cast<KeyInfoReference*>(*i);
- if (kref) {
- getKeyInfoReferences().push_back(kref->cloneKeyInfoReference());
- continue;
- }
-
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
+ getUnknownXMLObjects().push_back((*i)->clone());
}
}
}
#include "soap/SOAP.h"
#include "util/XMLHelper.h"
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/if.hpp>
+#include <boost/lambda/lambda.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
using namespace soap11;
FaultcodeImpl(const FaultcodeImpl& src)
: AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_qname(nullptr) {
- setCode(src.getCode());
+ IMPL_CLONE_ATTRIB(Code);
}
const xmltooling::QName* getCode() const {
AbstractAttributeExtensibleXMLObject(src),
AbstractComplexElement(src),
AbstractDOMCachingXMLObject(src) {
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE(Detail);
FaultImpl(const FaultImpl& src)
: AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getFaultcode())
- setFaultcode(src.getFaultcode()->cloneFaultcode());
- if (src.getFaultstring())
- setFaultstring(src.getFaultstring()->cloneFaultstring());
- if (src.getFaultactor())
- setFaultactor(src.getFaultactor()->cloneFaultactor());
- if (src.getDetail())
- setDetail(src.getDetail()->cloneDetail());
+ IMPL_CLONE_TYPED_CHILD(Faultcode);
+ IMPL_CLONE_TYPED_CHILD(Faultstring);
+ IMPL_CLONE_TYPED_CHILD(Faultactor);
+ IMPL_CLONE_TYPED_CHILD(Detail);
}
IMPL_XMLOBJECT_CLONE(Fault);
AbstractAttributeExtensibleXMLObject(src),
AbstractComplexElement(src),
AbstractDOMCachingXMLObject(src) {
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE(Body);
AbstractAttributeExtensibleXMLObject(src),
AbstractComplexElement(src),
AbstractDOMCachingXMLObject(src) {
- for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
- if (*i) {
- getUnknownXMLObjects().push_back((*i)->clone());
- }
- }
+ IMPL_CLONE_XMLOBJECT_CHILDREN();
}
IMPL_XMLOBJECT_CLONE(Header);
EnvelopeImpl(const EnvelopeImpl& src)
: AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
- if (src.getHeader())
- setHeader(src.getHeader()->cloneHeader());
- if (src.getBody())
- setBody(src.getBody()->cloneBody());
+ IMPL_CLONE_TYPED_CHILD(Header);
+ IMPL_CLONE_TYPED_CHILD(Body);
}
+ IMPL_XMLOBJECT_CLONE(Envelope);
IMPL_TYPED_CHILD(Header);
IMPL_TYPED_CHILD(Body);
- IMPL_XMLOBJECT_CLONE(Envelope);
protected:
void marshallAttributes(DOMElement* domElement) const {