Function find_child

Synopsis

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

size_t find_child(size_t node, csubstr const &key) const

Description

No description yet.

Mentioned in

Source

Lines 1341-1363 in src/c4/yml/tree.cpp. Line 621 in src/c4/yml/tree.hpp.

size_t Tree::find_child(size_t node, csubstr const& name) const
{
    RYML_ASSERT(node != NONE);
    if(_p(node)->is_val()) return NONE;
    RYML_ASSERT(_p(node)->is_map());
    if(get(node)->m_first_child == NONE)
    {
        RYML_ASSERT(_p(node)->m_last_child == NONE);
        return NONE;
    }
    else
    {
        RYML_ASSERT(_p(node)->m_last_child != NONE);
    }
    for(size_t i = first_child(node); i != NONE; i = next_sibling(i))
    {
        if(_p(i)->m_key.scalar == name)
        {
            return i;
        }
    }
    return NONE;
}





Add Discussion as Guest

Log in