PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
pixelbullet::Node Class Reference

Represents a hierarchical node capable of storing various data types and supporting YAML serialization. More...

#include <node.h>

Classes

struct  Format
 Formatting options for YAML serialization. More...

Public Member Functions

 Node (const Node &)=default
 Node (Node &&) noexcept=default
Node & operator= (const Node &)=default
Node & operator= (Node &&) noexcept=default
const NodeValue & value () const noexcept
void set_value (const NodeValue &value)
void set_value (NodeValue &&value)
NodeType type () const noexcept
void set_type (NodeType type)
void clear ()
bool is_valid () const noexcept
const NodeProperties & properties () const noexcept
NodeProperties & properties ()
bool has_property (const std::string &name) const
const Node * get_property (const std::string &name) const
void set_property (const std::string &name, const Node &node)
bool remove_property (const std::string &name)
Node & operator[] (const std::string &key)
const Node & operator[] (const std::string &key) const
Node & operator[] (std::size_t index)
const Node & operator[] (std::size_t index) const
template<typename T>
as () const
template<typename T>
void set (const T &in)
auto begin ()
auto end ()
auto begin () const
auto end () const
std::size_t size () const noexcept

Static Public Member Functions

static bool parse_yaml (Node &node, std::string_view str)
static bool write_yaml (const Node &node, std::ostream &stream, const Format &format=Format::minified)

Friends

const Node & operator>> (const Node &node, Node &out)
 Copy the node's content.
Node & operator<< (Node &node, const Node &in)
 Copy content from one node to another.
const Node & operator>> (const Node &node, bool &b)
Node & operator<< (Node &node, bool b)

Detailed Description

Represents a hierarchical node capable of storing various data types and supporting YAML serialization.

The Node class stores a value as a string and maintains a list of properties for composite data types. It provides overloaded operators for convenient type conversion and YAML parsing/emission.

◆ operator<<

Node & operator<< ( Node & node,
const Node & in )
friend

Copy content from one node to another.

◆ operator>>

const Node & operator>> ( const Node & node,
Node & out )
friend

Copy the node's content.


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