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.hpp>

Classes

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

Public Member Functions

 Node (const Node &)=default
 
 Node (Node &&) noexcept=default
 
Nodeoperator= (const Node &)=default
 
Nodeoperator= (Node &&) noexcept=default
 
const NodeValue & GetValue () const noexcept
 
void SetValue (const NodeValue &value)
 
void SetValue (NodeValue &&value)
 
NodeType GetType () const noexcept
 
void SetType (NodeType type)
 
void Clear ()
 
bool IsValid () const noexcept
 
const NodeProperties & GetProperties () const noexcept
 
NodeProperties & GetProperties ()
 
bool HasProperty (const std::string &name) const
 
const NodeGetProperty (const std::string &name) const
 
void SetProperty (const std::string &name, const Node &node)
 
bool RemoveProperty (const std::string &name)
 
Nodeoperator[] (const std::string &key)
 
const Nodeoperator[] (const std::string &key) const
 
Nodeoperator[] (size_t index)
 
const Nodeoperator[] (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
 
size_t size () const noexcept
 

Static Public Member Functions

static bool ParseYAML (Node &node, std::string_view str)
 
static bool WriteYAML (const Node &node, std::ostream &stream, const Format &format=Format::Minified)
 

Friends

const Nodeoperator>> (const Node &node, Node &out)
 Copy the node's content.
 
Nodeoperator<< (Node &node, const Node &in)
 Copy content from one node to another.
 
const Nodeoperator>> (const Node &node, bool &b)
 
Nodeoperator<< (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.

Friends And Related Symbol Documentation

◆ 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: