Refactored simple content and child-handling into mixin classes.
[shibboleth/cpp-xmltooling.git] / xmltooling / AbstractXMLObject.h
index 251a60f..5ead42f 100644 (file)
@@ -34,11 +34,17 @@ namespace xmltooling {
 \r
     /**\r
      * An abstract implementation of XMLObject.\r
+     * This is the primary concrete base class, and supplies basic namespace,\r
+     * type, and parent handling. Most implementation classes should not\r
+     * directly inherit from this class, but rather from the various mixins\r
+     * that supply the rest of the XMLObject interface, as required.\r
      */\r
     class XMLTOOL_API AbstractXMLObject : public virtual XMLObject\r
     {\r
     public:\r
-        virtual ~AbstractXMLObject();\r
+        virtual ~AbstractXMLObject() {\r
+            delete m_typeQname;\r
+        }\r
 \r
         const QName& getElementQName() const {\r
             return m_elementQname;\r
@@ -74,14 +80,6 @@ namespace xmltooling {
             m_parent = parent;\r
         }\r
 \r
-        bool hasChildren() const {\r
-            return !m_children.empty();\r
-        }\r
-\r
-        const std::list<XMLObject*>& getOrderedChildren() const {\r
-            return m_children;\r
-        }\r
-\r
      protected:\r
         /**\r
          * Constructor\r
@@ -109,17 +107,7 @@ namespace xmltooling {
          * \r
          * @return the value that should be assigned\r
          */\r
-        XMLCh* prepareForAssignment(XMLCh* oldValue, const XMLCh* newValue) {\r
-            XMLCh* newString = XMLString::replicate(newValue);\r
-            XMLString::trim(newString);\r
-            if (!XMLString::equals(oldValue,newValue)) {\r
-                releaseThisandParentDOM();\r
-                XMLString::release(&oldValue);\r
-                return newString;\r
-            }\r
-            XMLString::release(&newString);\r
-            return oldValue;            \r
-        }\r
+        XMLCh* prepareForAssignment(XMLCh* oldValue, const XMLCh* newValue);\r
 \r
         /**\r
          * A helper function for derived classes, for assignment of (singleton) XML objects.\r
@@ -138,12 +126,6 @@ namespace xmltooling {
         XMLObject* prepareForAssignment(XMLObject* oldValue, XMLObject* newValue);\r
 \r
         /**\r
-         * Underlying list of child objects.\r
-         * Manages the lifetime of the children.\r
-         */\r
-        std::list<XMLObject*> m_children;\r
-\r
-        /**\r
          * Set of namespaces associated with the object.\r
          */\r
         mutable std::set<Namespace> m_namespaces;\r