TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
Declaration in an XML document. More...
#include <tsxmlDeclaration.h>
Public Member Functions | |
Declaration (const Declaration &other) | |
Copy constructor. | |
Declaration (Document *parent, const UString &value=UString()) | |
Constructor. | |
Declaration (Report &report=(ts::NullReport::Instance()), size_t line=0) | |
Constructor. | |
size_t | childrenCount () const |
Get the number of children. | |
virtual void | clear () |
Clear the content of the node. | |
virtual Node * | clone () const override |
Clone the content of the node in a dynamically allocated object. | |
UString | debug () const |
Build a debug string for the node. | |
size_t | depth () const |
Get the depth of an XML element. | |
Document * | document () |
Get the document into which the node is located. | |
const Document * | document () const |
Get the document into which the node is located. | |
Node * | firstChild () |
Get the first child of a node. | |
const Node * | firstChild () const |
Get the first child of a node. | |
Element * | firstChildElement () |
Get the first child Element of a node. | |
const Element * | firstChildElement () const |
Get the first child Element of a node. | |
bool | hasChildren () const |
Check if the node has children. | |
Node * | lastChild () |
Get the last child. | |
const Node * | lastChild () const |
Get the last child. | |
size_t | lineNumber () const |
Get the line number in input document. | |
void | move (Node *newSibling, bool before) |
Move the node before or after another node, potentially to a new parent. | |
void | moveAfter (Node *newSibling) |
Move the node after another node, potentially to a new parent. | |
void | moveBefore (Node *newSibling) |
Move the node before another node, potentially to a new parent. | |
Node * | nextSibling () |
Get the next sibling node. | |
const Node * | nextSibling () const |
Get the next sibling node. | |
Element * | nextSiblingElement () |
Find the next sibling element. | |
const Element * | nextSiblingElement () const |
Find the next sibling element. | |
virtual UString | oneLiner () const |
Format the value as a one-liner XML text. | |
Node * | parent () |
Get the parent's node. | |
const Node * | parent () const |
Get the parent's node. | |
bool | preserveSpace () const |
Check if the node or one of its ancestors has attribute xml:space="preserve". | |
Node * | previousSibling () |
Get the previous sibling node. | |
const Node * | previousSibling () const |
Get the previous sibling node. | |
Element * | previousSiblingElement () |
Find the previous sibling element. | |
const Element * | previousSiblingElement () const |
Find the previous sibling element. | |
virtual void | print (TextFormatter &output, bool keepNodeOpen=false) const override |
Format the node for an output XML document. | |
virtual void | printClose (TextFormatter &output, size_t levels=std::numeric_limits< size_t >::max()) const |
Print the closing tags for the node. | |
void | removeComments (bool recurse) |
Remove all comments in the XML node. | |
void | reparent (Node *newParent, bool last=true) |
Attach the node to a new parent. | |
Report & | report () const |
Get a reference to the report object for the XML node. | |
bool | ringAlone () const |
Check if the node is alone in its own ring. | |
void | ringInsertAfter (RingNode *o) |
Insert this object in a ring after the specified node. | |
void | ringInsertBefore (RingNode *o) |
Insert this object in a ring before the specified node. | |
template<typename T > | |
T * | ringNext () |
Get the next node in the ring. | |
template<typename T > | |
const T * | ringNext () const |
Get the next node in the ring. | |
template<typename T > | |
T * | ringPrevious () |
Get the previous node in the ring. | |
template<typename T > | |
const T * | ringPrevious () const |
Get the previous node in the ring. | |
void | ringRemove () |
Remove the node from the ring it belongs to and creates its own ring. | |
size_t | ringSize () const |
Count the number of element in the ring. | |
void | ringSwap (RingNode *o) |
Swap this object and another one in their rings. | |
void | setValue (const UString &value) |
Set the value of the node. | |
virtual bool | stickyOutput () const |
Check if the text shall be stuck to other elements in XML output. | |
virtual const Tweaks & | tweaks () const |
Get a constant reference to the current XML parsing and formatting tweaks for this node. | |
virtual UString | typeName () const override |
Return a node type name, mainly for debug purpose. | |
const UString & | value () const |
Get the value of the node. | |
Static Public Attributes | |
static const UChar *const | DEFAULT_XML_DECLARATION |
Default XML declaration. | |
Protected Member Functions | |
Node * | identifyNextNode (TextParser &parser) |
Identify the next token in the document. | |
virtual bool | parseChildren (TextParser &parser) |
Parse children nodes and add them to the node. | |
virtual bool | parseNode (TextParser &parser, const Node *parent) override |
Parse the node. | |
void | setPreserveSpace (bool on) |
Called by the subclass when its spaces shall be preserved. | |
Declaration in an XML document.
|
explicit |
Constructor.
[in,out] | report | Where to report errors. |
[in] | line | Line number in input document. |
Constructor.
[in,out] | parent | The parent document into which the declaration is added. |
[in] | value | Content of the declaration. If empty, the default XML declaration is used. |
ts::xml::Declaration::Declaration | ( | const Declaration & | other | ) |
Copy constructor.
[in] | other | Other instance to copy. |
|
overridevirtual |
Clone the content of the node in a dynamically allocated object.
This virtual method must be implemented by subclasses to allocate a object of the right class.
Implements ts::xml::Node.
|
overridevirtual |
|
overridevirtual |
Format the node for an output XML document.
[in,out] | output | The output object to format the XML document. |
[in] | keepNodeOpen | If true, keep the node open so that children may be printed later. |
Implements ts::xml::Node.
|
overrideprotectedvirtual |
Parse the node.
[in,out] | parser | The document parser. On input, the current position of the parser after the tag which identified the node ("<?", "<!- -", etc.) On output, it must be after the last character of the node. |
[in] | parent | Candidate parent node, for information only, do not modify. Can be null. |
Implements ts::xml::Node.
|
inlineinherited |
Get the line number in input document.
|
virtualinherited |
Clear the content of the node.
The node becomes empty but remains attached to its parent.
Reimplemented in ts::xml::Element.
|
inherited |
Attach the node to a new parent.
The node is first detached from its previous parent.
[in,out] | newParent | New parent. If zero, the node becomes orphan. In that case, the node will no longer be freed by its parent and must be explicitly deleted. |
[in] | last | If true, the child is added at the end of the list of children. If false, it is added at the beginning. |
|
inlineinherited |
Move the node before another node, potentially to a new parent.
[in,out] | newSibling | A new sibling. The node will be moved before this one. |
|
inlineinherited |
Move the node after another node, potentially to a new parent.
[in,out] | newSibling | A new sibling. The node will be moved after this one. |
|
inherited |
Move the node before or after another node, potentially to a new parent.
[in,out] | newSibling | A new sibling. The node will be moved before or after this one. |
[in] | before | If true, move the node before newSibling, after it otherwise. |
|
inlineinherited |
Get the parent's node.
|
inlineinherited |
Get the parent's node.
|
inlineinherited |
Get the document into which the node is located.
|
inherited |
Get the document into which the node is located.
|
virtualinherited |
Get a constant reference to the current XML parsing and formatting tweaks for this node.
Reimplemented in ts::xml::Document.
|
inherited |
Get the depth of an XML element.
|
inherited |
Check if the node or one of its ancestors has attribute xml:space="preserve".
|
inlineinherited |
Check if the node has children.
|
inlineinherited |
Get the number of children.
|
inlineinherited |
Get the first child of a node.
|
inlineinherited |
Get the first child of a node.
|
inlineinherited |
Get the last child.
|
inlineinherited |
Get the last child.
|
inlineinherited |
Get the next sibling node.
|
inherited |
Get the next sibling node.
|
inlineinherited |
Get the previous sibling node.
|
inherited |
Get the previous sibling node.
|
inlineinherited |
|
inherited |
|
inlineinherited |
Find the next sibling element.
|
inherited |
Find the next sibling element.
|
inlineinherited |
Find the previous sibling element.
|
inherited |
Find the previous sibling element.
|
inlineinherited |
Get the value of the node.
The semantic of the value depends on the node subclass:
|
inlineinherited |
|
inherited |
Remove all comments in the XML node.
[in] | recurse | If true, apply recursively to all children nodes. |
|
virtualinherited |
Print the closing tags for the node.
Typically used after print() when keepNodeOpen was true. The default implementation is to do nothing. Subclasses may replace this.
[in,out] | output | The output object to format the XML document. |
[in] | levels | Number of levels to close. By default, close the complete document. If zero, no output is produced. |
Reimplemented in ts::xml::Document, and ts::xml::Element.
|
virtualinherited |
Format the value as a one-liner XML text.
|
virtualinherited |
Check if the text shall be stuck to other elements in XML output.
Reimplemented in ts::xml::Text.
|
inherited |
Build a debug string for the node.
|
inlineinherited |
Get a reference to the report object for the XML node.
|
protectedinherited |
Identify the next token in the document.
[in,out] | parser | The document parser. |
|
protectedvirtualinherited |
Parse children nodes and add them to the node.
Stop either at end of document or before a "</" sequence or on error.
[in,out] | parser | The document parser. |
|
inlineprotectedinherited |
Called by the subclass when its spaces shall be preserved.
Typically called when xml:space="preserve" is encountered.
[in] | on | True is spaces shall be preserved. |
|
inlineinherited |
Check if the node is alone in its own ring.
|
inherited |
Insert this object in a ring after the specified node.
[in] | o | A node of a ring. This object is inserted after o in the ring. |
|
inherited |
Insert this object in a ring before the specified node.
[in] | o | A node of a ring. This object is inserted before o in the ring. |
|
inherited |
Swap this object and another one in their rings.
If the two objects belong to the same ring, their positions are swapped. If they belong to distinct rings, they also move to each other's ring.
[in] | o | The node to swap with. |
|
inlineinherited |
Get the next node in the ring.
T | A superclass of RingNode, the expected type of the next object in the ring. |
|
inlineinherited |
Get the next node in the ring.
T | A superclass of RingNode, the expected type of the next object in the ring. |
|
inlineinherited |
Get the previous node in the ring.
T | A superclass of RingNode, the expected type of the previous object in the ring. |
|
inlineinherited |
Get the previous node in the ring.
T | A superclass of RingNode, the expected type of the previous object in the ring. |
|
inherited |
Count the number of element in the ring.
Warning: This method has a linear response time, avoid using it when possible.