libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
crn::xml::Node Class Reference

XML node. More...

#include <CRNXml.h>

+ Inheritance diagram for crn::xml::Node:

Public Member Functions

virtual ~Node ()
 Destructor. More...
 
 Node (const Node &)=default
 
 Node (Node &&)=default
 
Nodeoperator= (const Node &)=default
 
Nodeoperator= (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...
 
Nodeoperator++ ()
 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

 Node (tinyxml2::XMLNode *n, const SCharsetConverter &c)
 Constructor. More...
 

Protected Attributes

SCharsetConverter conv
 

Friends

class Document
 
class Element
 

Detailed Description

XML node.

An XML node

Version
1.0
Author
Yann LEYDIER
Date
August 2012

Definition at line 60 of file CRNXml.h.

Constructor & Destructor Documentation

virtual crn::xml::Node::~Node ( )
inlinevirtual

Destructor.

Definition at line 64 of file CRNXml.h.

crn::xml::Node::Node ( const Node )
default
crn::xml::Node::Node ( Node &&  )
default
Node::Node ( tinyxml2::XMLNode n,
const SCharsetConverter &  c 
)
protected

Constructor.

Constructor

Parameters
[in]nthe inner node pointer
[in]ca character set converter

Definition at line 97 of file CRNXml.cpp.

Member Function Documentation

Comment Node::AsComment ( )

Converts to comment.

Converts to comment

Exceptions
ExceptionDomainnot a comment
Returns
A comment

Definition at line 144 of file CRNXml.cpp.

Element Node::AsElement ( )

Converts to element.

Converts to element

Exceptions
ExceptionDomainnot an element
Returns
An element

Definition at line 130 of file CRNXml.cpp.

Text Node::AsText ( )

Converts to text.

Converts to text

Exceptions
ExceptionDomainnot a text
Returns
A text

Definition at line 158 of file CRNXml.cpp.

Node Node::GetNextSibling ( )

Gets the next sibling node.

Gets the next sibling node

Returns
the next sibling node or null node

Definition at line 206 of file CRNXml.cpp.

Element Node::GetNextSiblingElement ( const StringUTF8 name = "")

Gets the next sibling element.

Gets the next sibling element

Exceptions
CharsetConverter::ExceptionInvalidCharacterinvalid character
CharsetConverter::ExceptionIncompleteCodeincomplete multibyte character
Parameters
[in]namethe name of the element or empty string for any element
Returns
the next sibling element or null element

Definition at line 247 of file CRNXml.cpp.

Node Node::GetParent ( )

Gets the parent node if any.

Gets the parent node if any

Returns
the parent node of null node

Definition at line 189 of file CRNXml.cpp.

Node Node::GetPreviousSibling ( )

Gets the previous sibling node.

Gets the previous sibling node

Returns
the previous sibling node or null node

Definition at line 198 of file CRNXml.cpp.

Element Node::GetPreviousSiblingElement ( const StringUTF8 name = "")

Gets the previous sibling element.

Gets the previous sibling element

Exceptions
CharsetConverter::ExceptionInvalidCharacterinvalid character
CharsetConverter::ExceptionIncompleteCodeincomplete multibyte character
Parameters
[in]namethe name of the element or empty string for any element
Returns
the previous sibling element or null element

Definition at line 236 of file CRNXml.cpp.

StringUTF8 Node::GetValue ( ) const
virtual

Gets the content of the node.

Gets the content of the node

Returns
the content of the node

Reimplemented in crn::xml::Text.

Definition at line 171 of file CRNXml.cpp.

bool Node::IsComment ( )

Checks if the node is a comment.

Returns
true if the node is a comment

Definition at line 111 of file CRNXml.cpp.

bool Node::IsElement ( )

Checks if the node is an element.

Returns
true if the node is an element

Definition at line 103 of file CRNXml.cpp.

bool Node::IsText ( )

Checks if the node is a text.

Returns
true if the node is a text

Definition at line 119 of file CRNXml.cpp.

crn::xml::Node::operator bool ( ) const
inlinenoexcept

Checks if the node is not null.

Definition at line 85 of file CRNXml.h.

bool crn::xml::Node::operator! ( ) const
inlinenoexcept

Checks if the node is null.

Definition at line 87 of file CRNXml.h.

bool crn::xml::Node::operator!= ( const Node other) const
inlinenoexcept

Comparison operator.

Definition at line 91 of file CRNXml.h.

Node & Node::operator++ ( )

Moves to the next sibling node.

Moves to the next sibling node

Returns
the next sibling node or null node

Definition at line 214 of file CRNXml.cpp.

Node Node::operator++ ( int  )

Moves to the next sibling node.

Moves to the next sibling node

Returns
the current sibling node

Definition at line 223 of file CRNXml.cpp.

Node& crn::xml::Node::operator= ( const Node )
default
Node& crn::xml::Node::operator= ( Node &&  )
default
bool crn::xml::Node::operator== ( const Node other) const
inlinenoexcept

Comparison operator.

Definition at line 89 of file CRNXml.h.

void Node::SetValue ( const StringUTF8 s)

Sets the content of the node.

Sets the content of the node

Exceptions
CharsetConverter::ExceptionInvalidCharacterinvalid character
CharsetConverter::ExceptionIncompleteCodeincomplete multibyte character
Parameters
[in]sthe new content of the node

Definition at line 181 of file CRNXml.cpp.

Friends And Related Function Documentation

friend class Document
friend

Definition at line 123 of file CRNXml.h.

friend class Element
friend

Definition at line 124 of file CRNXml.h.

Member Data Documentation

SCharsetConverter crn::xml::Node::conv
protected

Definition at line 118 of file CRNXml.h.


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