How to serialize classes Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
knuth
Knows some wx things
Knows some wx things
Posts: 41
Joined: Wed Sep 10, 2008 7:32 pm

How to serialize classes

Post by knuth » Thu Oct 09, 2008 9:10 pm

How do I serialize/deserialize a class in c++ and (with) wxWidgets?

I want a class in a string/wxString form and after i do things with it (save to a file , load, etc) i want to deserialize it -> put the data in a new object.

Tanx in advance.

User avatar
tierra
Site Admin
Site Admin
Posts: 1343
Joined: Sun Aug 29, 2004 7:14 pm
Location: Salt Lake City, Utah, USA
Contact:

Post by tierra » Fri Oct 10, 2008 12:10 am

wxWidgets doesn't provide anything to do this. I think most people resort to using boost::serialization, but there's other serialization libraries out there too I think.

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Fri Oct 10, 2008 10:03 am

I'm using wxXmlSerializer from wxCode and it works fine for me.

vsp
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon Feb 21, 2005 12:52 pm

Post by vsp » Mon Nov 03, 2008 12:34 pm

If you want to serialize to binary file, then you can use wxSerialize like CArchive in MFC.

vsp
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon Feb 21, 2005 12:52 pm

Post by vsp » Mon Nov 03, 2008 12:35 pm

If you want to serialize to binary file, then you can use wxSerialize like CArchive in MFC.

knuth
Knows some wx things
Knows some wx things
Posts: 41
Joined: Wed Sep 10, 2008 7:32 pm

Post by knuth » Tue Nov 04, 2008 7:55 pm

Tanx guys for your answers.

I haven't tried wxXmlSerializer nor wxSerialize ;
Just played a little bit with boost. I hope it'll do his job.

Cheers

Post Reply