Made AnyElementImpl public to allow inheritance for anyType specializations.
authorcantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Tue, 9 May 2006 15:03:11 +0000 (15:03 +0000)
committercantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Tue, 9 May 2006 15:03:11 +0000 (15:03 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@92 de75baf8-a10c-0410-a50a-987c0e22f00f

xmltooling/base.h
xmltooling/impl/AnyElement.cpp
xmltooling/impl/AnyElement.h

index 89320f2..1e949aa 100644 (file)
         chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
         chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
         chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chNull}
+#define UNICODE_LITERAL_33(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg) \
+    {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+        chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+        chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+        chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chLatin_##gg, chNull}
+#define UNICODE_LITERAL_34(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh) \
+    {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+        chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+        chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+        chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chLatin_##gg, chLatin_##hh, chNull}
 #endif /* DOXYGEN_SKIP */
 
 /**
index 9d26f51..0b95d34 100644 (file)
  */
 
 #include "internal.h"
-#include "AbstractAttributeExtensibleXMLObject.h"
-#include "AbstractElementProxy.h"
 #include "exceptions.h"
 #include "impl/AnyElement.h"
-#include "io/AbstractXMLObjectMarshaller.h"
-#include "io/AbstractXMLObjectUnmarshaller.h"
 #include "util/NDC.h"
 #include "util/XMLHelper.h"
 
@@ -37,81 +33,52 @@ using namespace xmltooling;
 using namespace log4cpp;
 using namespace std;
 
-#if defined (_MSC_VER)
-    #pragma warning( push )
-    #pragma warning( disable : 4250 4251 )
-#endif
+XMLObject* AnyElementImpl::clone() const {
+    auto_ptr<XMLObject> domClone(AbstractDOMCachingXMLObject::clone());
+    AnyElementImpl* ret=dynamic_cast<AnyElementImpl*>(domClone.get());
+    if (ret) {
+        domClone.release();
+        return ret;
+    }
 
-namespace xmltooling {
-
-    /**
-     * Implements a smart wrapper around unknown DOM content.
-     */
-    class XMLTOOL_DLLLOCAL AnyElementImpl : public AbstractDOMCachingXMLObject,
-        public AbstractElementProxy, public AbstractAttributeExtensibleXMLObject,
-        public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller
-    {
-    public:
-        virtual ~AnyElementImpl() {}
-
-        AnyElementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL)
-            : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
-        
-        AnyElementImpl* clone() const {
-            auto_ptr<XMLObject> domClone(AbstractDOMCachingXMLObject::clone());
-            AnyElementImpl* ret=dynamic_cast<AnyElementImpl*>(domClone.get());
-            if (ret) {
-                domClone.release();
-                return ret;
-            }
-
-            return new AnyElementImpl(*this);
-        }
-
-    protected:
-        AnyElementImpl(const AnyElementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src),
-            AbstractElementProxy(src), AbstractAttributeExtensibleXMLObject(src) {
-            for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
-                getXMLObjects().push_back((*i) ? (*i)->clone() : NULL);
-            }
-        }       
-        
-        void marshallAttributes(DOMElement* domElement) const {
-            for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
-                DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
-                if (i->first.hasPrefix())
-                    attr->setPrefix(i->first.getPrefix());
-                attr->setNodeValue(i->second);
-                domElement->setAttributeNode(attr);
-            }
-        }
-
-        void marshallElementContent(DOMElement* domElement) const {
-            if(getTextContent()) {
-                domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent()));
-            }
-        }
-
-        void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            getXMLObjects().push_back(childXMLObject);
-        }
+    return new AnyElementImpl(*this);
+}
 
-        void processAttribute(const DOMAttr* attribute) {
-            QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
-            setAttribute(q,attribute->getNodeValue());
-        }
+AnyElementImpl::AnyElementImpl(const AnyElementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src),
+    AbstractElementProxy(src), AbstractAttributeExtensibleXMLObject(src) {
+    for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+        getXMLObjects().push_back((*i) ? (*i)->clone() : NULL);
+    }
+}       
+
+void AnyElementImpl::marshallAttributes(DOMElement* domElement) const {
+    for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+        DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+        if (i->first.hasPrefix())
+            attr->setPrefix(i->first.getPrefix());
+        attr->setNodeValue(i->second);
+        domElement->setAttributeNode(attr);
+    }
+}
 
-        void processElementContent(const XMLCh* elementContent) {
-            setTextContent(elementContent);
-        }
-    };
+void AnyElementImpl::marshallElementContent(DOMElement* domElement) const {
+    if(getTextContent()) {
+        domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent()));
+    }
+}
 
-};
+void AnyElementImpl::processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+    getXMLObjects().push_back(childXMLObject);
+}
 
-#if defined (_MSC_VER)
-    #pragma warning( pop )
-#endif
+void AnyElementImpl::processAttribute(const DOMAttr* attribute) {
+    QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix()); 
+    setAttribute(q,attribute->getNodeValue());
+}
 
+void AnyElementImpl::processElementContent(const XMLCh* elementContent) {
+    setTextContent(elementContent);
+}
 
 XMLObject* AnyElementBuilder::buildObject(
     const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType
index 4bda237..85ee2e1 100644 (file)
 #if !defined(__xmltooling_anyelement_h__)
 #define __xmltooling_anyelement_h__
 
+#include <xmltooling/AbstractAttributeExtensibleXMLObject.h>
+#include <xmltooling/AbstractElementProxy.h>
 #include <xmltooling/XMLObjectBuilder.h>
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+
+#if defined (_MSC_VER)
+    #pragma warning( push )
+    #pragma warning( disable : 4250 4251 )
+#endif
 
 namespace xmltooling {
 
     /**
+     * Implements a smart wrapper around unknown or arbitrary DOM content.
+     */
+    class XMLTOOL_API AnyElementImpl : public AbstractDOMCachingXMLObject,
+        public AbstractElementProxy,
+        public AbstractAttributeExtensibleXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+    public:
+        virtual ~AnyElementImpl() {}
+
+        AnyElementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL)
+            : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+        
+        XMLObject* clone() const;
+        
+    protected:
+        AnyElementImpl(const AnyElementImpl& src);   
+        
+        void marshallAttributes(DOMElement* domElement) const;
+        void marshallElementContent(DOMElement* domElement) const;
+        void processChildElement(XMLObject* childXMLObject, const DOMElement* root);
+        void processAttribute(const DOMAttr* attribute);
+        void processElementContent(const XMLCh* elementContent);
+    };
+
+    /**
      * Builder for AnyElementImpl objects.
      * Use as the default builder when you want to wrap each unknown element and
      * process the DOM content through xmltooling interfaces. 
@@ -42,4 +78,8 @@ namespace xmltooling {
 
 };
 
+#if defined (_MSC_VER)
+    #pragma warning( pop )
+#endif
+
 #endif /* __xmltooling_anyelement_h__ */