certik / yaml-cpp

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

Add auto-serialization base class #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is an enhancement request that comes with a suggested
complete working implementation as an attachment.

I think it would be good to provide a base class and some
macros that take care of most of the usual cut & paste work
needed to to serialize/de-serialize objects as YAML.

e.g.:
class my_class: public YAML::Serializable {
    public:
      YAML_SERIALIZE_AUTO(my_class)

      void emit_members(YAML::Emitter &e) {
        YAML_EMIT_MEMBER(e,x);
        YAML_EMIT_MEMBER(e,y);
      }

      void load_members(YAML::Node &n) {
        YAML_LOAD_MEMBER(n,x);
        YAML_LOAD_MEMBER(n,y);
      }
...
};
...
my_class my_obj;
doc >> my_obj;
emitter << my_obj;

I have a working implementation of this in my own environment
but I'd like to get it into the standard distribution to
ease porting to other systems (so I don't have to patch every
time I download a new source tree).

I've attached all of the added or modified files involved
in my implementation.  It is fully Doxygenated for your reading
pleasure.

I'd also like to join the project to contribute things like this
directly to the source code repository (on branches of course)
but I can't figure out how else to contact you to make
the request so I am doing it through an issue report.

Sorry about that.

I can be reached via email: steve AT stevemadere DOT com

Original issue reported on code.google.com by stevemad...@gmail.com on 6 May 2010 at 7:08

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! This looks like a good idea. I may take a little bit of time to 
actually accept the patch, since I'm a bit 
preoccupied with some other stuff right now, but it looks pretty 
dump-right-in-able.

As for contacting me otherwise, my google email is jbeder; and with regards to 
contributing to branches, 
unfortunately, I don't think there's a way to grant selective commit access. 
For now, just submit patches through 
the issue system, and if it turns out that you have a lot of good suggestions, 
I'll add you as a committer.

Thanks again!

Original comment by jbe...@gmail.com on 6 May 2010 at 11:32