Re: Returning structs of NSStrings
Re: Returning structs of NSStrings
- Subject: Re: Returning structs of NSStrings
- From: Michael Becker <email@hidden>
- Date: Thu, 25 Mar 2004 12:35:09 +0100
I've noticed that dealing with large structs of NSStrings can get
really annoying ("copying" these structs can only be done via copying
each NSString in them [right?]). So should I make all of these into
classes, providing accessor methods? Or am I missing out on something
again?
Depends on the actual task of course, but most probably, instead of
structs you want to use dictionaries:
[mydict setObject:o forKey:@"whatever"]; // instead of
mystruct.whatever=o
o=[mydict objectForKey:@"whatever"]; // instead of o=mystruct.whatever
Yes, I had that idea, but my key/value-pairs will have to be in a
specific order, which rules out a standard NSDictionary.
But you still solved my problem by reminding me of the goold old
categories :-)
I can just insert my own category with a method -(NSString*)xml; which
produces the (ordered) xml-String! Great, thanks!
Bye,
Michael
_______________________________________________
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.