Gildor's Forums

Author Topic: Proper Serialization Code  (Read 2936 times)
warrantyvoider
Full Member
***
Posts: 109


View Profile
Proper Serialization Code
« on: June 08, 2013, 17:32 »

Hi,
im not so good in C++ so maybe the someone here can help me on this Cheesy
I want to recreate Unreals serialization behavior, and my code so far looks like this I just simply want to write/read a complex object to file. it consists of an int, a byte array (char), and a float. 1st problem: when I do f.e. float f; out << f; it will serialize it as string, but I want the 4 bytes, so I had to write my own classes for each... that feels wrong.
2nd problem: I also have to override the >> operator, but in unreal code I only see << functions, why is that and how could I simplify my code? it feels unneeded complicated that way... has it to do wth the Ar.IsLoading() / Ar.IsSaving() property?

greetz WV
« Last Edit: June 08, 2013, 18:04 by warrantyvoider » Logged
warrantyvoider
Full Member
***
Posts: 109


View Profile
Re: Proper Serialization Code
« Reply #1 on: June 09, 2013, 00:40 »

ok I found a solution myself, this works fine^^

http://me3explorer.freeforums.org/post3452.html#p3452

greetz
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7977



View Profile WWW
Re: Proper Serialization Code
« Reply #2 on: June 10, 2013, 13:24 »

Nice to see that you're switching to C++ and you found solutions to your questions Wink
Logged
warrantyvoider
Full Member
***
Posts: 109


View Profile
Re: Proper Serialization Code
« Reply #3 on: June 10, 2013, 18:51 »

Thanks^^ sometimes it helps just to know that there are ppl, that you can ask if you are stuck, so you dont give up that easily Cheesy
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS