majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

user-defined tags are parsed, but there is no way for the user to access that data #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm new to YAML so i might be talking out of my ass.

{
  MyNode1: !node { prop1: badger, prop2: hamster },
  MyNode2: !node { prop1: narwhal, prop2: llama ),
  MyGroup1: !group {
    MyNode3: !node { prop1: gerbil, prop2: hamster },
    MyNode4: !node { prop1: ostrich, prop2: llama ),
  },
}

in my code i want to distinguish between different types of YAML::Node
before going in and looking at their content.
this information ("!group") is parsed into m_tag but there is no public
function that makes it accessible.

Original issue reported on code.google.com by oranagra...@gmail.com on 3 Feb 2010 at 8:43

GoogleCodeExporter commented 9 years ago
additionally, it seem that in the following case:

  MyGroup1: &group001 !group {
    MyNode3: !node { prop1: gerbil, prop2: hamster },
    MyNode4: !node { prop1: ostrich, prop2: llama ),
  },
  MyGroup2: *group001,

although the node at MyGroup1 carries the m_tag=="!group" the node at MyGroup2 
doesn't.
in my understanding they should point to the same node, or at least to 
identical data.

Original comment by oranagra...@gmail.com on 3 Feb 2010 at 11:38

GoogleCodeExporter commented 9 years ago
Sorry it took so long to get to this. You know how it is :)

Re your first post, that info *is* accessible in the subversion head, it just 
hasn't made its 
way to a numbered version.

Re your second, good call - I was hesitating about what to do here, but you're 
right, and 
I added a little patch to do what you said. The aliased node won't actually 
copy/store the 
tag of its anchor, but its GetTag() function will return the proper name.

Original comment by jbe...@gmail.com on 15 Mar 2010 at 4:12

GoogleCodeExporter commented 9 years ago
By the way, that patch is r359.

Original comment by jbe...@gmail.com on 15 Mar 2010 at 4:13