Re: mutable deep copying?
Re: mutable deep copying?
- Subject: Re: mutable deep copying?
- From: Ondra Cada <email@hidden>
- Date: Sun, 28 Jul 2002 22:24:56 +0200
On Sunday, July 28, 2002, at 09:56 , Greg Titus wrote:
It seems that [myDict copy] results in a deep copy, while [myDict
mutableCopy] results in a shallow, yet mutable, copy. What I need is a
mutable deep copy of the dictionary.
Right.
My data structure is composed of simple dictionaries, arrays, and
strings. Is there a simple method by which I may obtain a mutable copy
of the entire data structure? Or do I need to implement my own protocol
to do this?
There is no simple way to do this built into the Cocoa frameworks, but it
isn't that difficult to implement it yourself.
Or, you can use ours. There is a -deepMutableCopy implementation for
those classes in OmniFoundation.
Very so.
Or, in this specific case, you *might* want to store archived NSData
instead(*). With archiving, mutability is preserved (unlike with using
property lists, which is effectively what defaults do).
(*) depending on the probability that the defaults might be reasonably
edited externally, using eg. the defaults CLI command.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.