Shaka Packager SDK
|
#include <xml_node.h>
Public Member Functions | |
XmlNode (const std::string &name) | |
XmlNode (XmlNode &&) | |
XmlNode & | operator= (XmlNode &&) |
bool | AddChild (XmlNode child) WARN_UNUSED_RESULT |
bool | AddElements (const std::vector< Element > &elements) WARN_UNUSED_RESULT |
Adds Elements to this node using the Element struct. | |
bool | SetStringAttribute (const std::string &attribute_name, const std::string &attribute) WARN_UNUSED_RESULT |
bool | SetIntegerAttribute (const std::string &attribute_name, uint64_t number) WARN_UNUSED_RESULT |
bool | SetFloatingPointAttribute (const std::string &attribute_name, double number) WARN_UNUSED_RESULT |
bool | SetId (uint32_t id) WARN_UNUSED_RESULT |
void | AddContent (const std::string &content) |
Similar to SetContent, but appends to the end of existing content. | |
void | SetContent (const std::string &content) |
std::set< std::string > | ExtractReferencedNamespaces () const |
std::string | ToString (const std::string &comment) const |
bool | GetAttribute (const std::string &name, std::string *value) const |
Friends | |
bool | shaka::XmlEqual (const std::string &xml1, const xml::XmlNode &xml2) |
These classes are wrapper classes for XML elements for generating MPD. None of the pointer parameters should be NULL. None of the methods are meant to be overridden.
Definition at line 44 of file xml_node.h.
|
explicit |
Make an XML element.
name | is the name of the element, which should not be NULL. |
Definition at line 129 of file xml_node.cc.
bool shaka::xml::XmlNode::AddChild | ( | XmlNode | child | ) |
Add a child element to this element.
child | is an XmlNode to add as a child for this element. |
Definition at line 140 of file xml_node.cc.
std::set< std::string > shaka::xml::XmlNode::ExtractReferencedNamespaces | ( | ) | const |
Definition at line 218 of file xml_node.cc.
bool shaka::xml::XmlNode::GetAttribute | ( | const std::string & | name, |
std::string * | value | ||
) | const |
Gets the attribute with the given name.
name | The name of the attribute to get. |
value | [OUT] where to put the resulting value. |
Definition at line 248 of file xml_node.cc.
void shaka::xml::XmlNode::SetContent | ( | const std::string & | content | ) |
Set the contents of an XML element using a string. This cannot set child elements because <> will become < and This should be used to set the text for the element, e.g. setting a URL for <BaseURL> element.
content | is a string containing the text-encoded child elements to be added to the element. |
Definition at line 213 of file xml_node.cc.
bool shaka::xml::XmlNode::SetFloatingPointAttribute | ( | const std::string & | attribute_name, |
double | number | ||
) |
Set a floating point number attribute.
attribute_name | is the name of the attribute to set. |
number | is the value (rhs) of the attribute. |
Definition at line 197 of file xml_node.cc.
bool shaka::xml::XmlNode::SetId | ( | uint32_t | id | ) |
Sets 'id=id' attribute.
id | is the ID for this element. |
Definition at line 204 of file xml_node.cc.
bool shaka::xml::XmlNode::SetIntegerAttribute | ( | const std::string & | attribute_name, |
uint64_t | number | ||
) |
Sets an integer attribute.
attribute_name | The name (lhs) of the attribute. |
number | The value (rhs) of the attribute. |
Definition at line 190 of file xml_node.cc.
bool shaka::xml::XmlNode::SetStringAttribute | ( | const std::string & | attribute_name, |
const std::string & | attribute | ||
) |
Set a string attribute.
attribute_name | The name (lhs) of the attribute. |
attribute | The value (rhs) of the attribute. |
Definition at line 183 of file xml_node.cc.
std::string shaka::xml::XmlNode::ToString | ( | const std::string & | comment | ) | const |
comment | The body of a comment to add to the top of the XML. |
Definition at line 224 of file xml_node.cc.