Best way to save/load an object to file?

Bill Baxter dnewsgroup at billbaxter.com
Sun Jun 22 17:23:17 PDT 2008


aarti_pl wrote:
> 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)
> 

Sweet.  Thanks for reminding me about that!
I'm in the market for some serialization code too.

Does it handle references properly?  Meaning if I have class objects A 
and B that both refer to the same C, will C only get serialized once?

--bb


More information about the Digitalmars-d-learn mailing list