How to archive opaque CF objects
How to archive opaque CF objects
- Subject: How to archive opaque CF objects
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 12 Dec 2002 08:29:50 -0500
I would like to use NSKeyedArchiver to archive a Cocoa object that contains,
among other things, an opaque Core Foundation object of type CFTypeRef.
As I understand the lastest Cocoa archiving documentation, I can't encode a
CFTypeRef in an NSData object or in any other standard Cocoa object, because
the pointer values hidden in the CFTypeRef object won't be encoded in a way
that would allow them to be decoded correctly -- at least after the original
object has been deallocated.
According to the docs, the recommended technique for archiving structs and
other aggregate data types is to archive their individual fields separately.
But CFTypeRefs are opaque and I don't know how they're structured. All I can
do is use CF functions supplied with the CFTypeRef to get at some of the
values. The particular CFTypeRef objects in which I'm interested don't
implement "CreateCopy" functions.
So, is it fair to say that direct archiving is not an option for objects
containing opaque CF objects that are not toll-free bridged to a Cocoa
object type and that can't be copied?
Is my only option to call the CF functions to get those field values that
are available through functions and to archive their results? This seems
very awkward for situations where all I want to do is to archive an object
temporarily, say for distribution to another process, and then reconstitute
it on the other side. I will never be sure that I have captured all the
contents of the CFTypeRef to reconstitute it fully.
If there is a solution, it should be covered in the Carbon-Cocoa Integration
document, but the preliminary version says nothing about this.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.