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 130 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 141 of file xml_node.cc.
std::set< std::string > shaka::xml::XmlNode::ExtractReferencedNamespaces | ( | ) | const |
Definition at line 219 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 249 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 214 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 198 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 205 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 191 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 184 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 225 of file xml_node.cc.