From: cantor Date: Fri, 14 Dec 2007 17:31:20 +0000 (+0000) Subject: Inline singleton unmarshalling, and throw an error if multiple copies show up. X-Git-Tag: 1.4.1~378 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fxmltooling.git;a=commitdiff_plain;h=7f18232f5fbe6fcbb3311a4cf7311d1ae9c40bdd Inline singleton unmarshalling, and throw an error if multiple copies show up. git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@449 de75baf8-a10c-0410-a50a-987c0e22f00f --- diff --git a/xmltooling/base.h b/xmltooling/base.h index 31e9edf..76fdc50 100644 --- a/xmltooling/base.h +++ b/xmltooling/base.h @@ -1070,8 +1070,9 @@ #define PROC_TYPED_CHILD(proper,namespaceURI,force) \ if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \ proper* typesafe=dynamic_cast(childXMLObject); \ - if (typesafe) { \ - set##proper(typesafe); \ + if (typesafe && !m_##proper) { \ + typesafe->setParent(this); \ + *m_pos_##proper = m_##proper = typesafe; \ return; \ } \ } @@ -1088,8 +1089,9 @@ #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \ if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \ ns::proper* typesafe=dynamic_cast(childXMLObject); \ - if (typesafe) { \ - set##proper(typesafe); \ + if (typesafe && !m_##proper) { \ + typesafe->setParent(this); \ + *m_pos_##proper = m_##proper = typesafe; \ return; \ } \ } @@ -1102,8 +1104,11 @@ */ #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \ if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \ - set##proper(childXMLObject); \ - return; \ + if (!m_##proper) { \ + childXMLObject->setParent(this); \ + *m_pos_##proper = m_##proper = childXMLObject; \ + return; \ + } \ } /**