|
libcrn
3.9.5
A document image processing library
|
XML element. More...
#include <CRNXml.h>
Inheritance diagram for crn::xml::Element:
Collaboration diagram for crn::xml::Element:Classes | |
| class | Attribute |
Public Member Functions | |
| virtual | ~Element () override |
| Destructor. More... | |
| Element (const Element &)=default | |
| Element (Element &&)=default | |
| Element & | operator= (const Element &)=default |
| Element & | operator= (Element &&)=default |
| StringUTF8 | GetName () const |
| Gets the label of the element. More... | |
| void | SetName (const StringUTF8 &s) |
| Sets the label of the element. More... | |
| Element & | operator++ () |
| Moves to the next sibling element. More... | |
| Element | operator++ (int) |
| Moves to the next sibling element. More... | |
| size_t | GetNbSubnodes () const |
| Returns the number of sub-nodes. More... | |
| size_t | GetNbSubelements () const |
| Returns the number of sub-elements. More... | |
| Node | GetFirstChild () |
| Gets the first child node. More... | |
| Node | GetLastChild () |
| Gets the last child node. More... | |
| Node | BeginNode () |
| Gets the first child node. More... | |
| Node | EndNode () |
| Gets a null node. More... | |
| Element | GetFirstChildElement (const StringUTF8 &name="") |
| Gets the first child element. More... | |
| Element | GetLastChildElement (const StringUTF8 &name="") |
| Gets the last child element. More... | |
| Element | BeginElement () |
| Gets the first child element. More... | |
| Element | EndElement () |
| Gets a null node. More... | |
| StringUTF8 | GetFirstChildText () |
| Gets the first child as text. More... | |
| Element | PushBackElement (const StringUTF8 &name) |
| Adds an element at the end of the children list. More... | |
| Element | PushFrontElement (const StringUTF8 &name) |
| Adds an element at the front of the children list. More... | |
| Element | InsertElement (Node &n, const StringUTF8 &name) |
| Inserts an element after a node. More... | |
| Comment | PushBackComment (const StringUTF8 &text) |
| Adds a comment at the end of the children list. More... | |
| Comment | PushFrontComment (const StringUTF8 &text) |
| Adds a comment at the front of the children list. More... | |
| Comment | InsertComment (Node &n, const StringUTF8 &text) |
| Inserts a comment after a node. More... | |
| Text | PushBackText (const StringUTF8 &text, bool cdata=false) |
| Adds a text at the end of the children list. More... | |
| Text | PushFrontText (const StringUTF8 &text, bool cdata=false) |
| Adds a text at the front of the children list. More... | |
| Text | InsertText (Node &n, const StringUTF8 &text, bool cdata=false) |
| Inserts a text after a node. More... | |
| Node | PushBackClone (Node &n, bool recursive=false) |
| Adds a copy of a node at the end of the children list. More... | |
| void | Clear () |
| Removes all children. More... | |
| void | RemoveChild (Node &n) |
| Removes a child node. More... | |
| template<typename T > | |
| T | GetAttribute (const StringUTF8 &name, bool silent=true) const |
| Gets an attribute. More... | |
| void | SetAttribute (const StringUTF8 &name, const StringUTF8 &value) |
| Sets the value of an attribute. More... | |
| void | RemoveAttribute (const StringUTF8 &name) |
| Removes an attribute. More... | |
| Attribute | BeginAttribute () |
| Gets the first attribute. More... | |
| Attribute | EndAttribute () |
| Gets the null attribute. More... | |
| template<> | |
| StringUTF8 | GetAttribute (const StringUTF8 &name, bool silent) const |
| Gets an attribute. More... | |
Public Member Functions inherited from crn::xml::Node | |
| virtual | ~Node () |
| Destructor. More... | |
| Node (const Node &)=default | |
| Node (Node &&)=default | |
| Node & | operator= (const Node &)=default |
| Node & | operator= (Node &&)=default |
| bool | IsElement () |
| Checks if the node is an element. More... | |
| bool | IsComment () |
| Checks if the node is a comment. More... | |
| bool | IsText () |
| Checks if the node is a text. More... | |
| Element | AsElement () |
| Converts to element. More... | |
| Comment | AsComment () |
| Converts to comment. More... | |
| Text | AsText () |
| Converts to text. More... | |
| operator bool () const noexcept | |
| Checks if the node is not null. More... | |
| bool | operator! () const noexcept |
| Checks if the node is null. More... | |
| bool | operator== (const Node &other) const noexcept |
| Comparison operator. More... | |
| bool | operator!= (const Node &other) const noexcept |
| Comparison operator. More... | |
| virtual StringUTF8 | GetValue () const |
| Gets the content of the node. More... | |
| void | SetValue (const StringUTF8 &s) |
| Sets the content of the node. More... | |
| Node | GetParent () |
| Gets the parent node if any. More... | |
| Node | GetPreviousSibling () |
| Gets the previous sibling node. More... | |
| Node | GetNextSibling () |
| Gets the next sibling node. More... | |
| Node & | operator++ () |
| Moves to the next sibling node. More... | |
| Node | operator++ (int) |
| Moves to the next sibling node. More... | |
| Element | GetNextSiblingElement (const StringUTF8 &name="") |
| Gets the next sibling element. More... | |
| Element | GetPreviousSiblingElement (const StringUTF8 &name="") |
| Gets the previous sibling element. More... | |
Protected Member Functions | |
| Element (tinyxml2::XMLElement *el, const SCharsetConverter &c) | |
| Constructor. More... | |
Protected Member Functions inherited from crn::xml::Node | |
| Node (tinyxml2::XMLNode *n, const SCharsetConverter &c) | |
| Constructor. More... | |
Friends | |
| class | Node |
| class | Document |
Additional Inherited Members | |
Protected Attributes inherited from crn::xml::Node | |
| SCharsetConverter | conv |
|
inlineoverridevirtual |
|
default |
|
default |
|
protected |
Constructor.
Constructor
| [in] | el | the inner element pointer |
| [in] | c | a character set converter |
Definition at line 260 of file CRNXml.cpp.
| Element::Attribute Element::BeginAttribute | ( | ) |
Gets the first attribute.
Gets the first attribute
Definition at line 618 of file CRNXml.cpp.
|
inline |
|
inline |
| void Element::Clear | ( | ) |
| Element::Attribute Element::EndAttribute | ( | ) |
Gets the null attribute.
Gets the null attribute
Definition at line 626 of file CRNXml.cpp.
|
inline |
|
inline |
|
inline |
Gets an attribute.
| ExceptionInvalidArgument | empty attribute name |
| ExceptionNotFound | attribute not found |
| ExceptionDomain | cannot convert attribute |
| [in] | name | the name of the attribute |
| [in] | silent | shall exceptions be dropped? |
|
inline |
Gets an attribute.
| ExceptionInvalidArgument | empty attribute name |
| ExceptionNotFound | attribute not found |
| ExceptionDomain | cannot convert attribute |
| [in] | name | the name of the attribute |
| [in] | silent | shall exceptions be dropped? |
| Node Element::GetFirstChild | ( | ) |
Gets the first child node.
Gets the first child node
Definition at line 303 of file CRNXml.cpp.
| Element Element::GetFirstChildElement | ( | const StringUTF8 & | name = "" | ) |
Gets the first child element.
Gets the first child element
| [in] | name | the name of the element or empty string for any element |
Definition at line 320 of file CRNXml.cpp.
| StringUTF8 Element::GetFirstChildText | ( | ) |
Gets the first child as text.
Gets the first child as text
| ExceptionNotFound | no child |
| ExceptionDomain | first child is not Text |
Definition at line 339 of file CRNXml.cpp.
| Node Element::GetLastChild | ( | ) |
Gets the last child node.
Gets the last child node
Definition at line 311 of file CRNXml.cpp.
| Element Element::GetLastChildElement | ( | const StringUTF8 & | name = "" | ) |
Gets the last child element.
Gets the last child element
| [in] | name | the name of the element or empty string for any element |
Definition at line 329 of file CRNXml.cpp.
|
inline |
|
inline |
|
inline |
| Comment Element::InsertComment | ( | Node & | n, |
| const StringUTF8 & | text | ||
| ) |
Inserts a comment after a node.
Inserts a comment after a node
| ExceptionNotFound | node not found |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | n | the node after which the new comment will be inserted |
| [in] | text | the content of the comment |
Definition at line 446 of file CRNXml.cpp.
| Element Element::InsertElement | ( | Node & | n, |
| const StringUTF8 & | name | ||
| ) |
Inserts an element after a node.
Inserts an element after a node
| ExceptionInvalidArgument | null node or empty element name |
| ExceptionNotFound | node not found |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | n | the node after which the new element will be inserted |
| [in] | name | the name of the element |
Definition at line 393 of file CRNXml.cpp.
| Text Element::InsertText | ( | Node & | n, |
| const StringUTF8 & | text, | ||
| bool | cdata = false |
||
| ) |
Inserts a text after a node.
Inserts a text after a node
| ExceptionInvalidArgument | null node |
| ExceptionNotFound | node not found |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | n | the node after which the new text will be inserted |
| [in] | text | the content of the text |
| [in] | cdata | is the text stored as a CData? |
Definition at line 502 of file CRNXml.cpp.
| Element & Element::operator++ | ( | ) |
Moves to the next sibling element.
Moves to the next sibling element
Definition at line 284 of file CRNXml.cpp.
| Element Element::operator++ | ( | int | ) |
Moves to the next sibling element.
Moves to the next sibling element
Definition at line 293 of file CRNXml.cpp.
Adds a copy of a node at the end of the children list.
Adds a copy of a node at the end of the children list
| ExceptionInvalidArgument | null or invalid node |
| [in] | n | the node to copy |
| [in] | recursive | shall the subelements be copied too? (only if n is an Element) |
Definition at line 523 of file CRNXml.cpp.
| Comment Element::PushBackComment | ( | const StringUTF8 & | text | ) |
Adds a comment at the end of the children list.
Adds a comment at the end of the children list
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | text | the content of the comment |
Definition at line 416 of file CRNXml.cpp.
| Element Element::PushBackElement | ( | const StringUTF8 & | name | ) |
Adds an element at the end of the children list.
Adds an element at the end of the children list
| ExceptionInvalidArgument | empty element name |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | name | the name of the element |
Definition at line 355 of file CRNXml.cpp.
| Text Element::PushBackText | ( | const StringUTF8 & | text, |
| bool | cdata = false |
||
| ) |
Adds a text at the end of the children list.
Adds a text at the end of the children list
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | text | the content of the text |
| [in] | cdata | is the text stored as a CData? |
Definition at line 467 of file CRNXml.cpp.
| Comment Element::PushFrontComment | ( | const StringUTF8 & | text | ) |
Adds a comment at the front of the children list.
Adds a comment at the front of the children list
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | text | the content of the comment |
Definition at line 430 of file CRNXml.cpp.
| Element Element::PushFrontElement | ( | const StringUTF8 & | name | ) |
Adds an element at the front of the children list.
Adds an element at the front of the children list
| ExceptionInvalidArgument | empty element name |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | name | the name of the element |
Definition at line 373 of file CRNXml.cpp.
| Text Element::PushFrontText | ( | const StringUTF8 & | text, |
| bool | cdata = false |
||
| ) |
Adds a text at the front of the children list.
Adds a text at the front of the children list
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | text | the content of the text |
| [in] | cdata | is the text stored as a CData? |
Definition at line 483 of file CRNXml.cpp.
| void Element::RemoveAttribute | ( | const StringUTF8 & | name | ) |
Removes an attribute.
Removes an attribute
| ExceptionInvalidArgument | empty attribute name |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | name | the name of the attribute |
Definition at line 608 of file CRNXml.cpp.
| void Element::RemoveChild | ( | Node & | n | ) |
Removes a child node.
Removes a child node
| [in] | n | the node to remove |
Definition at line 581 of file CRNXml.cpp.
| void Element::SetAttribute | ( | const StringUTF8 & | name, |
| const StringUTF8 & | value | ||
| ) |
Sets the value of an attribute.
Sets the value of an attribute
| ExceptionInvalidArgument | empty attribute name |
| CharsetConverter::ExceptionInvalidCharacter | invalid character |
| CharsetConverter::ExceptionIncompleteCode | incomplete multibyte character |
| [in] | name | the name of the attribute |
| [in] | value | the new value of the attribute |
Definition at line 595 of file CRNXml.cpp.
|
inline |
1.8.6