summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2009-03-19 05:36:45 +0000
committerjhurst <>2009-03-19 05:36:45 +0000
commit1a1e7cb31f631cd5205b1a4ce9cd4c031fafb5d1 (patch)
tree585a8caf44f53d0ae622855e79b79028242dc4cb /src
parent9eaedba3c8ea1c00b849cb4f41288e00cdd49e87 (diff)
fun with XML
Diffstat (limited to 'src')
-rw-r--r--src/KM_xml.cpp74
-rw-r--r--src/KM_xml.h9
-rw-r--r--src/S12MTimecode.h1
3 files changed, 83 insertions, 1 deletions
diff --git a/src/KM_xml.cpp b/src/KM_xml.cpp
index 4792e9b..5b053fa 100644
--- a/src/KM_xml.cpp
+++ b/src/KM_xml.cpp
@@ -138,6 +138,13 @@ Kumu::XMLElement::AppendBody(const std::string& value)
}
//
+void
+Kumu::XMLElement::SetBody(const std::string& value)
+{
+ m_Body = value;
+}
+
+//
Kumu::XMLElement*
Kumu::XMLElement::AddChildWithContent(const char* name, const char* value)
{
@@ -291,6 +298,73 @@ Kumu::XMLElement::GetChildrenWithName(const char* name, ElementList& outList) co
return outList;
}
+//
+void
+Kumu::XMLElement::DeleteAttributes()
+{
+ m_AttrList.clear();
+}
+
+//
+void
+Kumu::XMLElement::DeleteAttrWithName(const char* name)
+{
+ assert(name);
+ AttributeList::iterator i;
+ for ( i = m_AttrList.begin(); i != m_AttrList.end(); i++ )
+ {
+ if ( i->name == std::string(name) )
+ m_AttrList.erase(i);
+ }
+}
+
+//
+void
+Kumu::XMLElement::DeleteChildren()
+{
+ for ( ElementList::iterator i = m_ChildList.begin(); i != m_ChildList.end(); i++ )
+ {
+ delete *i;
+ m_ChildList.erase(i);
+ }
+}
+
+//
+void
+Kumu::XMLElement::DeleteChild(const XMLElement* element)
+{
+ if ( element != 0 )
+ {
+ for ( ElementList::iterator i = m_ChildList.begin(); i != m_ChildList.end(); i++ )
+ {
+ if ( *i == element )
+ {
+ delete *i;
+ m_ChildList.erase(i);
+ return;
+ }
+ }
+ }
+}
+
+//
+void
+Kumu::XMLElement::ForgetChild(const XMLElement* element)
+{
+ if ( element != 0 )
+ {
+ for ( ElementList::iterator i = m_ChildList.begin(); i != m_ChildList.end(); i++ )
+ {
+ if ( *i == element )
+ {
+ m_ChildList.erase(i);
+ return;
+ }
+ }
+ }
+}
+
+
//----------------------------------------------------------------------------------------------------
#ifdef HAVE_EXPAT
diff --git a/src/KM_xml.h b/src/KM_xml.h
index d8a444b..8e02596 100644
--- a/src/KM_xml.h
+++ b/src/KM_xml.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2005-2008, John Hurst
+Copyright (c) 2005-2009, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -100,6 +100,7 @@ namespace Kumu
// building
void SetName(const char* name);
+ void SetBody(const std::string& value);
void AppendBody(const std::string& value);
void SetAttr(const char* name, const char* value);
XMLElement* AddChild(XMLElement* element);
@@ -121,6 +122,12 @@ namespace Kumu
const ElementList& GetChildrenWithName(const char* name, ElementList& outList) const;
bool HasName(const char* name) const;
+ // altering
+ void DeleteAttributes();
+ void DeleteAttrWithName(const char* name);
+ void DeleteChildren();
+ void DeleteChild(const XMLElement* element);
+ void ForgetChild(const XMLElement* element);
};
} // namespace Kumu
diff --git a/src/S12MTimecode.h b/src/S12MTimecode.h
index 88c16f8..1e8c5a2 100644
--- a/src/S12MTimecode.h
+++ b/src/S12MTimecode.h
@@ -45,6 +45,7 @@ namespace ASDCP {
class S12MTimecode : public Kumu::IArchive
{
+ protected:
ui32_t m_FrameCount;
ui32_t m_FPS;