Shaka Packager SDK
Public Member Functions | List of all members
shaka::xml::XmlNode Class Reference

#include <xml_node.h>

Inheritance diagram for shaka::xml::XmlNode:
shaka::xml::RepresentationBaseXmlNode shaka::xml::AdaptationSetXmlNode shaka::xml::RepresentationXmlNode

Public Member Functions

 XmlNode (const char *name)
 
bool AddChild (scoped_xml_ptr< xmlNode > child)
 
bool AddElements (const std::vector< Element > &elements)
 Adds Elements to this node using the Element struct.
 
void SetStringAttribute (const char *attribute_name, const std::string &attribute)
 
void SetIntegerAttribute (const char *attribute_name, uint64_t number)
 
void SetFloatingPointAttribute (const char *attribute_name, double number)
 
void SetId (uint32_t id)
 
void SetContent (const std::string &content)
 
std::set< std::string > ExtractReferencedNamespaces ()
 
scoped_xml_ptr< xmlNode > PassScopedPtr ()
 
xmlNodePtr Release ()
 
xmlNodePtr GetRawPtr ()
 

Detailed Description

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 33 of file xml_node.h.

Constructor & Destructor Documentation

◆ XmlNode()

shaka::xml::XmlNode::XmlNode ( const char *  name)
explicit

Make an XML element.

Parameters
nameis the name of the element, which should not be NULL.

Definition at line 114 of file xml_node.cc.

Member Function Documentation

◆ AddChild()

bool shaka::xml::XmlNode::AddChild ( scoped_xml_ptr< xmlNode >  child)

Add a child element to this element.

Parameters
childis a xmlNode to add as a child for this element. Ownership of the child node is transferred.
Returns
true on success, false otherwise.

Definition at line 121 of file xml_node.cc.

◆ ExtractReferencedNamespaces()

std::set< std::string > shaka::xml::XmlNode::ExtractReferencedNamespaces ( )
Returns
namespaces used in the node and its descendents.

Definition at line 198 of file xml_node.cc.

◆ GetRawPtr()

xmlNodePtr shaka::xml::XmlNode::GetRawPtr ( )
Returns
Raw pointer to the element.

Definition at line 216 of file xml_node.cc.

◆ PassScopedPtr()

scoped_xml_ptr< xmlNode > shaka::xml::XmlNode::PassScopedPtr ( )

Transfer the ownership of the xmlNodePtr. After calling this method, the behavior of any methods, except the destructor, is undefined.

Returns
The resource of this object.

Definition at line 204 of file xml_node.cc.

◆ Release()

xmlNodePtr shaka::xml::XmlNode::Release ( )

Release the xmlNodePtr of this object. After calling this method, the behavior of any methods, except the destructor, is undefined.

Definition at line 210 of file xml_node.cc.

◆ SetContent()

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.

Parameters
contentis a string containing the text-encoded child elements to be added to the element.

Definition at line 193 of file xml_node.cc.

◆ SetFloatingPointAttribute()

void shaka::xml::XmlNode::SetFloatingPointAttribute ( const char *  attribute_name,
double  number 
)

Set a floating point number attribute.

Parameters
attribute_nameis the name of the attribute to set.
numberis the value (rhs) of the attribute.

Definition at line 181 of file xml_node.cc.

◆ SetId()

void shaka::xml::XmlNode::SetId ( uint32_t  id)

Sets 'id=id' attribute.

Parameters
idis the ID for this element.

Definition at line 189 of file xml_node.cc.

◆ SetIntegerAttribute()

void shaka::xml::XmlNode::SetIntegerAttribute ( const char *  attribute_name,
uint64_t  number 
)

Sets an integer attribute.

Parameters
attribute_nameThe name (lhs) of the attribute.
numberThe value (rhs) of the attribute.

Definition at line 173 of file xml_node.cc.

◆ SetStringAttribute()

void shaka::xml::XmlNode::SetStringAttribute ( const char *  attribute_name,
const std::string &  attribute 
)

Set a string attribute.

Parameters
attribute_nameThe name (lhs) of the attribute.
attributeThe value (rhs) of the attribute.

Definition at line 166 of file xml_node.cc.


The documentation for this class was generated from the following files: