Function move

Summary

#include <src/c4/yml/node.hpp>

(1) void move(NodeRef const after)

(2) void move(NodeRef const parent, NodeRef const after)

Function overload

Synopsis

#include <src/c4/yml/node.hpp>

void move(NodeRef const after)

Description

change the node's position within its parent

Source

Lines 639-643 in src/c4/yml/node.hpp.

inline void move(NodeRef const after)
{
    _C4RV();
    m_tree->move(m_id, after.m_id);
}

Synopsis

#include <src/c4/yml/node.hpp>

void move(NodeRef const parent, NodeRef const after)

Description

move the node to a different parent, which may belong to a different tree. When this is the case, then this node's tree pointer is reset to the tree of the parent node.

Source

Lines 648-661 in src/c4/yml/node.hpp.

inline void move(NodeRef const parent, NodeRef const after)
{
    _C4RV();
    RYML_ASSERT(parent.m_tree == after.m_tree);
    if(parent.m_tree == m_tree)
    {
        m_tree->move(m_id, parent.m_id, after.m_id);
    }
    else
    {
        parent.m_tree->move(m_tree, m_id, parent.m_id, after.m_id);
        m_tree = parent.m_tree;
    }
}





Add Discussion as Guest

Log in