开发者

Retrieve anchor & alias string in yaml-cpp from document

I've looked through the yaml-cpp documentation & source code and know that linking of anchored nodes is 开发者_JAVA百科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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜