Retrieve anchor & alias string in yaml-cpp from document

不想你离开。 提交于 2020-01-06 18:33:11

问题


I've looked through the yaml-cpp documentation & source code and know that linking of anchored nodes is handled by yaml-cpp lib but I would still like to access the string value of anchor so I could reuse it as a id for the dictionary of anchor/node pair in my application.

---
- response: &list_01
    - tim: Yes
    - bill: hello
- selector:
    - option: What?
      response: *list_01
    - option: Huh?
      response:
        - tim: Right ...

So for the following yaml document, I would get both the value list_01 along with the first response node (which is the map node which contains the list of maps).

Also is there a some kind built-in dictionary of anchor/node pairs (or a list of nodes that are used multiple times) functionality?


回答1:


It's not currently possible, but I've gotten a couple requests now, so you can follow the issue at http://code.google.com/p/yaml-cpp/issues/detail?id=110.



来源:https://stackoverflow.com/questions/6638802/retrieve-anchor-alias-string-in-yaml-cpp-from-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!