On Wed, 2006-04-05 at 17:50 +0200, Jacob Kroon wrote: > Hi, > > I'm looking for a way to serialize GObject-derived classes into XML. I'm > basically writing a block-diagram editor, similar to Simulink/Matlab, > where I have a Diagram class, and diff. block classes, and I'd like to > be able to save the diagrams to a file, so my idea is to implement a way > to serialize the blocks and the diagram. All interesting attributes are > implemented as GObject attributes, so if I can could implement > block_to_xml() and diagram_to_xml() functions, things would work out > nicely I think. Of course I would have to go the other way too, when > loading diagrams, xml_to_block() and xml_to_diagram(). > > The trouble is I don't really know where to start, is this something > that has been documented elsewhere, or does anyone know of some example > code or ideas I could look into? > > My initial idea is to implement some sort of GObject serializer, which > outputs the classname, and the same for all properties the GObject has > registered. > > Any comments would be most welcome! You can iterate over the properties. The get_properties() function here does that, after instantiating an object of a particular type http://cvs.gnome.org/viewcvs/glibmm/tools/extra_defs_gen/generate_extra_defs.cc?view=markup You would just need to add some code to get the values of a specified instance. -- Murray Cumming murrayc@xxxxxxxxxxx www.murrayc.com www.openismus.com _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list