views:

98

answers:

2

Hello I need to load NSKeyedArchiver classes to C++/CLI counterparts. Is there any way to get internal format of NSKeyedArchiver?
Another option is to rewrite whole saving and opening code into pure C++ for both Mac and Windows.

Thanks a lot.

A: 

If you're not serializing anything Objective-C specific then just use XML property lists.

Azeem.Butt
Problem is that I am serializing modeling data in 3d app, it will be extremely huge in XML. So best will be some binary form. I can write serialization in pure C++, but I wrote code using NSKeyedArchiver and if the internal format is not hard I can write similar class for C# or C++/CLI. Thanks for fast answer.
Filip Kunc
Then there's really not any reason for you to use Apple's format for your data.
Azeem.Butt
A: 

So your constraints seem to be:

  1. Something easy to parse on both Windows and Mac.
  2. 3D modeling data, so the format needs to be efficient

If you want something quick and dirty, go with a binary plist (and possibly gzip it). You could also try Google's protocol buffers but I have no experience with that. There are also a couple open source implementations of Foundation out there -- Cocotron might be most useful for you.

Colin Barrett
I think I will write some quick and dirty custom format in pure C++, using standard ofstream/ifstream in STL. Cocotron looks interesting, if the implementation of format is same with Apple. But I think that reading Cocotron inner workings takes more time than simple ofstream/ifstream C++ implementation for both platforms.Thanks for ideas.
Filip Kunc
I'm about 75% sure it would be the same thing, as I believe NSKeyedArchiver is used in nib files.
Colin Barrett