在YAML :: Node上进行迭代时,如何获取当前节点的父节点?

问题描述

我在遍历YAML::Node时正在构建树结构。到目前为止,当层次结构下降时,我能够构建树。但是,如果层次结构发生变化,我将无法获得父节点。

batman:
  type: super hero
  entity: ""
  natural: yes
  attributes:
    powers:
      whip:
        x: ""
        y: ""
      batmobile:
        x: ""
        y: ""

基于上述结构,我如何获得batmobile的父节点? 假设我正在这样迭代:

for (YAML::const_iterator it = node.begin(); it != node.end(); ++it)
{
    std::cout << it->first.as<std::string>() << std::endl; // prints batmobile
    
   // how to get the parent node of batmobile?
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)