diff options
| author | jhurst <jhurst@cinecert.com> | 2008-02-25 18:01:56 +0000 |
|---|---|---|
| committer | jhurst <> | 2008-02-25 18:01:56 +0000 |
| commit | c622263a11196bb53a807494a765982cd8bcb174 (patch) | |
| tree | eb7c6ce09e49b7dcd60d9fd7c1265ded248e675b /src | |
| parent | b81ddbe65c1a18f49a9a9579686e16ad1ee11979 (diff) | |
new method for attaching child instances
Diffstat (limited to 'src')
| -rw-r--r-- | src/KM_xml.cpp | 10 | ||||
| -rw-r--r-- | src/KM_xml.h | 10 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/KM_xml.cpp b/src/KM_xml.cpp index 9c41512..2286d9b 100644 --- a/src/KM_xml.cpp +++ b/src/KM_xml.cpp @@ -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 @@ -86,6 +86,14 @@ Kumu::XMLElement::SetAttr(const char* name, const char* value) // 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) { XMLElement* tmpE = new XMLElement(name); diff --git a/src/KM_xml.h b/src/KM_xml.h index 6900dd8..13070fc 100644 --- a/src/KM_xml.h +++ b/src/KM_xml.h @@ -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); |
