Best way to save/load an object to file?

aarti_pl aarti at interia.pl
Sun Jun 22 15:26:51 PDT 2008


Saaa pisze:
> As the subject says  : )
> 
> I could make my own personal loading saving functions of all the specific 
> variables in the objects, but I'd love there to be an easier way than that.

You may try doost serializer:
http://dsource.org/projects/doost/

You can serialize to file (generally: different kinds of storages) or to 
string. There are 2 kinds of archives: simple text archive and JSON archive.

See below for use cases:
http://dsource.org/projects/doost/browser/trunk/examples/util/serializer/FunctionTest.d
http://dsource.org/projects/doost/browser/trunk/examples/util/serializer/FunctionTest1.d

Simplest use case for storing in file you can find in FunctionTest1.d - 
3rd unit test from top.

Currently Phobos only, but should be rather easy to adapt for Tango.

BR
Marcin Kuszczak
(aarti_pl)



More information about the Digitalmars-d-learn mailing list