new method for attaching child instances
authorjhurst <jhurst@cinecert.com>
Mon, 25 Feb 2008 18:01:56 +0000 (18:01 +0000)
committerjhurst <>
Mon, 25 Feb 2008 18:01:56 +0000 (18:01 +0000)
src/KM_xml.cpp
src/KM_xml.h

index 9c41512149631d423eeee8e3a276daffe75e9b0f..2286d9b4d92c3a2e72552b595863ed0562528926 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2006, John Hurst
+Copyright (c) 2005-2008, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -84,6 +84,14 @@ Kumu::XMLElement::SetAttr(const char* name, const char* value)
   m_AttrList.push_back(TmpVal);
 }
 
+//
+Kumu::XMLElement*
+Kumu::XMLElement::AddChild(Kumu::XMLElement* element)
+{
+  m_ChildList.push_back(element); // takes posession!
+  return element;
+}
+
 //
 Kumu::XMLElement*
 Kumu::XMLElement::AddChild(const char* name)
index 6900dd8f6d29afd9f297b551918c201a9227ba0c..13070fca8e1ab387a672a09f4a31c62279770922 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2006, John Hurst
+Copyright (c) 2005-2008, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,10 @@ namespace Kumu
   //
   class XMLElement
     {
+      KM_NO_COPY_CONSTRUCT(XMLElement);
+      XMLElement();
+
+    protected:
       AttributeList       m_AttrList;
       ElementList         m_ChildList;
       const XMLNamespace* m_Namespace;
@@ -85,9 +89,6 @@ namespace Kumu
       std::string   m_Name;
       std::string   m_Body;
 
-      KM_NO_COPY_CONSTRUCT(XMLElement);
-      XMLElement();
-
     public:
       XMLElement(const char* name);
       ~XMLElement();
@@ -101,6 +102,7 @@ namespace Kumu
       void        SetName(const char* name);
       void        AppendBody(const std::string& value);
       void        SetAttr(const char* name, const char* value);
+      XMLElement* AddChild(XMLElement* element);
       XMLElement* AddChild(const char* name);
       XMLElement* AddChildWithContent(const char* name, const char* value);
       XMLElement* AddChildWithContent(const char* name, const std::string& value);