21

YAML seems like a great format for configuration files & data binding persistent objects in human-readable form...

Is there a C++ library that handles YAML? Does Boost::Serialization have plans for a YAML option?

EDIT: I would prefer an OO library.

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
oz10
  • 153,307
  • 27
  • 93
  • 128
  • 1
    I wish Cereal, which is great otherwise, would have the possibility to parse\write yaml. It doesnt have to use all the features of yaml, just the equivalent of a simple json tree. – Viktor Sehr Mar 01 '16 at 12:44

3 Answers3

18

A quick search gave me this: yaml-cpp

Community
  • 1
  • 1
Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83
5

Try the YAML component from the BOOST vault serialization library.

EDIT 2014: A recent development, https://groups.google.com/d/msg/boost-devel-archive/mhT7qIh1nsI/uXAuXFAWrxQJ

EDIT 2019: Didn't try it yet, but this seems to be a serious take: https://github.com/rwols/yaml-archive

alfC
  • 14,261
  • 4
  • 67
  • 118
  • 1
    I recently try to made it work, to make it compile, 1) I had to adapt the library to the newer version of the Boost.Serialization Archive framework (mostly updating names of internal classes), 2) update namespace to use the now Spirit.Classic ... – alfC Sep 02 '14 at 07:07
  • 1
    ... 3) change Boost tuples code, 4) move a lot of code to `.hpp` since some instantiations didn't work. 5) Yet, I couldn't make it work since the NVP wrapper doesn't work with arrays, finaly I made it output a serialization which looks correct, however I cannot deserialize it. After a lot of work, I get an error on the use of Spirit grammar (something about wrong use of `rule_t` to unary expression `!S >> '=' >> !S`. I can't do anymore. Maybe it will pay off to start from scratch on top of the XML archive case. – alfC Sep 02 '14 at 07:07
0

I found this, please if you use it let me know how it did it for you and post some example if possible,

https://code.google.com/p/google-summer-of-code-2008-boost/downloads/list

UPDATED link (as 2014), it seems to point to the same files as the BOOST vault answer.

alfC
  • 14,261
  • 4
  • 67
  • 118