NovaSVG 0.10.0
A header-only SVG library
Loading...
Searching...
No Matches
novasvg::Node Class Reference

#include <novasvg.h>

Inheritance diagram for novasvg::Node:
Collaboration diagram for novasvg::Node:

Public Member Functions

 Node ()=default
 Constructs a null node.
 
bool isTextNode () const
 Checks if the node is a text node.
 
bool isElement () const
 Checks if the node is an element node.
 
TextNode toTextNode () const
 Converts the node to a TextNode.
 
Element toElement () const
 Converts the node to an Element.
 
Element parentElement () const
 Returns the parent element.
 
bool isNull () const
 Checks if the node is null.
 
 operator bool () const
 Checks if the node is not null.
 
bool operator== (const Node &node) const
 Checks if two nodes are equal.
 
bool operator!= (const Node &node) const
 Checks if two nodes are not equal.
 

Protected Member Functions

 Node (SVGNode *node)
 
SVGNode * node () const
 

Protected Attributes

SVGNode * m_node {nullptr}
 

Friends

class Element
 

Detailed Description

Definition at line 363 of file novasvg.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

novasvg::Node::Node ( )
default

Constructs a null node.

◆ Node() [2/2]

novasvg::Node::Node ( SVGNode *  node)
inlineprotected

Definition at line 838 of file novasvg.h.

Member Function Documentation

◆ isElement()

bool novasvg::Node::isElement ( ) const
inline

Checks if the node is an element node.

Returns
True if the node is an element node, false otherwise.

Definition at line 848 of file novasvg.h.

References novasvg::SVGNode::isElement(), and m_node.

◆ isNull()

bool novasvg::Node::isNull ( ) const
inline

Checks if the node is null.

Returns
True if the node is null, false otherwise.

Definition at line 404 of file novasvg.h.

◆ isTextNode()

bool novasvg::Node::isTextNode ( ) const
inline

Checks if the node is a text node.

Returns
True if the node is a text node, false otherwise.

Definition at line 843 of file novasvg.h.

References novasvg::SVGNode::isTextNode(), and m_node.

◆ node()

SVGNode * novasvg::Node::node ( ) const
inlineprotected

Definition at line 428 of file novasvg.h.

◆ operator bool()

novasvg::Node::operator bool ( ) const
inline

Checks if the node is not null.

Returns
True if the node is not null, false otherwise.

Definition at line 410 of file novasvg.h.

◆ operator!=()

bool novasvg::Node::operator!= ( const Node &  node) const
inline

Checks if two nodes are not equal.

Parameters
elementThe node to compare.
Returns
True if not equal, otherwise false.

Definition at line 424 of file novasvg.h.

References m_node.

◆ operator==()

bool novasvg::Node::operator== ( const Node &  node) const
inline

Checks if two nodes are equal.

Parameters
elementThe node to compare.
Returns
True if equal, otherwise false.

Definition at line 417 of file novasvg.h.

References m_node.

◆ parentElement()

Element novasvg::Node::parentElement ( ) const
inline

Returns the parent element.

Returns
The parent element of this node. If this node has no parent, a null Element is returned.

Definition at line 867 of file novasvg.h.

References Element, m_node, and novasvg::SVGNode::parentElement().

Referenced by novasvg::Element::getGlobalMatrix().

◆ toElement()

Element novasvg::Node::toElement ( ) const
inline

Converts the node to an Element.

Returns
An Element or a null node if conversion is not possible.

Definition at line 860 of file novasvg.h.

References Element, novasvg::SVGNode::isElement(), and m_node.

◆ toTextNode()

TextNode novasvg::Node::toTextNode ( ) const
inline

Converts the node to a TextNode.

Returns
A TextNode or a null node if conversion is not possible.

Definition at line 853 of file novasvg.h.

References novasvg::SVGNode::isTextNode(), and m_node.

Friends And Related Symbol Documentation

◆ Element

friend class Element
friend

Definition at line 430 of file novasvg.h.

Referenced by parentElement(), and toElement().

Member Data Documentation

◆ m_node


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