On 24 Apr 2009, at 17:56, Steve Cronin wrote:
Mike;
Thank-you also. The "goodness' just doesn't stop... ;-)
My bad on the NSObject code - thanks for clarifying...
(How on earth could init yield a copy?)
But at the end of your message you say "...there's a reason why
Cocoa has both -copy a
I spent some time on this problem a couple months ago and found some
code on cocoadev which I improved upon, also added a little test
code. There still may be bugs in it.
I don't know what the byte/character limit is on this list, but at
least the header should make it through.
-
Mike;
Thank-you also. The "goodness' just doesn't stop... ;-)
My bad on the NSObject code - thanks for clarifying...
(How on earth could init yield a copy?)
But at the end of your message you say "...there's a reason why Cocoa
has both -copy and -mutableCopy. .."
Is the reason you are allu
On 24 Apr 2009, at 17:15, Steve Cronin wrote:
Graham;
THANK-YOU for this informative and "full-bodied" answer!
I want make sure I fully understand:
1) The "Easy Way" works only if there are no collection objects as
values in the "copied" dictionary (or other collection).
It seems to me th
Graham;
THANK-YOU for this informative and "full-bodied" answer!
I want make sure I fully understand:
1) The "Easy Way" works only if there are no collection objects as
values in the "copied" dictionary (or other collection).
It seems to me that the "Hard Way" is ultimately necessary for "ev
Hi Graham,
On Fri, Apr 24, 2009 at 6:49 PM, Graham Cox wrote:
> Incidentally this makes a very useful basic category on NSDictionary, one
> that every Cocoa programmer is likely to need sooner or later. Here's
mine:
[snip]
You could also use CFPropertyListCreateDeepCopy. Just remember to call
N
Simple, brute-force method: archive the dictionary, then unarchive it.
The result is a 1-line "deep copy".
Of course, that assumes that all the dictionary objects/keys support
archiving.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Pl
On Apr 24, 2009, at 4:35 AM, Steve Cronin wrote:
Everything I do causes any change I make in newThing2 to also be
made in newThing.
newThing2 = [NSMutableDictionary dictionaryWithCapacity:20];
[newThing2 setDictionary:newThing];
[newThing2 setObject:foo forKey:bar]; // at this method line
Le 24 avr. 09 à 10:50, Graham Cox a écrit :
On 24/04/2009, at 6:44 PM, Jean-Daniel Dupas wrote:
NSMutableDictionary *newThing2 = [newThing mutableCopy];
[newThing2 setObject:foo forKey:bar];
This doesn't copy the contents of the dictionary, it only makes a
mutable copy of the dictionary
On 24/04/2009, at 6:44 PM, Jean-Daniel Dupas wrote:
NSMutableDictionary *newThing2 = [newThing mutableCopy];
[newThing2 setObject:foo forKey:bar];
This doesn't copy the contents of the dictionary, it only makes a
mutable copy of the dictionary itself. If an object in the second
dictionar
On 24/04/2009, at 6:39 PM, Graham Cox wrote:
I'm sorry if this is something silly!
When a dictionary is copied, the objects it contains are not copied,
merely retained by the second dictionary. Likewise setObject:forKey
only retains the object.
You need to copy each object ("deep copy"
Le 24 avr. 09 à 10:35, Steve Cronin a écrit :
Folks;
Its been a long day and maybe I'm just in need of sleep but I'm
bamboozeled...
I have an NSMutableDictionary (newThing) that is set up based on
some user defaults and current contextual data.
newThing is fine.
What I want to do is c
On 24/04/2009, at 6:35 PM, Steve Cronin wrote:
Its been a long day and maybe I'm just in need of sleep but I'm
bamboozeled...
I have an NSMutableDictionary (newThing) that is set up based on
some user defaults and current contextual data.
newThing is fine.
What I want to do is clone new
Folks;
Its been a long day and maybe I'm just in need of sleep but I'm
bamboozeled...
I have an NSMutableDictionary (newThing) that is set up based on some
user defaults and current contextual data.
newThing is fine.
What I want to do is clone newThing (newThing2) and leave the values
14 matches
Mail list logo