Class node_t

Inheritance Relationships

Derived Type

Class Documentation

class node_t

Scene data source node interface.

Subclassed by wt::scene::loader::xml::xml_node_t

Public Functions

virtual ~node_t() noexcept = default
inline std::partial_ordering operator<=>(const node_t &o) const noexcept
virtual const std::string &type() const noexcept = 0

Node type. For example, XML nodes should all return the same type (e.g., “XML”).

virtual const std::string &path() const noexcept = 0

Node path.

virtual const std::string &name() const noexcept = 0

Node name.

virtual bool has_attrib(const std::string &attribute) const noexcept = 0
virtual const std::string &operator[](const std::string &attribute) const noexcept = 0

Accesses an attribute by name.

virtual const std::map<std::string, std::string> &attributes() const noexcept = 0

List of attributes.

virtual bool set_attribute(const std::string &name, const std::string &value) noexcept = 0

Sets or updates attribute value.

virtual std::vector<const node_t*> children(const std::string &name) const noexcept = 0

List of all children nodes of name name.

virtual const std::vector<std::unique_ptr<node_t>> &children() const noexcept = 0

List of all children nodes.

virtual std::vector<std::unique_ptr<node_t>> extract_children() && noexcept = 0

Moves all children out of this node. Destructive.

virtual bool add_child(std::unique_ptr<node_t> child) noexcept = 0

Insert a child node.

virtual bool replace_child(const node_t &child, std::vector<std::unique_ptr<node_t>> nodes) noexcept = 0

Replaces a child node child with other nodes.

virtual bool erase_child(const node_t &node) noexcept = 0

Remove the node node from this node’s children. Does nothing if node is not a child node.

Returns:

TRUE if the child node was found and removed, FALSE otherwise.

inline auto children_view() const noexcept

A view of all children as const references.

inline auto children_view() noexcept

A view of all children as references.